question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Aliasing issue when resizing on 32-bit systems

See original GitHub issue

First, thanks for the awesome work you did with Sharp ! 👍

I have a question (I don’t think it is a bug) regarding the resize function. My code looks like this :

const outputImage = sharp(imagePath);
outputImage
        .resize(Number(width), Number(height))
        .max();

When I run it on my Windows machine, the resized image is perfectly fine, without aliasing.

When I run it on a Debian 8 machine, it generates the following image : Source image : test_source

Output with size 350x350 (the “bug” happens) : test_350x350

Output with size 351x351 (perfectly fine) : test_351x351

It seems to have this behaviour only with some “round” numbers and only on my Debian server, not on Windows.

Any help would be much appreciated. Thanks !

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:9 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
PierreM-Devcommented, May 18, 2017

Thanks a lot for these tips. You were almost right and pointed me in the right direction. I had to follow libvips docs to “build with the GCC auto-vectorizer and diagnostics (or just -O3)” (from here : https://github.com/jcupitt/libvips) :

$ FLAGS="-O2 -msse4.2 -ffast-math"
$ FLAGS="$FLAGS -ftree-vectorize -fdump-tree-vect-details"
$ CFLAGS="$FLAGS" CXXFLAGS="$FLAGS" \
	./configure --prefix=/home/john/vips 

It worked with these params. Maybe you could add this tip in Sharp docs if someone faces the same issue.

For information I tried enabling “simd” first but it didn’t work.

Again, thanks a lot for the time you give to the community, you are awesome and Sharp is amazing 😃

0reactions
lovellcommented, May 18, 2017

Enabling simd might help too as that will keep the floating-point reduction away from the x87 FPU.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Chapter 9. Known Issues - Nvidia
Although some systems will run perfectly fine when cache aliasing occurs, ... If the BIOS does place any NVIDIA PCI I/O regions above...
Read more >
376850 - Aliasing on Chrome icon - chromium - Monorail
Steps to reproduce the problem: 1. Open Chrome on Windows. 2. Look at the status bar (bottom right). What is the expected behavior?...
Read more >
Keeping Your Renders Clean - FXGuide
Some deal with color purity issues, some scaling and resizing issues, while others take a look at image degradation over multiple ...
Read more >
Issue 376850 in chromium: Aliasing on Chrome icon - Google Groups
Issue 376850 in chromium: Aliasing on Chrome icon ... Labels: Cr-UI Pri-2 Via-Wizard Type-Bug OS-Windows New issue 376850 by ... NET to resize...
Read more >
1.0.6: Aliasing when resizing - Pixelmator Community
This seems to be a new issue with 1.0.6. In the original Pixelmator, in Photoshop, and in previous versions of Pixelmator Pro, it...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found