Closed clubside closed 3 weeks ago
Not providing a height was causing an error I didn't spot. If I force 256x256 using avatarSharp.resize(256, 256, { kernel: sharp.kernel.nearest })
everything works great. How do I set the options to proportional height while still passing the kernel option?
Sorry, I see in the docs I can set the height to null which solves everything. Sorry for the trouble and thanks again for a wonderful library!
Alternatively, perhaps move the width
into the options to make it less ambiguous:
- avatarSharp.resize(256, { kernel: sharp.kernel.nearest })
+ avatarSharp.resize({ width: 256, kernel: sharp.kernel.nearest })
Possible bug
Is this a possible bug in a feature of sharp, unrelated to installation?
npm install sharp
completes without error.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?
sharp
as reported bynpm view sharp dist-tags.latest
.What is the output of running
npx envinfo --binaries --system --npmPackages=sharp --npmGlobalPackages=sharp
?Does this problem relate to file caching?
The default behaviour of libvips is to cache input files, which can lead to
EBUSY
orEPERM
errors on Windows. Usesharp.cache(false)
to switch this feature off.sharp.cache(false)
does not fix this problem.Does this problem relate to images appearing to have been rotated by 90 degrees?
Images that contain EXIF Orientation metadata are not auto-oriented. By default, EXIF metadata is removed.
To auto-orient pixel values use the parameter-less
rotate()
operation.To retain EXIF Orientation use
keepExif()
.[x] Using
rotate()
orkeepExif()
does not fix this problem.What are the steps to reproduce?
What is the expected behaviour?
That each pixel is just scaled with no interpolation, especially in this case where 8x8 to 256x256 is proportional.
Please provide a minimal, standalone code sample, without other dependencies, that demonstrates this problem
The code is above.
Please provide sample image(s) that help explain this problem
Here is the source image:
Here is the sharp upscale with nearest neighbor:
Here is the Photoshop upscale with nearest neighbor:
![Sharp Upscale](https://swift.hulkercafe.com/head-photoshop.png)