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

VipsJpeg: Invalid SOS parameters for sequential JPEG #1578

Closed
asilvas opened this issue Feb 15, 2019 · 15 comments
Closed

VipsJpeg: Invalid SOS parameters for sequential JPEG #1578

asilvas opened this issue Feb 15, 2019 · 15 comments
Milestone

Comments

@asilvas
Copy link

asilvas commented Feb 15, 2019

Repro example: https://gist.github.com/asilvas/773b902b2d175d452c6472a4ed128762

This is an issue that recently came up that seems related to a recent change. At first I brushed it off as a corrupt image, but quite a few of these cases have come up since. Every other image editor I try the image in works fine. Presumably this is a Jpeg decoder bug, but wanted to post it here since it may require an update to sharp builds.

@asilvas
Copy link
Author

asilvas commented Feb 15, 2019

@lovell
Copy link
Owner

lovell commented Feb 16, 2019

There's a bug in Samsung firmware (this is from an S9) that prevents it producing valid JPEG files. The forthcoming v0.22.0 release of sharp will include a more recent version of libvips that can allow these.

@bjornbos
Copy link

For anyone struggling with this issue like we did, you can suppress this error by setting the failOnError option in the sharp constructor to false.

@sachinB94
Copy link

@lovell Hey, when can we expect v0.22.0 ?

@lovell
Copy link
Owner

lovell commented Mar 1, 2019

@sachinB94 Probably before Samsung, who make ~US$60bn/year in profit, fix their buggy firmware.

@lovell lovell added this to the v0.22.0 milestone Mar 10, 2019
@lovell
Copy link
Owner

lovell commented Mar 19, 2019

sharp v0.22.0 with libvips v8.7.4 now available.

You'll need to explicitly set failOnError: false to read these buggy Samsung images. You must use libvips v8.7.4+ to safely set this option.

@lovell lovell closed this as completed Mar 19, 2019
@axelpale
Copy link

Anyone looking for how to set failOnError: false (like I had to do), just give the options object as a second argument. The constructor docs are bit vague about how to give options when input is already given.

sharp(filepath, { failOnError: false })
    .rotate()
    .resize(...)
    etc

Had this error with HDR and panorama images produced with Samsung Galaxy A3. Normal images worked fine.

@ccorcos

This comment has been minimized.

@axelpale
Copy link

axelpale commented Apr 25, 2019

@ccorcos npm install sharp should do it for you, unless your system already has libvips (which may cause compability problems)

@timothyallan

This comment has been minimized.

@lovell
Copy link
Owner

lovell commented May 8, 2019

@timothyallan Please can you open a new issue with sample code and image that is failing.

@timothyallan
Copy link

timothyallan commented May 8, 2019

@lovell yep will do. Just trying to get a repo case going now. Seems to work if read directly from a file, but piping from a stream fails.

Edit: ping @lovell
#1691

@kennethmervin01
Copy link

failOnError: false })

How to set failOnError in stream?

@kennethmervin01
Copy link

const file = fs.createWriteStream(path);
const thumbnail = fs.createWriteStream(thumb);
const createThumbnail = sharp()
.rotate()
.resize(200, 200);
fields.myimage.pipe(file);
fields.myimage.pipe(createThumbnail).pipe(thumbnail);

@lovell
Copy link
Owner

lovell commented May 25, 2019

@kennethmervin01 Please see #1691

Repository owner locked and limited conversation to collaborators May 25, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

8 participants