brightness issue converting from tif to png

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
User avatar
fmw42
Posts: 22080
Joined: 2007-07-02T17:14:51-07:00
Location: Sunnyvale, California, USA

Re: brightness issue converting from tif to png

Post by fmw42 » 2017-08-14T09:34:39-07:00

I think you should convert your tif to sRGB before doing any resizing (-thumbnail). Also note that -quality 100 means something totally different for PNG, TIF and JPG. With tiff you need to specify the type of compression. See http://www.imagemagick.org/script/comma ... hp#quality

mnougarede
Posts: 13
Joined: 2017-08-10T02:16:30-07:00
Authentication code: 1151

Re: brightness issue converting from tif to png

Post by mnougarede » 2017-08-16T02:07:16-07:00

Hello,

Thanks for your answers:

@fmw42 : thanks to notice me about the quality parameter and their differences. Can it have an impact on the channels ?
If so i will try to make some tests and adjusting quality / compression parameters.

@snibgo :
my problem is that i used IM to do with sRGB tif / jpg / png thumbails using a tif with a CMYK embedded profile.
The tif and jpg thumbnails are ok whereas my png thumbnail have a difference in its channels and looks more lighter.

- Original picture and Thumbnails (~180Mo) -> https://lion.box.com/s/5erw2ucfjr4fqsy0lcc0xjhtnp95d6tv
- Resulting Thumbnails in JPG (OK) and PNG (lighter) (~7Mo) -> https://lion.box.com/s/k5hrvy275h20z131i8awufdbsqvdudnd

Best regards,

snibgo
Posts: 9378
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: brightness issue converting from tif to png

Post by snibgo » 2017-08-16T07:07:24-07:00

mnougarede wrote:- Resulting Thumbnails in JPG (OK) and PNG (lighter) (~7Mo) -> https://lion.box.com/s/k5hrvy275h20z131i8awufdbsqvdudnd
You linked to these upthread, and I commented on them. Yes, the PNG is slightly lighter than the JPG. JPG compression is lossy, so it is different to the PNG.
snibgo's IM pages: im.snibgo.com

mnougarede
Posts: 13
Joined: 2017-08-10T02:16:30-07:00
Authentication code: 1151

Re: brightness issue converting from tif to png

Post by mnougarede » 2017-08-16T08:06:40-07:00

Hi,
snibgo wrote:
2017-08-16T07:07:24-07:00
Yes, the PNG is slightly lighter than the JPG. JPG compression is lossy, so it is different to the PNG.
Thanks for your answer, so you mean i won't be able to obtain the same result for a PNG?

I tried to adjust the -quality value since i used 100 before and for PNG it has no meaning following the documentation.

I tried -quality with different arguments but the compression does not impact the resulting channels.

Best regards,

snibgo
Posts: 9378
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: brightness issue converting from tif to png

Post by snibgo » 2017-08-16T08:41:59-07:00

PNG compression is always lossless. That means it never changes pixel values.

JPG compression by IM is always lossy. That means it always changes pixel values. (In theory it might not, but in practice it always does.) So JPG will always give a different result to PNG. The PNG version will be more correct.

With PNG, "-quality" refers to the method of compression, which affects the file size. There is no simple relationship between the quality number and the file size, because the most effective method depends on the type of image.
snibgo's IM pages: im.snibgo.com

mnougarede
Posts: 13
Joined: 2017-08-10T02:16:30-07:00
Authentication code: 1151

Re: brightness issue converting from tif to png

Post by mnougarede » 2017-08-16T08:49:56-07:00

fmw42 wrote:
2017-08-14T09:34:39-07:00
I think you should convert your tif to sRGB before doing any resizing (-thumbnail).
I tried the 2 commands below without success:

convert original.tif -profile sRGB2014.icc original-sRGB.tif
convert original-sRGB.tif -thumbnail 1280> -profile sRGB2014.icc original-sRGB.png

I really don't want to switch to XnView (nconvert) because i don't understand what introduce the channel differences using IM.

mnougarede
Posts: 13
Joined: 2017-08-10T02:16:30-07:00
Authentication code: 1151

Re: brightness issue converting from tif to png

Post by mnougarede » 2017-08-16T10:15:17-07:00

Hello,

I found out that with the command below i got a really good result, but i don't understand technically what does it change.

Is it safe to assume that i could add -define png:exclude-chunk=sRGB on any conversion of tif to png ?

User avatar
fmw42
Posts: 22080
Joined: 2007-07-02T17:14:51-07:00
Location: Sunnyvale, California, USA

Re: brightness issue converting from tif to png

Post by fmw42 » 2017-08-16T15:04:03-07:00

mnougarede wrote:
2017-08-16T10:15:17-07:00
Hello,

I found out that with the command below i got a really good result, but i don't understand technically what does it change.

Is it safe to assume that i could add -define png:exclude-chunk=sRGB on any conversion of tif to png ?
What command below? I don't see any full command line! Please be more specific and show the full command line and specify what exactly you do not understand.

mnougarede
Posts: 13
Joined: 2017-08-10T02:16:30-07:00
Authentication code: 1151

Re: brightness issue converting from tif to png

Post by mnougarede » 2017-08-17T00:42:32-07:00

Sorry i forgot to paste the command:

Code: Select all

convert original.tif -profile sRGB2014.icc -define png:exclude-chunk=sRGB original-exclude-chunk-sRGB.png
I don't understand why i have to add -define png:exclude-chunk=sRGB to match the colors of my original tif and if it's same to assume that i can add this parameter to all conversion of tif to png.

Best regards,

User avatar
fmw42
Posts: 22080
Joined: 2007-07-02T17:14:51-07:00
Location: Sunnyvale, California, USA

Re: brightness issue converting from tif to png

Post by fmw42 » 2017-08-17T09:44:37-07:00

Sorry, I cannot answer that.

But this command works fine for me on IM 6.9.6.7 Q16 Mac OSX

Code: Select all

convert originalFL.tif -profile /Users/fred/images/profiles/sRGB.icc originalFL_fred.png
I am using libpng 1.6.30 and liftiff 4.0.8. Also perhaps your sRGB profile is not the same as mine or corrupt.

What is your IM version and platform and what versions of libpng and libtiff are you using?

sRGB profiles can be found at http://www.color.org/srgbprofiles.xalter

Post Reply