Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expose underlying error message when attempting to read metadata from "corrupt" file #1505

Closed
HRK44 opened this issue Dec 12, 2018 · 9 comments

Comments

@HRK44
Copy link

HRK44 commented Dec 12, 2018

Is it possible to get a JPG image's process ? (SOF type etc...)

@lovell
Copy link
Owner

lovell commented Dec 12, 2018

Hello, not sure I quite understand this question but did you see metadata? This includes an isProgressive flag, which is perhaps what you meant.

@lovell lovell closed this as completed Dec 12, 2018
@lovell lovell reopened this Dec 12, 2018
@HRK44
Copy link
Author

HRK44 commented Dec 12, 2018

@lovell On site like get-metadata dot com, I can have a field called Encoding Process which on my JPEG images is Encoding Process: Lossless, Huffman coding or in some others ones Encoding Process: Baseline DCT, Huffman coding. So my question is can I get this kind of data using sharp?

I tried to use the metadata but it can retrieve only the width/height, I don't see other information in it.

@lovell
Copy link
Owner

lovell commented Dec 13, 2018

Thanks for clarifying. Lossless JPEG images are unlikely to work as the underlying libjpeg(-turbo) does not support them. Beyond that, I think the only two "encoding processes" are "baseline" (where isProgressive is false) or "progressive" (where isProgressive is true).

@HRK44
Copy link
Author

HRK44 commented Dec 13, 2018

@lovell I understand that it cannot decode JPEG Lossless, but I thought it could at least read the metadata since it's still official JPEG format. Even when I use identify command in Linux, the error message is identify-im6.q16: Unsupported JPEG process: SOF type 0xc3 `0' @ error/jpeg.c/JPEGErrorHandler/322. which explicitly says that the file is a SOF3 (0xc3), which is the kind of data I need lol

@lovell
Copy link
Owner

lovell commented Dec 28, 2018

Are you able to provide a sample lossless JPEG file? If so, I might be able to take a closer look at how libvips could be updated to expose this.

@HRK44
Copy link
Author

HRK44 commented Dec 28, 2018

@lovell I'll try to provide one ASAP, thanks for looking into this

@HRK44
Copy link
Author

HRK44 commented Jan 7, 2019

@lovell How can I contact you and send you privately one image?

@lovell
Copy link
Owner

lovell commented Jan 8, 2019

I found a public testimgl.jpg example in ftp://ftp.fu-berlin.de/unix/X11/graphics/ImageMagick/delegates/ljpeg-6b.tar.gz

I can see the "Unsupported JPEG process: SOF type 0xc3" error message is being passed back from libvips but is swallowed by sharp.

@lovell lovell changed the title Question: Can we get image (jpg) process using sharp? Expose underlying error message when attempting to read metadata from "corrupt" file Jan 8, 2019
@lovell lovell added this to the v0.21.2 milestone Jan 12, 2019
@lovell
Copy link
Owner

lovell commented Jan 13, 2019

v0.21.2 now available that exposes the underlying error message, if any.

@lovell lovell closed this as completed Jan 13, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants