TIFF conversion result in a color invertion

Discussions on NConvert - the command line tool for image conversion and manipulation

Moderators: XnTriq, xnview

Post Reply
Marvin256

TIFF conversion result in a color invertion

Post by Marvin256 »

I'm using nconvert to convert from a TIFF image to a jpeg. Everything goes fine but colors are inverted.
Any idea ?

Here's the command line I use :

nconvert.exe -out jpeg -resize 640 480 -ratio "MY SIZE Plain_must_have_Cassis 033 - 6836+39 shorty Laura.tif"
User avatar
xnview
Author of XnView
Posts: 34093
Joined: Mon Oct 13, 2003 7:31 am
Location: France
Contact:

Re: TIFF conversion result in a color invertion

Post by xnview »

Marvin256 wrote:I'm using nconvert to convert from a TIFF image to a jpeg. Everything goes fine but colors are inverted.
Any idea ?

Here's the command line I use :

nconvert.exe -out jpeg -resize 640 480 -ratio "MY SIZE Plain_must_have_Cassis 033 - 6836+39 shorty Laura.tif"
Could you post your tif file?
Pierre.
Marvin256

Post by Marvin256 »

Thank you for your help

You'll find the TIFF file here : http://www.serial-skier.com/MY_SIZE_Pla ... _Laura.tif

Regards
Guest

Post by Guest »

Marvin256 wrote:Thank you for your help

You'll find the TIFF file here :

http://www.serial-skier.com/MY_SIZE_Pla ... _Laura.tif

Regards
Marvin256,

Both Nconvert and XnView crashed when I tried to open up your TIF file. However,
Irfanview did not have a problem and was able to convert it to a JPG that did not
have inverted colors when viewed in XnView or Irfanview.

Curious as to why XnView would not open it, I noticed the
following information for the TIF file in the XnView preview:

Number of Planes: 1
Bits Per Plane: 24
Other info: LZW, CMYK

I opened up that TIF file with GIMP and I got the following message:

"alpha channel type not defined for file
MY_SIZE_Plain_must_have_Cassis_033_-_6836+39_shorty_Laura.tif.
Assuming alpha is not premultiplied"


I saved that file as a TIF in two different ways, one with the option
"Save color values from transparent pixels" and one without (both with
LZW compression).

These newly created TIFs could now be opened with XnView and converted to JPG with no
inversion of colors (viewed in XnView and Irfanview). Same was also true for Nconvert.

XnView showed the following info. for these 2 new TIFs:

Number of Planes: 1
Bits Per Plane: 32
Other info: LZW, RGB

I take a guess that the answer as to why your JPG image is inverted probably has
something to do with your TIF being 24 BPP in conjunction with CMYK.

Hope this helps!

Marv
Guest

Post by Guest »

A follow up to my previous post ...

My observations were based on the previous versions of XnView and Nconvert. I just downloaded the new versions and find that the original TIF can now be opened with XnView, but the colors are inverted! When saved to JPG, the colors remain inverted (viewed in Irfanview and XnView). The 2 TIFs created from the original TIF using GIMP can be opened with XnView and do not suffer from any color inversion.

I then used Nconvert to convert the original TIF to a TIF. The resulting TIF had the colors reversed (when viewed in Irfanview and XnView) and running Nconvert on that TIF did not invert the inverted colors! Out of curiosity, I wondered if the LZW compression had something to do with it. I repeated the experiment again with an uncompressed TIF (using Irfanview, NOT XnView, to generate the uncompressed TIF) and found that Nconvert no longer inverted the colors. Same was true for XnView.

Using that uncompressed TIF, I was able to correctly convert the TIF to a resized JPG with Nconvert. I repeated the same experiment using TIFs made with the different compressions available (zip and packbit) and had no problems with Nconvert or XnView. HOWEVER, when I compressed the TIF file with LZW (using the LZW as well as the LZW plus predictive), the resulting TIFs were NOT problems for Nconvert or XnView.

Since that made no sense to me, I went back to the original TIF and this time used XnView to generate an uncompressed TIF. When I attempted to do so, I got a warning that doing so might cause some loss of data (I ignored the warning). That newly generated TIF still had colors inverted when viewed in XnView, but now the colors also appeared inverted in Irfanview!

My new guess is that the information that was supposedly lost when XnView converted the compressed TIF to an uncompressed TIF is information that Irfanview makes use of in order to correctly render the image, but XnView ignores or doesn't interpret correctly.

OK, that does it for me ... I enjoyed the hunt!

Marv
User avatar
DOS386
Posts: 291
Joined: Sun Jun 11, 2006 2:43 pm

Post by DOS386 »

It decodes badly in XNview :-(

When converting into BMP using NC, it indeed gets inverted ... but "-negate" seems to fix it :idea:

TIF is a messy image format :bug: ... better to use BMP for uncompressed and PNG for compressed images :idea:

Also your TIF has 65 MiB of raw 3x8bpp data ... dangerously approaches NC's (?) limits.

Your TIF wrote:
Adobe Photoshop CS3 Macintosh 2007
Get it ^^^ and retry with some smaller TIF's if you need the full truth :mrgreen:
Guest

Post by Guest »

NTOSKRNL_VXE wrote:
When converting into BMP using NC, it indeed gets inverted ... but "-negate" seems to fix it :idea:
Not true, the colors are washed out:

Image
TIF is a messy image format :bug: ... better to use BMP for uncompressed and PNG for compressed images :idea:
Yes Tifs can be tricky, but they seem to be favored by photographers (based on what someone posted in this forum).
I'm not a photographer, but I deal with TIFs whenever I do conversions of printed material into DjVu. So I'm certainly no
stranger to TIFs with inverted colors! :wink:

Marv
User avatar
xnview
Author of XnView
Posts: 34093
Joined: Mon Oct 13, 2003 7:31 am
Location: France
Contact:

Post by xnview »

Ok, there is a problem with XnView & this TIF+ICC
Nconvert doesn't support ICC, perhaps it will be good to add an option?
Pierre.
Post Reply