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

Image is black and white after resize #3894

Closed
3 tasks done
CodeCork opened this issue Dec 12, 2023 · 4 comments
Closed
3 tasks done

Image is black and white after resize #3894

CodeCork opened this issue Dec 12, 2023 · 4 comments

Comments

@CodeCork
Copy link

CodeCork commented Dec 12, 2023

Possible bug

After resizing, image is turning to black and white. Tested on several kernels and only 'nearest' works properly.

Is this a possible bug in a feature of sharp, unrelated to installation?

  • Running npm install sharp completes without error.
  • Running node -e "require('sharp')" completes without error.

If you cannot confirm both of these, please open an installation issue instead.

Are you using the latest version of sharp?

  • I am using the latest version of sharp as reported by npm view sharp dist-tags.latest.

If you cannot confirm this, please upgrade to the latest version and try again before opening an issue.

If you are using another package which depends on a version of sharp that is not the latest, please open an issue against that package instead.

What is the output of running npx envinfo --binaries --system --npmPackages=sharp --npmGlobalPackages=sharp?

System:
OS: Linux 5.15 Ubuntu 22.04.3 LTS 22.04.3 LTS (Jammy Jellyfish)
CPU: (8) x64 Intel(R) Xeon(R) CPU L5520 @ 2.27GHz
Memory: 13.30 GB / 15.59 GB
Container: Yes
Shell: 5.1.16 - /bin/bash
Binaries:
Node: 16.20.2 - ~/.nvm/versions/node/v16.20.2/bin/node
Yarn: 1.22.21 - ~/.nvm/versions/node/v16.20.2/bin/yarn
npm: 8.19.4 - ~/.nvm/versions/node/v16.20.2/bin/npm
npmPackages:
sharp: ^0.33.0 => 0.33.0

What are the steps to reproduce?

Resizing jpg image

What is the expected behaviour?

Resized image with colours

Please provide a minimal, standalone code sample, without other dependencies, that demonstrates this problem

const image = sharp(filename)
image.clone().rotate().resize({width: 48}).withMetadata().toFile(target + name + 'x48.webp')

Please provide sample image(s) that help explain this problem

@lovell
Copy link
Owner

lovell commented Dec 12, 2023

This is probably the same as #3893 - please can you provide the output of running the following command:

cat /proc/cpuinfo | grep -m1 flags

@CodeCork
Copy link
Author

Here are the flags:

flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush acpi mmx fxsr sse sse2 syscall nx rdtscp lm constant_tsc rep_good nopl cpuid tsc_known_freq pni ssse3 cx16 sse4_1 sse4_2 popcnt hypervisor lahf_lm cpuid_fault pti ssbd ibrs ibpb stibp flush_l1d

@lovell
Copy link
Owner

lovell commented Dec 12, 2023

Thanks, it looks like Highway's runtime dispatch is falling back to SSE2 intrinsics on this older (2009?) CPU and you've run into libvips/libvips#3763 too. Let's track this at #3893, which also includes possible workarounds.

@lovell lovell closed this as not planned Won't fix, can't repro, duplicate, stale Dec 12, 2023
@lovell lovell removed the triage label Dec 12, 2023
@CodeCork
Copy link
Author

Thanks, I will check possible workarounds to this issue. You are right, the used CPU is quite old

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