When I use the following command:
convert -modulate 100,0,100 -level 70% -depth 8 jpg:original.jpg pnm:new.pnm
I obtain very different results with ImageMagick before and after version 6.3.5.
For example, using the following image:
I obtain this result with IM 6.3.5 or earlier (further reconverted to png with Gimp):
and this is the result with versions after 6.3.5, up to the latest version (further reconverted to png with Gimp):
Note that the "after 6.3.5" result image is not just a negated version of "before 6.3.5".
Also note that the behavior is consistent in Linux and Mac OS X.
Why is the behaviour changed? Is this a bug?
Thanks in advance,
Silvio
Incompatibility from version 6.3.5
Re: Incompatibility from version 6.3.5
We will need to investigate to determine why the behavior changed. In the mean time use this command to produce the expected results:
- convert original.jpg -modulate 100,0,100 -level 70% -depth 8 -negate pnm:new.pnm
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Incompatibility from version 6.3.5
A bug in -modulate was reported earlier and has been fixed. I don't know if this is your issue or not. See
viewtopic.php?f=3&t=11106
viewtopic.php?f=3&t=11106
-
- Posts: 3
- Joined: 2008-04-28T07:58:53-07:00
Re: Incompatibility from version 6.3.5
magick: as I said earlier, -negate is not enough to reproduce the original behavior (the two images still differ).
fmw42: I'm using
Version: ImageMagick 6.4.0 04/27/08 Q16 http://www.imagemagick.orgCopyright: Copyright (C)
1999-2008 ImageMagick Studio LLC
so the -modulate bug should have been already fixed.
fmw42: I'm using
Version: ImageMagick 6.4.0 04/27/08 Q16 http://www.imagemagick.orgCopyright: Copyright (C)
1999-2008 ImageMagick Studio LLC
so the -modulate bug should have been already fixed.
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Incompatibility from version 6.3.5
I am sorry if I am "sticking my nose where it does not belong" but:
My understanding of the correct convert syntax is to put the input image right after "convert" for most situations.
(Also might it be a GIMP problem in converting to png?)
Thus have you tried the following which produce these results for me on IM 6.4.1-0 Q16-hdri Mac OSX Tiger. (I am not sure what your goal is, however. And curious why you need to use pnm and convert that in GIMP to png, when you can do it directly in IM?)
original:
convert original.jpg -modulate 100,0,100 -level 70% -depth 8 original_mod_70_8.png
convert original.jpg -modulate 100,0,100 -depth 8 -level 70% original_mod_8_70.png
convert original.jpg -modulate 100,0,100 -level 70% original_mod_70.png
convert original.jpg -modulate 100,0,100 -depth 8 original_mod_8.png
convert original.jpg -modulate 100,0,100 original_mod.png
Also taking this image:
and doing
convert icon.png -modulate 100,0,100 icon_mod.png
Thus it appears to me that -modulate is working correctly.
Perhaps the issue is with -level 70%. I am not sure why you are leaving off the white-point value. According to the -level documentation --- "if the white point is omitted it is set to QuantumRange-black_point". Thus either your white point value in -level is being made equal to the black point or more likely the white-point is being set lower than the black-point, which would have a negating effect. (Perhaps your pre 6.3.5 version was the one that had a bug in it and the current version is working correctly?)
Again sorry for sticking my nose in here. But I thought I would at least try to help by seeing if I can reproduce your results. And mine don't seem to match yours.
My understanding of the correct convert syntax is to put the input image right after "convert" for most situations.
(Also might it be a GIMP problem in converting to png?)
Thus have you tried the following which produce these results for me on IM 6.4.1-0 Q16-hdri Mac OSX Tiger. (I am not sure what your goal is, however. And curious why you need to use pnm and convert that in GIMP to png, when you can do it directly in IM?)
original:
convert original.jpg -modulate 100,0,100 -level 70% -depth 8 original_mod_70_8.png
convert original.jpg -modulate 100,0,100 -depth 8 -level 70% original_mod_8_70.png
convert original.jpg -modulate 100,0,100 -level 70% original_mod_70.png
convert original.jpg -modulate 100,0,100 -depth 8 original_mod_8.png
convert original.jpg -modulate 100,0,100 original_mod.png
Also taking this image:
and doing
convert icon.png -modulate 100,0,100 icon_mod.png
Thus it appears to me that -modulate is working correctly.
Perhaps the issue is with -level 70%. I am not sure why you are leaving off the white-point value. According to the -level documentation --- "if the white point is omitted it is set to QuantumRange-black_point". Thus either your white point value in -level is being made equal to the black point or more likely the white-point is being set lower than the black-point, which would have a negating effect. (Perhaps your pre 6.3.5 version was the one that had a bug in it and the current version is working correctly?)
Again sorry for sticking my nose in here. But I thought I would at least try to help by seeing if I can reproduce your results. And mine don't seem to match yours.
-
- Posts: 3
- Joined: 2008-04-28T07:58:53-07:00
Re: Incompatibility from version 6.3.5
In my case, I need to feed the input image from standard input (here I used a file just to ease the explanation). That's why I need the "jpg:-" syntax (IM cannot detect the file type because no extension is provided), and to my understanding it doesn't matter wether you put it after convert or before the end of the line.My understanding of the correct convert syntax is to put the input image right after "convert" for most situations.
The differences between my results and yours are probably due to the different *output* formats: in my application I need pnm, not png, and the bug could be in IM's pnm implementation.But I thought I would at least try to help by seeing if I can reproduce your results. And mine don't seem to match yours.
The reason why I need pnms is that I'm using IM to pre-process images (CAPTCHAs) that are later given to a CAPTCHA-breaking routine. This routine expects a pnm input, so that's why I need that unusual format, the -modulate and the -level stuff.I am not sure what your goal is, however. And curious why you need to use pnm and convert that in GIMP to png, when you can do it directly in IM?)
Since pnm files are not displayed by common browsers I needed a further reconversion to png to post here, so I used GIMP to do that conversion. I didn't use IM because, as I mentioned, I think that the bug could be IM's pnm implementation, so using IM would lead to misleading results.
I tested quite a lot of versions before 6.3.5, up to 6.2, so I doubt the current version is working correctly. Either there was a very very long-standing bug (but strangely it wasn't documented in 6.3.5 changelog), or the behavior changed intentionally, for some rather odd reason.Perhaps your pre 6.3.5 version was the one that had a bug in it and the current version is working correctly?
I doubt that too. Not only GIMP, but other applications also see the same differences between the pre-6.3.5 version and the post-6.3.5 version. Among those I tried ToyViewer and, of course, the CAPTCHA-breaking program I'm using.Also might it be a GIMP problem in converting to png?
I really think this is a IM issue.
No problem! I hope this helps anyway.Again sorry for sticking my nose in here.