Incompatibility from version 6.3.5

Post any defects you find in the released or beta versions of the ImageMagick software here. Include the ImageMagick version, OS, and any command-line required to reproduce the problem. Got a patch for a bug? Post it here.
Post Reply
SilvioMoioli
Posts: 3
Joined: 2008-04-28T07:58:53-07:00

Incompatibility from version 6.3.5

Post 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
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: Incompatibility from version 6.3.5

Post 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
User avatar
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

Post 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
SilvioMoioli
Posts: 3
Joined: 2008-04-28T07:58:53-07:00

Re: Incompatibility from version 6.3.5

Post 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.
User avatar
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

Post 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.
SilvioMoioli
Posts: 3
Joined: 2008-04-28T07:58:53-07:00

Re: Incompatibility from version 6.3.5

Post 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.
Post Reply