-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Closed
Labels
Description
When I try to resize and convert a png to jpg sharp outputs a corrupted image.
Input:
$ pngcheck test.png
OK: test.png (1280x877, 32-bit RGB+alpha, non-interlaced, 78.5%).
$ file test.png
test.png: PNG image data, 1280 x 877, 8-bit/color RGBA, non-interlaced
convert-resize.js
var sharp = require('sharp');
var width = 1000;
var height = 1000;
var quality = 75;
var format = 'jpeg';
var newImage = sharp('./test.png')
.resize(width, height)
.max()
.withoutEnlargement()
.quality(quality)
.toFormat(format)
.toFile('./test.jpg');Output:
$ file test.jpg
test.jpg: JPEG image data, JFIF standard 1.01, aspect ratio, density 1x1, segment length 16, baseline, precision 8, 1000x685, frames 3
This seems to happen every time a png gets converted to jpg and resized to a smaller size.
vipsthumbnail test.png -o tn_%s.jpg --size 1000 produces correct output.
I used sharp 0.11.0 and vips 7.40.6 on Debian 8.1.
Reactions are currently unavailable

