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

Incorrect resize result for an image #194

Open
dmitriy-nz opened this issue Nov 28, 2023 · 1 comment
Open

Incorrect resize result for an image #194

dmitriy-nz opened this issue Nov 28, 2023 · 1 comment

Comments

@dmitriy-nz
Copy link

Environment

ipx - 2.0.2
nodejs - v18.16.1

Reproduction

Clone repo: https://github.com/dmitriy-nz/ipx-test
Install deps
Run npx ipx serve --dir ./imgs
Open url: http://localhost:3000/s_200x200,fit_inside/test.jpg - Already at this step you will get an image with an incorrect size

On the native sharp everything works as expected with the same set of parameters
Run node index.js for get the expected result via a native sharp
Check output.jpg

Describe the bug

When I try to resize a "skinny" image I get the wrong result.

Original image (30x600):
test

Call resize via ipx with parameters s_200x200,fit_inside and get wrong result (1x30):
test

I ran the resize with the same parameters through native sharp and everything works as expected (10x200):
output

Additional context

No response

Logs

No response

@jameswragg
Copy link
Contributor

Tracked the issue to this clampDimensionsPreservingAspectRatio fn call. Sharp seems to handle this correctly now, as works as expected when those lines are commented out. I'd question wether this manual patching still needed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants