Page 1 of 1

Incompatibility from version 6.3.5

Posted: 2008-04-28T08:36:46-07:00
by SilvioMoioli
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:

Image

I obtain this result with IM 6.3.5 or earlier (further reconverted to png with Gimp):

Image

and this is the result with versions after 6.3.5, up to the latest version (further reconverted to png with Gimp):

Image

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

Re: Incompatibility from version 6.3.5

Posted: 2008-04-28T09:11:29-07:00
by magick
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

Re: Incompatibility from version 6.3.5

Posted: 2008-04-28T10:42:11-07:00
by fmw42
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

Re: Incompatibility from version 6.3.5

Posted: 2008-04-29T00:11:15-07:00
by SilvioMoioli
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.

Re: Incompatibility from version 6.3.5

Posted: 2008-04-30T21:13:16-07:00
by fmw42
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:
Image

convert original.jpg -modulate 100,0,100 -level 70% -depth 8 original_mod_70_8.png
Image

convert original.jpg -modulate 100,0,100 -depth 8 -level 70% original_mod_8_70.png
Image

convert original.jpg -modulate 100,0,100 -level 70% original_mod_70.png
Image

convert original.jpg -modulate 100,0,100 -depth 8 original_mod_8.png
Image

convert original.jpg -modulate 100,0,100 original_mod.png
Image


Also taking this image:
Image

and doing

convert icon.png -modulate 100,0,100 icon_mod.png
Image

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.

Re: Incompatibility from version 6.3.5

Posted: 2008-05-01T01:21:46-07:00
by SilvioMoioli
My understanding of the correct convert syntax is to put the input image right after "convert" for most situations.
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.
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 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.
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?)
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.

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.
Perhaps your pre 6.3.5 version was the one that had a bug in it and the current version is working correctly?
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.
Also might it be a GIMP problem in converting to png?
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.

I really think this is a IM issue.
Again sorry for sticking my nose in here.
No problem! I hope this helps anyway.