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

455 questions
4
votes
2 answers

Packages compiling native code (npm install) using AWS Lambda

I need to use the sharp package to resize images in a Lambda function, but it builds the native code when doing an “npm install” in my Windows machine, which definitely won’t work in Amazon Linux server where Lambda is hosted. What’s the recommended…
Emi
  • 4,597
  • 2
  • 31
  • 34
4
votes
4 answers

Building a node module for aws lambda

I'm trying to use the Sharp library in AWS Lambda but it requires the module be compiled for the lambda environment. The instructions say to create an ec2 instance and compile it on there - but I noticed that there are a few tools to help with that…
MonkeyBonkey
  • 46,433
  • 78
  • 254
  • 460
3
votes
3 answers

Sharp on AWS Amplify Backend Lambda Causing Build to Fail

I am pretty new to aws amplify and have an amplify app that has a backend lambda function which uses sharp as a dependency. When I push to git to trigger a deploy, my build is failing I think due to vips/vips8 a sharp dependency not being…
Turner
  • 33
  • 4
3
votes
1 answer

Sharp JS Dependency breaks Express Server on Elastic Beanstalk

I feel like this is useless as my conundrum has been discussed in several different threads, but nothing has worked. I have an ExpressJS/node server deployed to AWS Elastic Beanstalk. When I first tried to deploy several weeks ago, I couldn't get it…
3
votes
0 answers

Error: Something went wrong installing the "sharp" module

I'm getting this error when I try to run gatsby develop, so far I've tried: npm install --ignore-scripts=false --verbose sharp npm install --platform=win32 --arch=x64 sharp npm clean cache --force gatsby clean deleting node_modules,…
ivanatias
  • 3,105
  • 2
  • 14
  • 25
3
votes
1 answer

Shifting SVG by fixed number of pixels

The SVG example currently visually looks perfect except I want to achieve the same result without padding. The padding's purpose is to force the red/blue lines 40px to the right to make space for the axis whilst also stopping it from overflowing on…
Prism
  • 31
  • 2
3
votes
1 answer

Something went wrong installing the "sharp" module (AWS Lambda)

I have Vue.js app pushed on a staging website. When I run the app using my local backend, everything works fine. I'm able to use the sharp module to crop images, they get saved to an AWS S3 bucket and display correctly. However, once I try to deploy…
3
votes
2 answers

Can I use Sharp image processing library in React js?

I tried to use Sharp image processing in my create react app. But it sends an error This is my code: import sharp from 'sharp'; const buffer = await sharp(req.file.buffer) .resize({ width: 250, height: 250 }) .extend({ …
Rupam
  • 75
  • 1
  • 9
3
votes
0 answers

Sharp Image Metadata Extraction Error - Input file contains unsupported image format

I am seeing the following error when trying to extract an image's metadata information with the Sharp module: "Input file contains unsupported image format". This is only happening for certain signed image urls, particularly ones that contain xmp…
3
votes
2 answers

Cannot install sharp with Docker on M1 Mac

Installing sharp on M1 Mac with yarn install is OK, but with Docker results in the following error: error /usr/src/app/node_modules/sharp: Command failed. Exit code: 1 Command: (node install/libvips && node install/dll-copy && prebuild-install) ||…
Matt
  • 51
  • 1
  • 7
3
votes
3 answers

Resizing images with sharp before uploading to google cloud storage

I tried to resize or compress an image before uploading to the google cloud storage. The upload works fine but the resizing does not seem to work. Here is my code: const uploadImage = async (file) => new Promise((resolve, reject) => { let {…
foka135
  • 167
  • 2
  • 13
3
votes
1 answer

File is missing when trying to resize in Sharp in AWS Lambda function

I am sincerely puzzled by this. I am simply trying to invoke a Lambda function from within a Node JS application and perform image resizing on it. The invocation succeeds and the function is called (I can pass parameters to it and see them…
3
votes
1 answer

GitLab Docker build locked on sharp download (timeout)

During Docker build in Gitlab job pipeline the process is freezed on sharp@0.28.3 install /app/node_modules/sharp (node install/libvips && node install/dll-copy && prebuild-install) || (node install/can-compile && node-gyp rebuild && node…
Pid
  • 31
  • 2
3
votes
1 answer

NodeJs sharp Image library - Resize using Stream Api throws error 'stream.push() after EOF'

It's bit strange to me the way stream is behaving sometime. Simple task at work is to pull a image from S3 and transform it using sharp library; finally upload resized image back to S3. I can see resized image in S3 but code fails with error. Here…
Adeel Ahmad
  • 185
  • 1
  • 17
3
votes
1 answer

Debugging memory leak in express application

I have a memory leak in my express application. The RSS memory starts at around 80Mb and grows slowly over time to reach around 2-3Gb over a couple of days. I have tried using the --inspect flag to start the process and debug in chrome inspector but…