aheckmann / gm

GraphicsMagick for node
http://aheckmann.github.com/gm/
6.95k stars 614 forks source link

gm().identify() : "Command failed: identify: eXIf: CRC error. identify: eXIf: incorrect byte-order specifier" #806

Open dzmitryieu opened 4 years ago

dzmitryieu commented 4 years ago

Hi! I'm trying to identify PNG image using identify method of GraphicsMagick. For some specific files with wrong metadata, I get errors like this:

"Command failed: identify: eXIf: CRC error /wrongPNG.png' @ warning/png.c/MagickPNGWarningHandler/1748. identify: eXIf: incorrect byte-order specifier/wrongPNG.png' @ warning/png.c/MagickPNGWarningHandler/1748. identify: Expected 2454597 bytes; found 1094 bytes /wrongPNG.png' @ warning/png.c/MagickPNGWarningHandler/1748. identify: Read Exception/wrongPNG.png' @ error/png.c/MagickPNGErrorHandler/1715."

I assume that such files can be processed and I was trying to apply

.define('png:ignore-crc=true')

method:

gm(filePath).define('png:ignore-crc=true').identify('%[8BIM:1999,2998:#1]', (err, data) => {
    if (err) {
      throw new Error(err);
    }
    return data;
  }

But it did not help me with skipping such errors. Is anybody can help me, how can I ignore CRC errors or handle it inside "identify" method? Or maybe I should use "define()" in a different way? Is there anyway to suppress the error or perhaps there is a way to fix the metadata before I process it?

ImageMagick 7.0.10-7 Q16 x86_64

simonwilbert commented 4 years ago

@aheckmann When you can, is there any chance you can confirm the above issue?