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
3
votes
4 answers

Something went wrong installing the "sharp" module

I already do what the error said. I removed the sharp then npm install --ignore-scripts=false --verbose but it still doesn't work. I also tried the: rimraf node_modules rimraf yarn.lock yarn What might the problem here? npm: 6.13.4 node:…
Ayaka
  • 197
  • 1
  • 13
3
votes
1 answer

How to implement plugin stealth in Puppeteer Sharp?

I would like to know how and if it is possible to use puppeteer-extra-plugin-stealth inside of visual studio project. As far as I read there is a project called: puppeteer sharp but they didn't showed how to use the plugin stealth, as this is best…
Tran
  • 159
  • 1
  • 4
  • 8
3
votes
1 answer

Error when using the Nodejs Sharp module. Module parse failed: Unexpected character '' (1: 0)

When running webpack I have received this error "WARNING in ./node_modules/sharp/build/Release/sharp.node 1: 0 Module parse failed: Unexpected character '' (1: 0) You may need an appropriate loader to handle this file type, currently no loaders are…
3
votes
1 answer

How to resize Image on upload using `Multer and Sharp` on Node and Express

I tried to resize my image when it's being uploaded, but I am not succeeding. I am using Node, Expressjs, Mongoose, Multer and Sharp. How do I resize it on upload with Sharp. Here is my create routes router.post('/create', upload.single('cover'),…
3
votes
4 answers

How can I deploy a Serverless Framework application the macOS that uses the sharp library to AWS?

I'm developing a Serverless Framework application that is using the Node runtime and is deployed to AWS. One of my AWS Lambda functions uses the sharp library. When I run the AWS Lambda function, the following error occurs: 'darwin-x64' binaries…
3
votes
0 answers

NodeJS Sharp Provides Incorrect Quality For JPEG Images

I am working with sharp node package to calculate the quality of an image. I couldn't find any API in the package which would calculate the quality. So I came up with an implementation that follows following steps - Accept incoming image buffer &…
planet_hunter
  • 3,866
  • 1
  • 26
  • 39
3
votes
1 answer

NodeJS and Sharp, BMP to PNG Error: Input file contains unsupported image format

I am using sharp server-side to prepare pictures to be served in a webapp. The current objective is to load a picture (BMP format), to load it in nodejs with sharp, to convert it in PNG, to resize it (scale down) and save it back to disk. The code…
ZettaCircl
  • 835
  • 10
  • 15
3
votes
1 answer

Absolute Image Paths in Gatsby JSON

I am using gatsby-transformer-json to query JSON files in Gatsby. There are image URLs within the JSON file, however they are absolute file paths and Gatsby only transforms relative paths into image nodes. My JSON: { "defaultImage":…
Undistraction
  • 42,754
  • 56
  • 195
  • 331
3
votes
4 answers

Problem running AWS Lambda function with Sharp library

I created a lambda function through the aws-amplify CLI by following an AWS workshop (https://amplify-workshop.go-aws.com/70_generating_thumbnails/10_creating_a_photo_processor_lambda.html). Seems that there is a problem with conflicting versions…
ElektrikSpark
  • 613
  • 1
  • 8
  • 21
3
votes
1 answer

Thumbnail generated from first image is duplicated for others on Firebase storage

After I upload an image. Cloud function generate its thumbnails as specified in the concerned firebase function using sharp on typescript. But for the second image and so on, thumbnails are generated and named correctly as expected but it contains…
3
votes
1 answer

Can I use sharp with multer to resize an image and save to disk in a single operation?

I'm having some trouble understanding the relationship between sharp and multer. Currently I'm using multer to extract the image from the req and save it to disk. Works great: const upload = Multer({ dest: './companyImages', fileFilter, …
David R.
  • 233
  • 3
  • 12
3
votes
0 answers

Using Sharp & Express causes exception : "Input buffer contains unsupported image format"

I'm using Node & Express & Sharp to: Download an image as stream -> convert to webp -> response the user with the converted image This code does the job : import express from 'express'; import * as url from 'url'; const sharp =…
Royi Namir
  • 144,742
  • 138
  • 468
  • 792
3
votes
2 answers

how to store image from buffer to file system in node.js using sharp.js

i am using sharp.js for image manipulation in node.js my code sharp(path) .toFormat('jpeg') .toBuffer((err, data, info) => { fs.writeFile(temp, buffer, { flag: 'w' }, function() { …
User_3535
  • 826
  • 1
  • 13
  • 30
3
votes
2 answers

How to compress PNG file using sharp package?

I am trying to compress PNG files (above 1MB) using node.js sharp package. var sharp = require('/usr/local/lib/node_modules/sharp'); sharp('IMG1.png') .png({ compressionLevel: 9, adaptiveFiltering: true, force: true…
napster
  • 349
  • 1
  • 4
  • 16
3
votes
1 answer

Nodejs Sharp Image Resize and Upload to S3 gives timeout

Below code is not working for me, it's giving timeout issue with while uploading the images to Amazon S3. function resizeAndUploadToS3( imageData, imageHeader, bucket, key ) { return new Promise( ( resolve, reject ) => { sharp( imageData.data…
Mohd Shahid
  • 1,538
  • 2
  • 33
  • 66