[wplug] Tiff documents

Patrick Wagstrom pwagstro at andrew.cmu.edu
Fri Apr 8 13:43:16 EDT 2005


On Fri, 2005-04-08 at 10:28 -0600, Vance Kochenderfer wrote:
> Tom Fetherston <tfetherston at ncdcorp.com> wrote:
> > I guess I need a utility to split the multipage tiff into single page 
> > tiffs so I can convert them to bitmaps and use potrace to convert them 
> > to SVG.
> 
> ImageMagick's convert utility should do this:
> 
> "Use an optional index enclosed in brackets after a file name to specify a 
>  desired subimage of a multi-resolution image format like Photo CD (e.g. 
>  img0001.pcd[4]) or a range for MPEG images (e.g. video.mpg[50-75]). A 
>  subimage specification can be disjoint (e.g. image.tiff[2,7,4])."
> 
> You can use the -adjoin option to reassemble.

Actually, this is all you need to do:

convert filename.tiff filename.jpg

This will create a series of files called (provided filename.tiff is a
multipage tiff):
filename.jpg.0
filename.jpg.1
filename.jpg.?

You can easily rename them with:

for x in filename.jpg.*; do \
bn=$(echo $x | sed -e "s/\.jpg\.[0-9]$//"); \
num=$(echo $x | cut -d '.' -f 3); mv $x $bn.$num.jpg; done

And then you'll have a series of filename.0.jpg filename.1.jpg etc.

If you need a different format just replace .jpg with .png (or whatever
else) wherever it occurs in the documents.

Hope this helps.

--Patrick






More information about the wplug mailing list