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
1
vote
1 answer

Can't create a strapi app with npx (issues with the sharp module then the sqlite3 module)

I am trying to create a strapi app using: npx create-strapi-app my_project --quickstart At the end of the installation I got this error: (node:23048) [DEP0148] DeprecationWarning: Use of deprecated folder mapping "./" in the "exports" field module…
ZABA
  • 107
  • 2
  • 9
1
vote
0 answers

Generate an image with "in-image-padding" for facebook og:image images

We are in the last steps to go productive with a Gatsby 2.32.13 (on Netlify) site: System: OS: macOS 11.5.1 CPU: (16) x64 Intel(R) Core(TM) i7-10700K CPU @ 3.80GHz Shell: 5.8 - /bin/zsh Binaries: Node: 14.16.1 -…
Stefan
  • 576
  • 7
  • 27
1
vote
1 answer

Sharp Image rotation during resizing

This image rotates during resizing even after adding .rotate() and .withMetadata() to sharp pipline.
Henock
  • 98
  • 11
1
vote
1 answer

nodejs Sharp resized images become 0 bytes

I'm using sharp within a nodejs app to resize images. Sometimes when people upload images, it will always successfully save the main image, but then the resized images are sometimes saved as 0 bytes. await temp.mv(path.resolve(folderName…
Shooting Stars
  • 755
  • 1
  • 9
  • 20
1
vote
1 answer

converting pdf to an image is not working with Nodejs sharp on windows

so I have a Nodejs application that was originally built on OSX(macbook). A part of the process is to create a thumbnail from the first page of a pdf file that user uploaded. Below is the code that is working fine on OSX. const…
Rasyue
  • 60
  • 1
  • 9
1
vote
1 answer

Issues with Sharp in Azure functions

Hi I have been trying to deploy my code for resizing image streams in azure function. It seems to be working perfectly fine in local, even deployment via VS code is successful. But when I try to trigger the function, I get below…
1
vote
2 answers

Error installing Sharp in docker container

When running an npm install locally everything is fine but as soon as I try it inside my docker container I get the following error: /api/node_modules/sharp/lib/constructor.js:1 Something went wrong installing the "sharp" module Error…
Jamie
  • 1,004
  • 1
  • 14
  • 32
1
vote
0 answers

Trim Image to Content Box Ignoring Text at Top/Bottom?

The Question Title May sound basic but for me it's not :D I want to crop out the image from the dashed line to the next black border at bottom from the image. Demo Image The Content Box (The Outer Box) is not at a fixed position. It varies in height…
Rurli
  • 11
  • 2
1
vote
1 answer

Processing large images with Sharp on Lambda@Edge

When using Sharp in a function deployed to Lambda@Edge I'm getting the following error: vips__write: write failed unix error: No space left on device Running on Lambda, this can be fixed using the VIPS_DISC_THRESHOLD env variable, but since env…
Juvaly
  • 252
  • 1
  • 17
1
vote
1 answer

Read images with node.js from URL

Please excuse my ignorance on node. I need to read an image through a url and resize it through sharp. Currently I have it like this to read local. For example. I want to read this image url=…
Fixeed
  • 11
  • 1
1
vote
3 answers

Migration aws-sdk-js v2 to v3. Error Sharp: Input file is missing

Works with aws-sdk-js v2: const Sharp = require('sharp'); const AWS = require('aws-sdk'); const S3 = new AWS.S3({ signatureVersion: 'v4' }); const originalPhoto = (await S3.getObject({ Bucket: "myBucket", Key: "myKey" }).promise()).Body; const…
alditis
  • 4,633
  • 3
  • 49
  • 76
1
vote
1 answer

multi pages tiff format node js

I have a file image.tiff with 3 pages. I want to save each page in separate file in fs. I tried to use a sharp library to extract each page and to save it. I got from metadate height, width, and number of pages, so I could calculate the position for…
1
vote
0 answers

Sharp is working but giving a warning message: jpegsave_buffer: no property named 'subsample_mode'

I'm running a node application. For Image processing I was using multer and sharp packages. Everything seems to be working fine. I get whatever result I want like saving the image in a file or just only getting the buffer including features like…
Sagor Mahtab
  • 147
  • 3
  • 11
1
vote
1 answer

Trouble with async/wait file saving and Sharp image processing in NodeJS

I'm trying to make a back end for a NodeJS photography website, but I've hit a snag with processing images with Sharp and then uploading them to AWS S3. NodeJS's asynchronous approach messes up the processing because it tries to upload the files as…
mgbasi
  • 11
  • 3
1
vote
0 answers

How to resize image and store different sizet with gridfs nodeJS?

i'm a beginner with mongoDB and gridfs. I have a code which save in the database an incoming image. But I'd like to resize the image before saving it. It tried to use sharp, but I don't really understand how it works. I tried the following code, but…
AMS
  • 11
  • 1