convert -sepia-tone different on win vs. linux

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
creion
Posts: 4
Joined: 2012-10-12T01:57:59-07:00
Authentication code: 67789

convert -sepia-tone different on win vs. linux

Post by creion »

Hi,

I have an issue with the 2 images below: the first one is created on Linux , the second one on Windows using the same command , same versions of ImageMagick (6.6.5-0) Tried newer versions of IM and they all seem to provide different results Windows vs. Linux.

convert c.jpg -sepia-tone 80% 1.jpg (on Linux)
convert c.jpg -sepia-tone 80% 2.jpg (on Windows)

the results are very different and i cannot figure out why.

What am i doing wrong?
Thanks

Image
Image
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: convert -sepia-tone different on win vs. linux

Post by fmw42 »

I am not sure about your current IM version, but for versions after 6.7.8.3 all grayscale images are treated as linear rather than sRGB. This means that they will look darker than normal. So you may need to convert from RGB to sRGB before processing your grayscale image.

see
viewtopic.php?f=4&t=21269
henrywho
Posts: 188
Joined: 2011-08-17T06:46:40-07:00
Authentication code: 8675308

Re: convert -sepia-tone different on win vs. linux

Post by henrywho »

what about

convert c.jpg -set colorspace sRGB -sepia-tone 80% 1.jpg
convert c.jpg -set colorspace sRGB -sepia-tone 80% 2.jpg
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: convert -sepia-tone different on win vs. linux

Post by fmw42 »

Perhaps it is best if you post a link to your original image so others can test with it. I presume it is a grayscale image.
creion
Posts: 4
Joined: 2012-10-12T01:57:59-07:00
Authentication code: 67789

Re: convert -sepia-tone different on win vs. linux

Post by creion »

The original image is not greyscale. See here Image

Doing convert c.jpg -set colorspace sRGB -sepia-tone 80% 3.jpg gives yet another bad result. Image
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: convert -sepia-tone different on win vs. linux

Post by fmw42 »

My guess is that -sepia-tone is expecting or converting a color image into grayscale before applying the sepia-tone. From IM 6.7.5.5 (or 6.7.6.7) colorspace RGB and sRGB were swapped (to make them correct). Furthermore after IM 6.7.8.3 grayscale images were considered linear. Thus in IM 6.8.0.0, this works for me. Your input is true sRGB, but the conversion by sepiatone makes it linear grayscale. Thus one needs to tell it to think the image is linear even though sRGB, (that is make it think it is RGB). So this works to reproduce your Linux results on my Mac OSX Snow Leopard, IM 6.8.0.0 Q16

convert c.jpg -set colorspace RGB -sepia-tone 80% c2.jpg

I suspect you have mixed versions of IM and are getting different results due to the changes that took place over some time in IM. I would suggest you upgrade to something after IM 6.7.8.3.

The darker of your two result could be that IM is converting it to linear and that would make it darker. You could try on your Windows, the suggestion by henrywho

convert c.jpg -set colorspace sRGB -sepia-tone 80% c2.jpg

since the earlier versions were treating RGB as sRGB and sRGB as RGB, so the above would try to make the grayscale version be treated (not converted) as a proper linear RGB
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: convert -sepia-tone different on win vs. linux

Post by anthony »

First check versions of Imagemagick on the two machines... (most likely cause).

Second check versions of the JPEG library!
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
creion
Posts: 4
Joined: 2012-10-12T01:57:59-07:00
Authentication code: 67789

Re: convert -sepia-tone different on win vs. linux

Post by creion »

Hey guys,
Thanks so much for your input. It turns out i had to do

Code: Select all

convert c.jpg -set colorspace RGB -sepia-tone 80% 1.jpg
So basically forcing Windows to convert it to RGB.

The sRGB conversation was close but it actually had to be RGB.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: convert -sepia-tone different on win vs. linux

Post by fmw42 »

creion wrote:Hey guys,
Thanks so much for your input. It turns out i had to do

Code: Select all

convert c.jpg -set colorspace RGB -sepia-tone 80% 1.jpg
So basically forcing Windows to convert it to RGB.

The sRGB conversation was close but it actually had to be RGB.

That would be correct if you IM version was greater than 6.7.6.7 (or more likely 6.7.8.3). But you claim it is 6.6.5.0. So that is strange to me. Are you sure of your IM versions and that you don't have multiple versions.
creion
Posts: 4
Joined: 2012-10-12T01:57:59-07:00
Authentication code: 67789

Re: convert -sepia-tone different on win vs. linux

Post by creion »

I checked a few times. And on Windows i actually copied convert.exe from the standalone win version of IM to a new folder and did -version first and then ran the command in command prompt and it worked. Version is indeed 6.6.5.0.
fmw42 wrote:
creion wrote:Hey guys,
Thanks so much for your input. It turns out i had to do

Code: Select all

convert c.jpg -set colorspace RGB -sepia-tone 80% 1.jpg
So basically forcing Windows to convert it to RGB.

The sRGB conversation was close but it actually had to be RGB.

That would be correct if you IM version was greater than 6.7.6.7 (or more likely 6.7.8.3). But you claim it is 6.6.5.0. So that is strange to me. Are you sure of your IM versions and that you don't have multiple versions.
Post Reply