Search code examples
phpcommand-lineimagemagickimagemagick-convert

ImageMagick creating multiple files


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.


Solution

  • 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.