Can't rezie any pngs
See original GitHub issuepng’s dont resize. jpgs work just fine.
This bit of code sends the resized images to S3 for context
function writeObject(data, width, newFilePath, callback) {
return Sharp(data.Body)
.resize(width)
.toFormat('png')
.toBuffer()
.then(buffer => S3.putObject({
Body: buffer,
Bucket: BUCKET,
ContentType: 'image/png',
Key: newFilePath,
}).promise()
)
.then(() => callback(null, {
statusCode: '301',
headers: {'location': `${URL}/${newFilePath}`},
body: '',
})
)
}
The output is the original file in original size. I have tried 5 or 6 png files, both from google images and ones I made. I don’t think its a png file issue but I’m happy to link a test image here if needed. I’m also confused why its not throwing an error?
Issue Analytics
- State:
- Created 6 years ago
- Comments:5 (2 by maintainers)
Top Results From Across the Web
Cannot resize png image once placed in photoshop 2021
I can't resize images placed in a photoshop file. The transform/move tool won't let me drag the corners to resize images.
Read more >PNG not resizing automatically - WordPress.org
I have realised that the feature “Resize my original images” (at the bottom of the first tab) is not resizing PNG images for...
Read more >Resize PNG Online - Resizing.app
Resize PNG images in Windows 10 · Go to Paint and open your file from the drop-down menu. · Click the Resize tool...
Read more >PNG resize = large file sizes · Issue #1399 · lovell/sharp - GitHub
My PNG resizes are substantially larger via Sharp, compared to Intervention, which is using Imagemagick under the hood. I've tried all the PNG...
Read more >Can't resize image using CSS - Stack Overflow
If your image is smaller than the screen, it will use the image width. If it is bigger, it uses max-width. So assuming...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@lovell I have not, but I need to get this this soon, probably after the new year. Thanks for following up
@lovell sorry it took so longer to circle back to this, too many projects not enough time. I went and broke down the code into simple tests and uhm… it was working. Turns out the lambda method I wrote had a bug, not in the
writeObject
method, but in the wrapper method that recursively called it with various “approved” file extension types that it would restrict on and guess at while grabbing objects from S3. I was only passing thewidth
param the very first time, but not the recursive case and so JPEG was the first extension in my array, PNG was not… e.g. PNG never got thewidth
param… my fault. Long story short, this is not a bug, please close 😃