gm
gm copied to clipboard
Stripped warning? (Image corruption detection
Thank you for your great library.
When I'm using imagemagick on broken jpeg (prematurely closed), I would get such a warnings:
identify: Corrupt JPEG data: found marker 0xd9 instead of RST1 `broken2.jpg' @ warning/jpeg.c/JPEGWarningHandler/352.
When I'm using identify inside gm:
gm('broken2.jpg').identify({verbose: true}, function (err, data) { ... })
There is no such a warning.
It's not returned from
var identifyStream = gm()
.command('identify')
.in('-verbose')
.in('broken2.jpg')
.stream().pipe(process.stdout);
as well. What I want to achieve is to detect corrupted images (not only jpegs). Maybe there is another method?
Thanks!
I've done it fast and dirty by sending stderr as third argument to identify callback
https://github.com/F4-Group/gm/tree/identify-stderr
gm(imagePath).identify(function (err, value, stderr) {});
however, this is useful to me to detect Premature end of JPEG file
Corrupt JPEG data
already ends up in err
EDIT: looks like it might depends on imagemagick version. this works for me using version 6.9 (windows) but not 6.7 (linux). does work with 6.8 linux :)
stderr from identify()
is returned in data.warning