How to open and resave only tiff files from hdd to original location…

F
Posted By
foler
Nov 1, 2006
Views
640
Replies
11
Status
Closed
Hello…

We have 2TB storage place with 900.000 diferent file formats, from eps, tif, pdf, indd…

I want action or script for photoshop to open only tif files and resave it with lzw compression over original file in same place. Because some of these picture don’t have any compression we lost big amount space on hdd.

Function "save and close" in action menu don’t work because I don’t need to change pictures and I can’t choose lzw.

Acdsee have what I need but lzw algorith is very bad (litle space is free).

thanks
R
rebus
Nov 2, 2006
In article <ei9v3m$7o$>, "foler"
wrote:

Hello…

We have 2TB storage place with 900.000 diferent file formats, from eps, tif, pdf, indd…

I want action or script for photoshop to open only tif files and resave it with lzw compression over original file in same place. Because some of these picture don’t have any compression we lost big amount space on hdd.
Function "save and close" in action menu don’t work because I don’t need to change pictures and I can’t choose lzw.

Acdsee have what I need but lzw algorith is very bad (litle space is free).
thanks

Record an action using ‘save as’, check the LZW button
and click OK. Stop recording and look at the parameters
in the action. If they are what you want, use batch mode to convert your files. Click on the ‘override action
"save as" command’ button in the dialog.

Try this with a couple of test files until it works.
F
foler
Nov 2, 2006
"save as" write files on only one location. I need to write files to same location where file is. On different folders and subfolders. Across entire tree on hdd.
R
rebus
Nov 3, 2006
In article <eidhmp$g72$>,
"foler" wrote:

"save as" write files on only one location. I need to write files to same location where file is. On different folders and subfolders. Across entire tree on hdd.

The batch command allows you to overwrite the input file, and process sub-folders.

See the help for more info.
T
toby
Nov 3, 2006
foler wrote:
"save as" write files on only one location. I need to write files to same location where file is. On different folders and subfolders. Across entire tree on hdd.

Good time to learn shell and the libtiff utilities 🙂

Oh, you’re on Windows? D’oh!
F
foler
Nov 3, 2006
I have and MAc OS X. If you have solution for mac, tell me.

"toby" wrote in message
foler wrote:
"save as" write files on only one location. I need to write files to same location where file is. On different folders and subfolders. Across entire
tree on hdd.

Good time to learn shell and the libtiff utilities 🙂

Oh, you’re on Windows? D’oh!
T
toby
Nov 3, 2006
foler wrote:
I have and MAc OS X. If you have solution for mac, tell me.

Download and install libtiff utilities (to do recompression). You will need the Xcode tools installed (can be freely obtained from Apple web site, or your OS X CD). The following command is one line:

$ curl ftp://ftp.remotesensing.org/pub/libtiff/tiff-3.8.2.tar.gz |tar -xzf –
$ cd tiff-3.8.2
$ ./configure
$ make
$ export PATH=$PATH:`pwd`/tools

Now change directory to your original top level directory (change ‘from’ to your appropriate path):

$ cd from
$ ls -lR
total 408
-rw-r–r– 1 toby toby 151932 Nov 3 18:14 rgb.tif
drwxr-xr-x 4 toby toby 136 Nov 3 18:14 testdir

../testdir:
total 1568
-rw-r–r– 1 toby toby 749428 Nov 3 18:14 cmyk.tif

Batch the compression. Note this command is on one line.

$ for F in `find . -name \*.tif` ; do D=../to/`dirname $F`; mkdir -p $D; echo $F; tiffcp -c lzw $F $D/`basename $F` ; done
../rgb.tif
../testdir/cmyk.tif
$

Recompressed files are left in a directory tree named ‘to’ in parent of current directory.

$ ls -lR ../to
total 232
-rw-r–r– 1 toby toby 117302 Nov 3 18:22 rgb.tif
drwxr-xr-x 3 toby toby 102 Nov 3 18:22 testdir

…/to/testdir:
total 1408
-rw-r–r– 1 toby toby 720672 Nov 3 18:22 cmyk.tif
$

N.B. The above recipe will fail if your directory or file names have spaces in them.
T
toby
Nov 4, 2006
toby wrote:
foler wrote:
I have and MAc OS X. If you have solution for mac, tell me.

Download and install libtiff utilities (to do recompression). You will need the Xcode tools installed (can be freely obtained from Apple web site, or your OS X CD). The following command is one line:
$ curl ftp://ftp.remotesensing.org/pub/libtiff/tiff-3.8.2.tar.gz |tar -xzf –
$ cd tiff-3.8.2
$ ./configure
$ make
$ export PATH=$PATH:`pwd`/tools

Now change directory to your original top level directory (change ‘from’ to your appropriate path):

$ cd from
$ ls -lR
total 408
-rw-r–r– 1 toby toby 151932 Nov 3 18:14 rgb.tif
drwxr-xr-x 4 toby toby 136 Nov 3 18:14 testdir

./testdir:
total 1568
-rw-r–r– 1 toby toby 749428 Nov 3 18:14 cmyk.tif

Batch the compression. Note this command is on one line.
$ for F in `find . -name \*.tif` ; do D=../to/`dirname $F`; mkdir -p $D; echo $F; tiffcp -c lzw $F $D/`basename $F` ; done
./rgb.tif
./testdir/cmyk.tif
$

Recompressed files are left in a directory tree named ‘to’ in parent of current directory.

Re-reading your post I see you wanted an in-place recompression, this can be done with a command similar to:

$ for F in `find . -name \*.tif` ; do tiffcp -c lzw $F /tmp/out.tif && mv /tmp/out.tif $F ; done

This also assumes that the TIFF files can be distinguished e.g. by extension .tif. If this is not the case, different measures are needed (checking Mac file type or for TIFF signature). This is still scriptable.

In any case, take a backup before doing anything to your data on such a large scale!

$ ls -lR ../to
total 232
-rw-r–r– 1 toby toby 117302 Nov 3 18:22 rgb.tif
drwxr-xr-x 3 toby toby 102 Nov 3 18:22 testdir

../to/testdir:
total 1408
-rw-r–r– 1 toby toby 720672 Nov 3 18:22 cmyk.tif
$

N.B. The above recipe will fail if your directory or file names have spaces in them.
F
foler
Nov 10, 2006
please, write me correct command line for converting all tiff images with lzw. all my tiff files have *.tif extension.

example: command line for all tiff’s in all folders & subfolders for g:\test tif\ to convert over existing file with lzw compression.

thanks
F
foler
Nov 11, 2006
Toby, I am not programer, and I need clean example command line for this job. I need this for PC because Macs is very slow.
T
toby
Nov 11, 2006
foler wrote:
please, write me correct command line for converting all tiff images with lzw. all my tiff files have *.tif extension.

example: command line for all tiff’s in all folders & subfolders for g:\test tif\ to convert over existing file with lzw compression.

Given above.

thanks
T
toby
Nov 12, 2006
foler wrote:
Toby, I am not programer, and I need clean example command line for this job. I need this for PC because Macs is very slow.

I’m sorry, the software build instructions and one-line batch command above are for OS X. A Windows expert, which I am not, will have to provide the equivalent for DOS.

Related Discussion Topics

Nice and short text about related topics in discussion sections