Problems with tiff(tag error) and colors

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
webmagick

Problems with tiff(tag error) and colors

Post by webmagick »

I have compiled IM6.4.0 with libtiff 3.82, ghostscript 8.62 gpl and libpng 1.2.25 on my Intel MacBook
I get some strange behavior with tiff (both screws up colors):
convert Branded_A_Cliped.tif test.jpg
convert Branded_A_Cliped.tif +profile icm -profile "/System/Library/ColorSync/Profiles/Generic CMYK Profile.icc" -profile "/System/Library/ColorSync/Profiles/Generic RGB Profile.icc" BrandClip.jpg

I also get the error: convert: Branded_A_Cliped.tif: unknown field with tag 40961 (0xa001) encountered. `TIFFReadCustomDirectory'.
I looked it up and found out it is the tag for ColorSpace (how can that fail?)
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: Problems with tiff(tag error) and colors

Post by magick »

Tag 40961 is not known to the TIFF delegate library so it throws a warning and ignores it. Use -strip install of +profile icm and see if that makes a difference in your resulting image. Also ensure your version of ImageMagick includes support for LCMS (required for color profile support). Check the DELGATES tag from this command:
  • identify -list configure
webmagick

Re: Problems with tiff(tag error) and colors

Post by webmagick »

LCMS is there

Code: Select all

LIBS          -lMagickCore -llcms -ltiff -lfreetype -ljpeg -lbz2 -lz -lm -lpthread
I even get the error when using identify

Code: Select all

identify -format "%m" test_A_Cliped.tif 
identify: test_A_Cliped.tif: unknown field with tag 40961 (0xa001) encountered. `TIFFReadCustomDirectory'.
TIFF
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: Problems with tiff(tag error) and colors

Post by magick »

Right, that error is thrown by the TIFF delegate library announcing that the image has a tag it does not know about and that it is being ignored.
webmagick

Re: Problems with tiff(tag error) and colors

Post by webmagick »

Those TIFFs will get the wrong colors when converted to JPEG or PNG.
Negative-like colors
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: Problems with tiff(tag error) and colors

Post by magick »

You should post a URL to your image so we can download and reproduce the problem. We have plenty of CMYK TIFF images which we convert to proper RGB JPEG and PNG images using color profiles with correct results.
webmagick

Re: Problems with tiff(tag error) and colors

Post by webmagick »

Imagemagick 6.3.7 in Linux with libtiff 3.8.2 doesn't report any errors with the tiff file.
I also found the EXIFTAG in a header filer for libtiff (tiff.h)

Code: Select all

#define EXIFTAG_COLORSPACE		40961	/* Color space information */
So I guess it is handled somewhere

The tiff file contains an icc color profile: Euroscale Coated v2

Code: Select all

Profile-8bim: 15676 bytes
  Profile-icc: 557164 bytes
    Euroscale Coated v2
  Profile-iptc: 8 bytes
    unknown[2,0]:
  Profile-xmp: 15647 bytes
  Tainted: False
How do I handle this file?
Windows Acdsee and gimp doesn't show the original with correct colors.
Mac os x makes black previews for Finder.
Only Photoshop kan correctly show it
The tiff also contains a clipping path if thats a problem
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: Problems with tiff(tag error) and colors

Post by magick »

It appears that it would be best to use Photoshop for this particular image workflow.
webmagick

Re: Problems with tiff(tag error) and colors

Post by webmagick »

Photoshop is used as a part of the workflow - but a webbased mediabank has thumbnails and makes images easier to find. They are also related to products texts in the same mediabank. So it will be nice to show correct previews of the images there. Is it possible?
Here is a tiff you can play around with:
http://server.imento.dk/Branded_A_Cliped.tif
rud

Re: Problems with tiff(tag error) and colors

Post by rud »

Hi everyone,

I run tiff-3.8.2 & ImageMagick-6.4.5.5 on freebsd7-amd64

I have the exact same issue with almost all tif files i manipulate :
unknown field with tag 37724 (0x935c) encountered. `TIFFReadDirectory' @ coders/tiff.c/TIFFWarnings/521.
unknown field with tag 40961 (0xa001) encountered. `TIFFReadCustomDirectory' @ coders/tiff.c/TIFFWarnings/521.
unknown field with tag 37724 (0x935c) encountered. `TIFFReadDirectory' @ coders/tiff.c/TIFFWarnings/521.

The only -dirty- way i found to convert these pics is to convert them to pdf first. than convert this pdf to jpg with -colorspace rgb
Doing this produces an acceptable thumb..
But again, it's dirty.

So any advice is welcomed
FIY, my identify -list configure shows :
Path: /usr/local/lib/ImageMagick-6.4.5/config/configure.xml

----
Name Value
-------------------------------------------------------------------------------
CC cc -std=gnu99
CFLAGS -D_THREAD_SAFE -I/usr/local/include/OpenEXR -fopenmp -O2 -fno-strict-aliasing -pipe -I/usr/local/include/graphviz -Wall -W
CONFIGURE ./configure '--enable-shared' '--without-dps' '--enable-hdri' '--enable-openmp' '--with-perl=/usr/local/bin/perl5.8.8' '--without-threads' '--without-modules' '--with-gslib' '--with-fpx' '--with-freetype' '--with-fontconfig' '--with-wmf=yes' '--with-xml' '--with-rsvg' '--with-x' '--x-libraries=/usr/local/lib' '--x-includes=/usr/local/include' '--prefix=/usr/local' '--mandir=/usr/local/man' '--infodir=/usr/local/info/' '--build=amd64-portbld-freebsd7.0' 'build_alias=amd64-portbld-freebsd7.0' 'CC=cc' 'CFLAGS=-O2 -fno-strict-aliasing -pipe -I/usr/local/include/graphviz' 'LDFLAGS=-L/usr/local/lib -L/usr/local/lib/graphviz' 'CPPFLAGS=-I/usr/local/include' 'CXX=c++' 'CXXFLAGS=-O2 -fno-strict-aliasing -pipe -I/usr/local/include/graphviz' 'FONTCONFIG_CFLAGS=-I/usr/local/include' 'FONTCONFIG_LIBS=-L/usr/local/lib' 'RSVG_CFLAGS=-I/usr/local/include/librsvg-2' 'RSVG_LIBS=-L/usr/local/lib'
COPYRIGHT Copyright (C) 1999-2008 ImageMagick Studio LLC
CPPFLAGS -I/usr/local/include/ImageMagick
CXX c++
CXXFLAGS -O2 -fno-strict-aliasing -pipe -I/usr/local/include/graphviz -Wall -W
DEFS -DHAVE_CONFIG_H
DELEGATES bzlib djvu fontconfig freetype gs gvc jbig jpeg jp2 lcms openexr png rsvg tiff x11 xml wmf zlib
DISTCHECK_CONFIG_FLAGS 'CC=cc' 'CFLAGS=-O2 -fno-strict-aliasing -pipe -I/usr/local/include/graphviz' 'CPPFLAGS=-I/usr/local/include' 'CXX=c++' 'LDFLAGS=-L/usr/local/lib -L/usr/local/lib/graphviz' --disable-deprecated --with-quantum-depth=16 --with-umem=no --with-autotrace=no --with-dps=no --with-fontpath=
EXEC-PREFIX /usr/local
HOST amd64-portbld-freebsd7.0
LDFLAGS -L/usr/local/lib -L/usr/local/lib -L/usr/local/lib/graphviz -L/usr/local/lib -R/usr/local/lib -L/usr/local/lib -lfreetype -lz -L/usr/local/lib
LIB_VERSION 0x645
LIB_VERSION_NUMBER 6,4,5,5
LIBS -lMagickCore -ljbig -llcms -ltiff -lfreetype -ljasper -ljpeg -lgs -lpng -ldjvulibre -L/usr/local/lib -lfontconfig -lwmflite -lXext -lXt -lSM -lICE -lX11 -lbz2 -pthread -L/usr/local/lib -lIlmImf -lz -lImath -lHalf -lIex -lIlmThread -pthread -L/usr/local/lib -lrsvg-2 -lgdk_pixbuf-2.0 -lm -lcairo -lgobject-2.0 -lgmodule-2.0 -lglib-2.0 -liconv -lxml2 -L/usr/local/lib/graphviz -lgvc -lgraph -lcdt -lz -lm -lgomp
NAME ImageMagick
PCFLAGS -fopenmp
PREFIX /usr/local
QuantumDepth 16
RELEASE_DATE 2008-12-09
VERSION 6.4.5
WEBSITE http://www.imagemagick.org
---
Post Reply