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.

Support and document how to configure sharp to fail when loading corrupt images

See original GitHub issue

Currently, sharp will only emit a warning for corrupt images. It’d be great to add an option to sharp to support rejecting the loading of these images.

See https://github.com/lovell/sharp/issues/607#issuecomment-298678935 and https://github.com/lovell/sharp/issues/607#issuecomment-298692269 for background.

(as always, thanks for Sharp! 👍

Issue Analytics

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

github_iconTop GitHub Comments

2reactions
lovellcommented, Jan 12, 2018

sharp v0.19.0 now available, thanks for your work on this.

1reaction
jcupittcommented, Aug 29, 2017

With 8.5 head I now see:

john@kiwi:~/pics$ head -c 2000 k2.jpg > x.jpg
john@kiwi:~/pics$ vips copy x.jpg y.jpg
(vips:19972): VIPS-WARNING **: read gave 2 warnings
(vips:19972): VIPS-WARNING **: VipsJpeg: Premature end of JPEG file
john@kiwi:~/pics$ echo $?
0
john@kiwi:~/pics$ vips copy x.jpg[fail] y.jpg
(vips:20028): VIPS-WARNING **: error in tile 0 x 8
VipsJpeg: Premature end of JPEG file
john@kiwi:~/pics$ echo $?
1

I’ll add a test to the new libvips test suite as well.

I think you could have got an error from libjpeg with --fail, but it would have been rather difficult.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Support and document how to configure sharp to fail when loading ...
Currently, sharp will only emit a warning for corrupt images. It'd be great to add an option to sharp to support rejecting the...
Read more >
Sharp Copier Printer Image Memory Clear – Corrupt Print Job
Open your printers menu within the control panel in Windows, double click on the Sharp print driver, right click the print job and...
Read more >
Processing images with sharp in Node.js - LogRocket Blog
In this tutorial, we'll analyze and modify an image using the sharp Node.js library. The only prerequisite for this tutorial is a system...
Read more >
Read image and determine if its corrupt C# - Stack Overflow
Try to create a GDI+ Bitmap from the file. If creating the Bitmap object fails, then you could assume the image is corrupt....
Read more >
Top 10 ways to repair & recover corrupt JPG files - YourStory
You make every effort to recover your valuable images. From broken header, abrupt power loss while transferring image files, virus infection to ...
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