question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Grayscale and Quantize on PSD generates corrupted file

See original GitHub issue

Prerequisites

  • I have written a descriptive issue title
  • I have verified that I am using the latest version of Magick.NET
  • I have searched open and closed issues to ensure it has not already been reported

Description

This code creates invalid file:

var fi2 = new FileInfo(@"....\190132LCZ.psd");
IMagickImage image2 = new MagickImage(fi2);

image2.Resize(new MagickGeometry(-1, 200));
// following 2 lines causes to created invalid image
image2.Grayscale(PixelIntensityMethod.Average);
image2.Quantize(new QuantizeSettings
{
	Colors = 256,
	ColorSpace = ImageMagick.ColorSpace.Gray
});

image2.Depth = 8;
image2.ColorSpace = ColorSpace.Gray;
image2.Format = MagickFormat.Psd;
image2.AutoOrient();

image2.Write(@".......\22222.psd");

Such exception is thrown, when I try to call GetColorProfile on that 22222.psd file:

ImageMagick.MagickCorruptImageErrorException: ‘insufficient image data in file `…\22222.psd’ @ error/psd.c/ReadPSDImage/2413’

When I use image magick cli it shows different error though: magick: unable to decompress image `…\22222_GrayScale.psd’ @ error/psd.c/ReadPSDChannel/1442.

Original file: https://drive.google.com/file/d/1LaKrxcZVmGAMhiMoAwo6kjzCpja9L31S/view

  • Magick.NET version: 7.14.0.1

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
dlemstracommented, Nov 22, 2021

We don’t have access to Photoshop so we cannot test your issue @mdemettre and it looks like you have a different problem here? Can you please start a new discussion or issue that explains the problem in more detail.

1reaction
dlemstracommented, Jul 2, 2019

I can reproduce your issue but and it looks to be related to the compression of the image. Will get back to you when I have more info.

EDIT: Found the issue, it was related to what I fixed earlier but I forgot something.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Grayscale and Quantize on PSD generates invalid file
This code creates invalid psd that later causes this - https://imagemagick.org/discourse-serve ... 38#p166838. Original file
Read more >
How can I repair my corrupted PSD file?
Repair Corrupt PSD files on Mac easily with the Wondershare Repairit tool. Repairit is highly suited to fix corrupt, damaged, or inaccessible PSD...
Read more >
Re: Restoring a corrupted PSD file - Page 3 - Adobe Support ...
When I started my computer back up, and tried to open the file again, It only displayed 1 layer shown as a corrupted...
Read more >
Photoshop CC 2021 Corrupting All Files?
Any new file I create and save using versions of photoshop after May of 2022 gives me a corrupted file with "Photoshop cannot...
Read more >
An Analysis of Perturbed Quantization Steganography in the ...
3.10.1 Perturbed Quantization Steganography & Grayscale images ......................... 63 ... As a result, the PNG format creates smaller file sizes than.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found