Questions tagged [sharp]

Questions about sharp, a Node.js image processing library to resize, crop and optimize JPEG, PNG, WebP and TIFF images.

The typical use case for this high speed module is to convert large images in common formats to smaller, web-friendly JPEG, PNG and WebP images of varying dimensions.

Resizing an image is typically 4x-5x faster than using the quickest [tag:imagemagick and settings.

Colour spaces, embedded ICC profiles and alpha transparency channels are all handled correctly. Lanczos resampling ensures quality is not sacrificed for speed.

As well as image resizing, operations such as rotation, extraction, compositing and gamma correction are available.

Most 64-bit OS X, Windows and Linux (glibc) systems running Node versions 4, 6, 8 and 9 do not require any additional install or runtime dependencies.

Download Sharp

276 questions
22
votes
5 answers

Sharp image library rotates image when resizing?

When using the sharp image resize library https://github.com/lovell/sharp for node.js, the image is being rotated. I have no code thats says .rotate(), so why is it being rotated and how can I stop it from rotating? I'm using the…
JK.
  • 20,010
  • 29
  • 124
  • 204
13
votes
6 answers

How to fix Something went wrong installing the "sharp" module and Cannot find module '../build/Release/sharp.node' in expo

I tried to install expo after I executed the command exp start but I got: Something went wrong installing the "sharp" module Cannot find module '../build/Release/sharp.node'. How can I fix this problem?
zaki tutu
  • 225
  • 1
  • 4
  • 9
13
votes
2 answers

How do I convert a base64 string formatted image to the datatype sharp image downsizer expects?

I'm trying to downsample an image in node. I have that image stored as a base64 encoded string (ie: "data:image/png;base64,iVBOR" etc.). I'm using Sharp npm package. The documentation appears to delineate that sharp can take either the filepath…
12
votes
2 answers

(node.js module) sharp image processor keeps source file open, unable to unlink original after resize

I'm using sharp to resize an uploaded image in a Node.js / Express application written in Typescript. After successful resizing, I'd like to delete the original file. For png and gif input images, the operation terminates successfully, I have the…
András Szepesházi
  • 5,774
  • 3
  • 37
  • 55
11
votes
2 answers

Installing Sharp /usr/include/vips/vips8:35:25: fatal error: glib-object.h

I am trying to install sharp on Ubuntu 16.04 LTS. I originally did not have vips, so I installed sudo apt-get install libvips-dev That fixed the first error, but now I get another error that I am stuck on: In file included from…
Rachel
  • 111
  • 1
  • 4
10
votes
1 answer

Compress image using sharp in node.js

I want to resize and compress images using sharp in node.js In sharp for jpeg there is separate compression and for webp there is separate and for png there is separate. WEBP sharp('a.jpg') .resize(1000) .webp({quality: 80}) JPEG sharp('_4_.jpg') …
Haseeb Ahmad
  • 5,262
  • 8
  • 37
  • 99
7
votes
1 answer

Cordova-res not installing in ionic cordova

I am not able to install package Cordova-res in ionic 5.4.4v and getting the error below **Z:\my program V2\ionicTest\testProj>npm i -g cordova-res** C:\Users\USER\AppData\Roaming\npm\cordova-res ->…
Pritish kumar
  • 504
  • 5
  • 13
7
votes
0 answers

Issue With NodeJS Memory Consumption Statistics - Huge RSS & External Memory Usage

While working on performance testing for a Node Project, I came across some memory reports which are a bit confusing to interpret in terms of performance and memory leaks. Background So I generated the reports using process.memoryUsage() API that…
planet_hunter
  • 3,425
  • 1
  • 19
  • 32
7
votes
2 answers

Sharp package Heroku deployment issue

I'm deploying my NodeJs app to Heroku. No issues running the app with nodemon locally. However when I'm trying to push to Heroku Master, seems like "sharp" package is causing an issue: remote: -----> Installing dependencies remote: …
user1872384
  • 6,298
  • 9
  • 49
  • 87
7
votes
8 answers

Can't install Sharp

When running sudo npm i sharp --save I get the following errors: > sharp@0.21.3 install /home/server/node_modules/sharp > (node install/libvips && node install/dll-copy && prebuild-install) || (node-gyp rebuild && node install/dll-copy) info sharp…
Florian Ludewig
  • 1,255
  • 6
  • 28
  • 90
7
votes
3 answers

nodejs Sharp: transparent into white

I am using Nodejs Sharp to transcode/resize png images into jpg. Is there way to replace transparent with white (or other light color) rather than black? I found solution for an older library but Sharp seems to be fastest and greatest. .background…
Serge
  • 2,794
  • 2
  • 11
  • 27
6
votes
2 answers

Install sharp without GitHub fetch for Nextjs: Error: Cannot find module 'sharp'

I'm trying to use Next.js on my corporate system, but whenever I run "npm run build", the build fails with the message: Error: Cannot find module 'sharp' I tried installing sharp but I get this error: info sharp Downloading…
Abhijeet Singh
  • 493
  • 5
  • 18
6
votes
3 answers

Error running Sharp inside AWS Lambda function: darwin-x64' binaries cannot be used on the 'linux-x64' platform

When attempting to run sharp inside an AWS Lambda function, I keep getting the following error: darwin-x64' binaries cannot be used on the 'linux-x64' platform. Please remove the 'node_modules/sharp/vendor' directory and run 'npm install' I…
Keith Harris
  • 752
  • 1
  • 9
  • 21
6
votes
4 answers

Gatsby new fails to install the sharp package and breaks

I can't initiate a gatsby starter project. The new command process breaks down during initialization, and results in an error and non-compilable project. Here's the command: > gatsby new gatsby-test The follwing process starts, failing when during…
aviya.developer
  • 2,855
  • 8
  • 33
5
votes
2 answers

How to use images from sharp module in React and Webpack project

Here is a codesandbox I would like the image in it to be processed by the sharp module. I want it to do this because I want this module to web optimize all the images in my React project, and to convert them to webm. Here's the same codesandbox…
Sam
  • 277
  • 1
  • 27
  • 91
1
2 3
18 19