You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi, thanks for reporting, this looks like the problem that libvips/libvips#3293 is trying to solve where the failOn setting is ignored for some truncated JPEG images.
lovell
changed the title
VipsJpeg: Corrupt JPEG data: premature end of data segment
Corrupt JPEG data: premature end of data segment, even with failOn set to 'none'
Oct 14, 2023
I have a issue resizing jpg image, it is a corrupted file but I need to process it too, could you please help me, thanks
the code
const readStreamObject = await s3Client.send(new GetObjectCommand({ Bucket: bucket, Key: key }));
const objectBuffer = await new Promise((resolve, reject) => {
const chunks = [];
readStreamObject.Body.on('data', (chunk) => {
chunks.push(chunk);
});
readStreamObject.Body.on('error', (err) => {
reject(err);
});
readStreamObject.Body.on('end', () => {
resolve(Buffer.concat(chunks));
});
}
);
fixedImageBuffer = await sharp(objectBuffer, { failOn: 'none' })
.resize({ width: 900, height: 675 })
.withMetadata()
.toBuffer();
The text was updated successfully, but these errors were encountered: