Can't load indexed color PSD file (regression)
nonkeltjebob opened this issue · comments
Magick.NET version
14.0.0
Environment (Operating system, version and so on)
Windows (11 - 23H2) - .NET Framework 4.8 - x64 runtime
Description
Sample file: https://1drv.ms/u/s!AkVbxLucveB7gYsrjgsE5ctF9e4YUw?e=faNL0v
Upgrading from 13.7.0 to 14.0.0 I'm running against one conversion error (all our other tests run fine - kudos).
Simply loading the metadata (pinging) this image throws the error:
ImageMagick.MagickCorruptImageErrorException: 'improper image header `.\IndexedColor.psd' @ error/psd.c/ReadPSDLayersInternal/2042'
Loading the file in MagickImage works, but loading/pinging in MagickImageCollection fails.
I can load it in IrfanView just fine (I unfortunately don't have Photoshop on my machine to closer inspect the file) so it seems at first sight the file isn't corrupt. If it is corrupt, then it's actually a regression in the writing of the file, since it was generated by Magick.NET by resizing an original CMYK 2000x2000 PSD into this Indexed palette 200x200 PSD. I can supply additional code if necessary.
Note: might be #448 reintroduced, which came up while I was searching.
Note 2: there are some versions in between 13.7.0 and 14.0.0, but I'm having some local issues reverting back to previous versions to be able to nail down the regression window - I'll come back to this.
Steps to Reproduce
using (var miCollection = new MagickImageCollection(path))
{
layerCnt = miCollection.Count;
}
Adding file here for future reference: Indexed.zip
Thanks for reporting this and providing me with a file that I can use a debugger to figure out why this now fails. Recent version of ImageMagick contain extra checks for PSD channels. But it looks like this contains a bug for indexed channels. I just pushed a patch and this issue will be resolved in the next release.