Reputation: 2539
I'm running the following:
convert '/var/www/Standard Features.tif' '/var/www/Standard Features.jpg'
and for some reason I'm getting 2 files being created:
-rw-r--r-- 1 root root 31809 Jan 27 23:53 Standard Features-0.jpg
-rw-r--r-- 1 root root 20899 Jan 27 23:53 Standard Features-1.jpg
Why does this happen and how can I make it stop? I can't seem to figure out why this is happening. I've tried changing options and everything, but nothing seems to work.
Upvotes: 8
Views: 4328
Reputation: 53081
TIFF files can have multiple pages. GIF files can have multiple frames and PDF files can have multiple layers. Converting such will produce multiple outputs, one for each page/frame/layer.
If you only want one page/layer/frame of an image in ImageMagick, then just add [x] to your input file name. For example if you just want the first page of a TIFF, then
convert image.tiff[0] out.jpg
See Selecting Frames
If you want a series of pages, use [3-27] for example.
If using ImageMagick 7, replace convert with magick.
Upvotes: 5
Reputation: 69
I found this to be more helpful in dealing with output as it doesn't require knowing how many files ImageMagick will generate. This is only useful if you want only the first image:
convert in.tif -delete 1--1 out.jpg
1 is the second image created (index at 0)
-1 is the last image created
So the 1--1 is a range from the second to the last created image. Your output will be out.jpg instead of out-0.jpg.
Upvotes: 3
Reputation: 96
convert in.tif -delete 0 out.jpg
or
convert in.tif -delete 1 out.jpg
You'll be trying to convert a multi-directory TIFF, which is translated to convert
's image stacks. The -delete
argument specifies stack indices to be deleted (when there is only one image left in the stack, only one image will be output).
Multi-directory TIFFs really do have multiple images, so you'd want to be careful about what you're actually discarding.
Upvotes: 7