Negative/Inverted color JPEG/PDF when converting from tiff

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?".
Post Reply
acharyasatyendra
Posts: 6
Joined: 2014-01-21T02:32:15-07:00
Authentication code: 6789

Negative/Inverted color JPEG/PDF when converting from tiff

Post by acharyasatyendra »

Hi,

I am using:
Version: ImageMagick 6.7.4-10 2012-01-25 Q8 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2012 ImageMagick Studio LLC

I get inverted colors jpeg images/PDF when i run following command:
convert.exe -limit memory 8192 -limit map 16384 -limit area 32768 -density 96 -colorspace RGB "C:\test\GE_course2.tiff[0]" -define pdf:use-cropbox=true +repage -quality 80 -strip -filter Lanczos -profile "C:\Documentum\CTS\AlterCast\required\color\sRGB Color Space Profile.icm" -colorspace RGB -resize 1280x300 C:\test\cache\GE_course2.tiff_pdf1q.jpg

or
convert.exe "C:\Documentum\CTS\docbases\satyendrad7\config\temp_sessions\6451096529106935167\GE_course2.tiff.tif" "pdf:C:\Documentum\CTS\cache\GE_course2.tiff-406323418.pdf"

I observed that the tiff I am using is have BitsPerSample as 16. With color depth of > 32-bits
Can anyone help as to why I get these inverted output in both PDF and JPEG?

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

Re: Negative/Inverted color JPEG/PDF when converting from ti

Post by snibgo »

Does this occur with current versions of IM?

If so, please post samples of input files that show the problem. You can put them somewhere like dropbox.com and paste the links here.
snibgo's IM pages: im.snibgo.com
acharyasatyendra
Posts: 6
Joined: 2014-01-21T02:32:15-07:00
Authentication code: 6789

Re: Negative/Inverted color JPEG/PDF when converting from ti

Post by acharyasatyendra »

Snibgo,

No, this is not happening with 6.8.8 and another older version 6.6.3.
This happens only in 6.7.4. Anything specific that has changed in this version of IM?

I will attach the source and output to dropbox and paste the link here soon.

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

Re: Negative/Inverted color JPEG/PDF when converting from ti

Post by snibgo »

Lots have things have changed, including bug fixes. See the change log in the directory of recent IM installation.
snibgo's IM pages: im.snibgo.com
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Negative/Inverted color JPEG/PDF when converting from ti

Post by fmw42 »

Is your tif input CMYK? check from identify -verbose image.tif

Can you post a link to your tif file?
acharyasatyendra
Posts: 6
Joined: 2014-01-21T02:32:15-07:00
Authentication code: 6789

Re: Negative/Inverted color JPEG/PDF when converting from ti

Post by acharyasatyendra »

Hi,

I have few tif files. Some are CMYK and some are sRGB colorspace.
Please find the tif input (sRGB) at https://www.dropbox.com/s/fi5xrusi4yabl ... oPhoto.tif

Let me know if face issues accessing it.

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

Re: Negative/Inverted color JPEG/PDF when converting from ti

Post by fmw42 »

You should not be using both -colorspace and profiles in the same command. Using just profiles is best. This assumes that all your images have profiles.

This works for me under IM 6.8.8.2 Q16 Mac OSX.

Unix syntax:

convert -limit memory 8192 -limit map 16384 -limit area 32768 \
-density 96 PrinterEvaluationImage_V002_ProPhoto.tif[0] \
-define pdf:use-cropbox=true +repage -strip \
-profile /pathto/sRGB.icc \
-filter Lanczos -resize 1280x300 result.jpg



Windows syntax, I think

convert -limit memory 8192 -limit map 16384 -limit area 32768 ^
-density 96 "PrinterEvaluationImage_V002_ProPhoto.tif[0]" ^
-define pdf:use-cropbox=true +repage -strip ^
-profile "C:\pathto\sRGB.icc" ^
-filter Lanczos -resize 1280x300 result.jpg
acharyasatyendra
Posts: 6
Joined: 2014-01-21T02:32:15-07:00
Authentication code: 6789

Re: Negative/Inverted color JPEG/PDF when converting from ti

Post by acharyasatyendra »

Hi fmw42,

I have also tested it with 6.8.8 and it works fine (with and without color space options, did not matter).
The issue occurs only in 6.7.4 version.

The issue even occurs for tiff -> pdf.
convert.exe "C:\...\GE_course2.tiff.tif" "pdf:C:\..\GE_course2.tiff-406323418.pdf"

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

Re: Negative/Inverted color JPEG/PDF when converting from ti

Post by fmw42 »

It is likely either a bug in your old version (and you will need to upgrade IM) or possibly an old version of libtiff on that old version and ( you may need to upgrade libtiff)
acharyasatyendra
Posts: 6
Joined: 2014-01-21T02:32:15-07:00
Authentication code: 6789

Re: Negative/Inverted color JPEG/PDF when converting from ti

Post by acharyasatyendra »

Hi,

Yes it definitely is a bug as I can see that this issue does not appear in ImageMagick-6.7.5-5-Q16.
I will check internally on how to go about this now.

Also can you please help me with some guide to update libtiff?

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

Re: Negative/Inverted color JPEG/PDF when converting from ti

Post by fmw42 »

What platform? I use Mac only and use MacPorts to keep all my delegates updated and I install IM from source. If you are on Windows or Linux, I do not know how to install delegates on those platforms.

use

tiffinfo --version

to see what versions you have on both systems. Perhaps your older system needs an newer libtiff.
acharyasatyendra
Posts: 6
Joined: 2014-01-21T02:32:15-07:00
Authentication code: 6789

Re: Negative/Inverted color JPEG/PDF when converting from ti

Post by acharyasatyendra »

I found out that this issue is fixed in 6.7.5-4 Q16. tested this.
Got the libtiff updated.

Appreciate your support guys :) Thank you.

Thanks,
Satyendra
Post Reply