Page 1 of 1

Masking Path problem with some IM versions

Posted: 2013-08-23T01:57:53-07:00
by samfra
Hello,

this bug appeared on a production server with Image Magick 6.4.

When I tried to test it on my computer with version 6.5.9-10 (2010-02-21), it was successful
Then I downloaded version 6.8.6-8 (2013-08-04 Q16) and it failed.

Here is the problem

I simply type
convert image.tif -resize 200x200 image.jpg

My picture is a watch.

With 6.4 and 6.8, the dial is missing on the transformed image
note : If I type convert image.tif image.jpg .. nothing is missing

With 6.5, my watch is perfectly resized.

any idea ? I can provide the file

thank you


Added on 08/27/2013:
I have opened Photoshop and I have discovered that there were paths AND masks.
I have removed all masks => the conversion works perfectly.
I have removed all paths => the conversion still fails

Conclusion, it's a masking issue, so I have renamed the title

the file can be downloaded here : http://www.utopix.ch/_z3c_/watch-mask.tif

thank you for your help

Re: Clipping Path problem with some IM versions

Posted: 2013-08-23T06:47:21-07:00
by snibgo
Provide the file.

Re: Clipping Path problem with some IM versions

Posted: 2013-08-27T03:38:07-07:00
by samfra
snibgo wrote:Provide the file.
here is the file http://www.utopix.ch/_z3c_/watch-mask.tif

I simple resize it :

convert watch-mask.tif -resize 200x200 output.jpg

I need to be able to handle such files (the programm must be generic)

thank you

Re: Masking Path problem with some IM versions

Posted: 2013-08-27T07:13:42-07:00
by snibgo
You should ignore the alpha.

Code: Select all

convert watch-mask.tif -alpha off -resize 200x200 output.jpg
You might also want to convert it to sRGB, and strip all the non-image elements:

Code: Select all

convert watch-mask.tif -alpha off -colorspace sRGB -resize 200x200 -strip output.jpg

Re: Masking Path problem with some IM versions

Posted: 2013-08-28T01:01:37-07:00
by samfra
Hello,

first, thank you very much for your help, I appreciate.

It solves my problem with this kind of pictures.
But my web application must be able to handle all kinds of pictures.

How could I know if I have to add "-alpha off" for a picture and not for a simple file where I'd like to keep the transparency.
(If it's not possible dynamically, which limit could I give to my customers ?)
Is there no way to do only a kind of "-mask off" ? :)

(in my example, I converted to jpg, but in fact, if I find some alpha channels, I convert to png).

thank you,
Sam

Re: Masking Path problem with some IM versions

Posted: 2013-08-28T07:34:29-07:00
by snibgo
samfra wrote:How could I know if I have to add "-alpha off" for a picture and not for a simple file where I'd like to keep the transparency.
For some files, the alpha is important and you want to keep it. For others, like this one, you want to remove it.

You need to find what chacteristic determines whether you want to keep the alphas. Perhaps all the CMYKA files should have alpha off. Or perhaps files with "mask" in the name need alpha off. Perhaps files that have detail hidden by alpha should have alpha off, but where hidden pixels have a constant color you want to keep the alpha.

EDIT: Or perhaps files with tiff:alpha:unassociated should have alpha off.

Re: Masking Path problem with some IM versions

Posted: 2013-08-28T10:41:08-07:00
by snibgo
Reading posts on these forums about "unassociated" makes me strongly suspect this is the difference.

Modern versions of IM can:

Code: Select all

identify -quiet -format "%[tiff:alpha]" transparent.tif
This returns nothing or "associated" or "unassociated". You may find that testing this, and setting "-alpha off" for "unassociated", does what you want.

In old IM versions, you need to "identify -verbose" and search for "tiff:alpha".