Skip to content

Support PSD files in LAB colorspace

Tomasz Goliński requested to merge tomaszg7/gimp:psd_lab into master

Hi,

I recently bought a image processing book and it is of course Photoshop-centered. A lot of files attached to the book were in PSD format in LAB colorspace. It turns out GIMP can't open those. CMYK support was added in #354 (closed) converting those files to RGB float on the fly. Supporting LAB on top of that is not very difficult and first commit takes care of that.

However, due to the nature of files I had, GIMP wouldn't render them correctly. Turns out they had no layers and the function add_layers() would not run and the colorspace conversion would not happen. Only a "merged image" would be shown and pixel data would be assumed to be in RGB. In consequence I had to add an analogous conversion code to add_merged_image() (second commit). I couldn't test it on CMYK files with no layers as I had no such files, but my PSD files from the book were working nicely.

PSD files I was working with can be downloaded from the publisher webpage: https://helion.pl/pobierz-przyklady/phlak2/

The code was not extensively tested due to the lack of test files. For example I'm not sure if it works fine with files with alpha channel. For one thing, it seems Babl doesn't support u8 (or u16) LAB format with alpha. I don't know if it is on purpose or if it is just an omission.

Merge request reports