This project has moved and is read-only. For the latest updates, please go here.

Multilayer psd, png with transparency displayed with errors/wrong colors

Nov 11, 2014 at 10:48 AM
I'm using Magick.NET- to create a multilayer psd file.
When adding png files with transparency to the imagecollection, it's displayed with random colors/ noise on the right side.
This is a really basic sample code to reproduce the issue:
  using (MagickImageCollection images = new MagickImageCollection())
        var magSet = new MagickReadSettings();
        magSet.Format = MagickFormat.Png;
        var currImg = new MagickImage(@"c:\temp\7.png", magSet);

        currImg = new MagickImage(@"c:\temp\6.png", magSet);
7.png is just a random png pic, will not be visible in the final psd since it's in the layer 0
6.png is the png pic with transparency.
All the .png file and an output .psd file can be downloaded from here
TEMP.7z - dropbox

btw, i had this issue also with a previous version of imagemagick, (7.0.0.something, perhaps 5)
I'm using the library in a mvc app, .net framework 4.5
Nov 11, 2014 at 10:50 PM
I just found a bug when the image writes it's DPI and that explains the noise on the right side. But is now just showing a white image for the transparent image. There is probably a bug in the PSD writer. I will have to investigate this for you.
Nov 12, 2014 at 2:17 AM
ThankYou for your quick feedback, I'll stay tuned
Nov 12, 2014 at 8:14 AM
I will be off the grid for a month starting tomorrow so it will take a while before you get some feedback.
Dec 17, 2014 at 4:06 PM
The bug has been fixed in ImageMagick. I am getting a correct image with the latest development build. I will try to publish a new release later this week.
Dec 18, 2014 at 2:09 AM
Great, thank You!
Apr 1, 2015 at 11:50 AM
sorry for giving feedback about this bug so late;
I've found other scenarios where it happens.
If i do not include the first image (xxx.png) the resulting psd file is 8bit grayscale and all looks ok, but if i include it, all the other images are corrupted.

I'm using Magick.NET-

Follows the code and a link to the images i've used + the resultingpsd file
  using (MagickImageCollection images = new MagickImageCollection())
          var f0 =  new MagickImage(@"c:\temp\IMG\xxx.png"); 
        var currImg = new MagickImage(@"c:\temp\IMG\4.png");
        currImg = new MagickImage(@"c:\temp\IMG\5.png");
        currImg = new MagickImage(@"c:\temp\IMG\19.png");
        currImg = new MagickImage(@"c:\temp\IMG\20.png");
        currImg = new MagickImage(@"c:\temp\IMG\21.png");
Link to Dropbox : IMG.7z

Thanks for your time!
Apr 10, 2015 at 7:56 PM
Thank you for providing me with your image. I did find an issue in the PSD writer that will be fixed in the next release of Magick.NET. In a PSD image all images should use the same number of channels. Some of your images were incorrectly converted to grayscale. I am able to create a correct file with my development build of Magick.NET
Apr 13, 2015 at 3:56 AM
Thanks for the fast fix, i've just tried the .12 release and it's working fine.