[gdal-dev] CMYK to RGB conversion
Andrew Patterson
andrew at avenza.com
Mon Jul 21 09:32:37 PDT 2025
Hello!
This might be retreading some ground. I searched the archives and found a
short discussion but it was 11 years ago so I'm not sure how much (if
anything has changed). If nothing has, feel free to just tell me so!
I've got code that reads TIFF/JPG/PNGs and carves them into tiles to feed
to a viewer. It's been working fine for years, but I'm now being told that
I need to handle CMYK (and maybe LAB, though that's a low priority). I've
been using the GDALRasterBand::RasterIO to read in pixels by band and
that's worked pretty well (I already handle greyscale since that's easy).
I could do a CMYK transformation but from what I read in that archived
thread, I'd probably need to switch to the GDALRasterDataset::RasterIO API
instead (not necessarily a bad thing!) so I have enough information to do
the rough mathematical conversion. I have zero idea how to use profiles,
even if they're present though, so I'm not sure how good it would look.
Before I dive into all that work, I figured it was worth asking if there
was something already existing in the API. From searching, it looks like
gdal_translate performs such a conversion so in theory the logic is
somewhere already. If nothing else, maybe I can crib from it? Ideally
there'd be a way for me to say "GDALRasterDataset, please convert to RGB"
but that is probably too optimistic.
Any suggestions or guidance would be greatly appreciated! (even if it's
just "Yes, the old post is still correct, go do that").
--
[image: Avenza Systems Logo]
Andrew Patterson
Lead Software Architect
+1 (416) 487-5116 x401
84 Merton St., Toronto, ON, M4S 1A1
///supply.founders.outreach <https://www.avenza.com/about/contact/>
<https://www.facebook.com/AvenzaSystems/> <https://x.com/Avenza>
<https://www.linkedin.com/company/avenza-systems-inc-/mycompany/>
<https://www.instagram.com/avenzamaps/> <https://x.com/AvenzaMaps>
<https://www.facebook.com/AvenzaMaps/>
[image: Avenza Events Banner] <https://www.avenza.com/resources/events/>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20250721/b2c99237/attachment-0001.htm>
More information about the gdal-dev
mailing list