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

Resizing thin images with Jimp.AUTO as one of the size parameters #880

Closed
charleprr opened this issue Apr 28, 2020 · 2 comments
Closed

Resizing thin images with Jimp.AUTO as one of the size parameters #880

charleprr opened this issue Apr 28, 2020 · 2 comments
Labels
bug there is a bug in the way jimp behaves help wanted

Comments

@charleprr
Copy link
Contributor

Expected Behavior

I resize this image (70x3) with image.resize(1, Jimp.AUTO).
I expect the image to be resized to 1x1.

Current Behavior

I get this error: Invalid settings specified for the resizer.
The image is not resized.

Failure Information (for bugs)

Since the height parameter is Jimp.AUTO, it's computed based on the width with a value of 70. The big ratio difference makes the height get a value of 0 and thus, causes this Invalid settings specified for the resizer. error to be thrown.

This is where the height gets calculated : @jimp/plugin-resize/dist/index.js
This is where the error is thrown : @jimp/plugin-resize/dist/modules/resize.js

Steps to Reproduce

  1. Read a thin image (example: this image) with Jimp
  2. Call the resize method with the parameters 1 and Jimp.AUTO
  3. An error is thrown

Context

  • Jimp Version: 0.10.3
  • Operating System: Linux, Debian
  • Node version: v12.14.0

Failure Logs

4|emojicon | Error: Invalid settings specified for the resizer.
4|emojicon |     at Resize.initialize (/home/pi/projects/emojicon/node_modules/@jimp/plugin-resize/dist/modules/resize.js:84:11)
4|emojicon |     at new Resize (/home/pi/projects/emojicon/node_modules/@jimp/plugin-resize/dist/modules/resize.js:76:8)
4|emojicon |     at Jimp.resize (/home/pi/projects/emojicon/node_modules/@jimp/plugin-resize/dist/index.js:75:24)
4|emojicon |     at Jimp.<anonymous> (/home/pi/projects/emojicon/modules/Artwork.js:25:27)
4|emojicon |     at Timeout._onTimeout (/home/pi/projects/emojicon/node_modules/@jimp/core/dist/index.js:354:25)
4|emojicon |     at listOnTimeout (internal/timers.js:531:17)
4|emojicon |     at processTimers (internal/timers.js:475:7)
@AlexanderKozhevin
Copy link

Yeap, it crash my app, even try catch not helping 😬
not cool, not cool at all

@hipstersmoothie
Copy link
Collaborator

Wanna take a stab at a fix? I'll get it reviewed and merged asap

@hipstersmoothie hipstersmoothie added help wanted bug there is a bug in the way jimp behaves labels Feb 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug there is a bug in the way jimp behaves help wanted
Projects
None yet
Development

No branches or pull requests

3 participants