Hello,
I'm beggining with Image Magick and I'm currently trying to convert and resize a TIFF file to a JPEG file, usually smaller than the original one.
I have two assets : bag.tif and book.tif
Running :
convert bag.tiff -resize 1280x1280 bag.jpg
is correctly doing the conversion.
However, running
convert book.tiff -resize 1280x1280 book.tiff is creating two images :
- One with a black background instead of the transparency (ok, why not as jpeg doesn't handle transparency)
- A second one which is "zoomed" on the non transparent part of the image
Cf:
My goal is that the command generate only one jpeg image (and if possible with a white background instead of a black one.
Can someone explain why I have to image with this command when there is transparency and if possible, could you please provide me a command that will work for both conversion (bag and book) ?
Many thanks in advance,
MisterJpa
Convert tiff to jpeg is creating several images when having transparency
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: Convert tiff to jpeg is creating several images when having transparency
When asking questions, please always provide:
- the version number of IM you are using
- your platform
- links to your input image files
You say:
In your case, I suspect book.tiff contains two images, so you get two outputs. If you just want the first image, then use [0]. And you can flatten against any colour:
- the version number of IM you are using
- your platform
- links to your input image files
You say:
Perhaps you intended to say the requested output is "book.jpg".MisterJpa wrote:convert book.tiff -resize 1280x1280 book.tiff
In your case, I suspect book.tiff contains two images, so you get two outputs. If you just want the first image, then use [0]. And you can flatten against any colour:
Code: Select all
convert book.tiff[0] -resize 1280x1280 -background White -layers Flatten book.jpg
snibgo's IM pages: im.snibgo.com
Re: Convert tiff to jpeg is creating several images when having transparency
Hello @Snibgo,
Many thanks for your help.
The command that you provide is perfectly working in both case.
Sorry for the missing info at the beginning, I will provide them next time !
Many thanks for your help.
The command that you provide is perfectly working in both case.
Sorry for the missing info at the beginning, I will provide them next time !