[gdal-dev] Tiff file with CMYK colors that appears much worse with GDAL than in Windows Photo Viewer
Mikael Rittri
Mikael.Rittri at carmenta.com
Tue Jan 21 06:28:00 PST 2020
Hello, list. I need some advice.
We have a customer with some Tiff files with CMYK colors. It is a rasterized vector
map, not an orthophoto, so the assigned colors are somewhat arbitrary, of course.
The file colors look pleasant enough when opened with Windows Photo Viewer, and
these are the correct colors according to the customer. When I open them with QGIS
or Carmenta Engine, I get worse colors (but identical in QGIS and Carmenta Engine).
Another GIS program I tried displays even worse colors.
The bad colors appear lighter and more saturated, almost fluorescent, and some hues
are clearly different. For example, the original has fairly dark, blue (and slightly green)
texts in water, while the water areas are a very light blue. In QGIS and Carmenta Engine,
the texts in water become saturated cyan and the water areas become a nearly white
cyan. The third GIS program I tried shows the same saturated cyan for texts in water
but an almost-saturated cyan for water areas, which gives very bad contrast.
I understand that to convert from CMYK to RGB one needs to know the CMYK color
profile (and the RGB color profile too, I guess).
Window Properties says that the these Tiff files have "Color Representation: Uncalibrated".
gdalinfo says, among other things, that
TIFFTAG_SOFTWARE=Adobe Photoshop CC (Windows)
SOURCE_COLOR_SPACE=CMYK
and that the bands are Red/Green/Blue/Alpha. But I guess these band colors mean
after automatic color conversion to RGB, since gdalinfo with "GTIFF_RAW:" prefixed
to the file name says that bands are Cyan/Magenta/Yellow/Black.
tiffinfo gives, among other things, a long XML text, x:xmpmeta, but the only color
information I could find in it was
<photoshop:ColorMode>4</photoshop:ColorMode>
Finally, I noticed a section about "Color Profile Metadata" at https://gdal.org/drivers/raster/gtiff.html,
but I didn't understand how to use it.
I guess my first question should be: how one would make the GDAL API respect the
Color Profile Metadata in our tiff files? It seems the default setting does not respect some
embedded CMYK profile that at least Windows Photo Viewer can find? Or is the problem
that Windows Photo Viewer can pick up enough information from the XML line about
photoshop:ColorMode = 4, while GDAL cannot find the CMYK profile from this kind of format?
My understanding of color spaces is perhaps only halfway along https://xkcd.com/1882,
so I probably need some pretty basic hints on where to learn more!
Regards,
Mikael Rittri
Carmenta Geospatial Technologies
www.carmenta.com
More information about the gdal-dev
mailing list