Skip to content

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

Closed
@charleprr

Description

@charleprr

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)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugthere is a bug in the way jimp behaveshelp wanted

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions