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
2
votes
0 answers

npm error while deploying on aws Elastic Beanstalk from github with CodePipeline

I'm trying to deploy a node.js web app on Elastic Beanstalk but I'm getting the following error on logs npm ERR! command failed npm ERR! command sh -c (node install/libvips && node install/dll-copy && prebuild-install) || (node install/can-compile…
2
votes
0 answers

I always get a problem if the image is already created

This project changes the image sizes this project is using a library called sharp, but at first, if the image is created for the first time, it does not cause problems, but it always shows me that problem if it was already created. In…
2
votes
0 answers

using multiple fonts in sharpjs

I'm using sharp.js to add text on a png image. I need to have 3 fonts be rendered on the image in different places however, only one font is being properly rendered and the other 2 are repeated. I have the fonts in ttf files. Here's an image of the…
stuckoverflow
  • 625
  • 2
  • 7
  • 23
2
votes
0 answers

How can I do Image Upscaling (increase resolution) with Sharp?

I have a digital image for which I want to increase its resolution using Sharp. For now all I have is let image = sharp("image_path").resize({width:1200, height:1200}); However, this seems to only increase the size but not the quality. How can I…
2
votes
2 answers

Overlay with opacity setting using Sharp

I'd like to take one image and composite it on top of another image. This works well for that purpose: overlayImg = await Sharp(sourceImage.Body) .composite([{ input: './lambdas/processNewImage/logos/white.png', …
lowcrawler
  • 6,777
  • 9
  • 37
  • 79
2
votes
1 answer

Gridsome build with docker failed on sharp

I have Gridsome application/website that I would like to create Docker image for CI/CD however when try to build docker image I am facing error with sharp library that is one of dependencies of Gridsome: my package.json is…
bensiu
  • 24,660
  • 56
  • 77
  • 117
2
votes
0 answers

Resizing Images already on Google Storage locally through SHARPJS, and keeping/updating the downloadUrl

There was similar questions/answers but not recently and none with the exact requirements. I have many pictures for a dating app on Firebase Storage, uploaded from the users, with a downloadUrl saved on Firestore. Just noticed it is saved as very…
2
votes
0 answers

How do I use sharp image with Strapi 4 and Gatsby 4

I'm want to use images from my Strapi V4 local backend to my Gatsby 4 using sharp image processing. I was able to with Strapi 3 + Gatsby 3, but have recently upgraded to Strapi 4 and Gatsby 4 to avoid future deprecation. This is my…
TriThomas
  • 383
  • 2
  • 16
2
votes
1 answer

how to fix "invalid instruction" error when running node.js in Docker, with sharp.js lib

When running node.js in Docker, with sharp.js lib I am getting "invalid instruction" error and it exits with code 1. This is likely related to "libvips" used by sharp.js, that requires C compiler. I tried using various base Docker images, and so far…
dragansr
  • 417
  • 6
  • 8
2
votes
3 answers

Can't npm install on Apple Silicon M1

I'm trying to run a recently cloned Gatsby project on an M1 Mac and it's failing. Getting the following error: npm ERR! ERR! sharp Prebuilt libvips 8.10.5 binaries are not yet available for darwin-arm64v8 I've tried brew install vips, followed by…
Glaser
  • 21
  • 1
  • 1
  • 2
2
votes
0 answers

Sharp.js returns incorrect dimensions

Sharp.js returns incorrect dimensions (low resolution) for some images when processing multiple images simultaneously. All images are having high resolution. Here is the code. Can somebody help what am I missing? let data = await…
Mary
  • 33
  • 7
2
votes
1 answer

Using Sharp to turn svg to png corrupts text in node.js

I am using sharp to convert an svg file into png format to upload to a slack workspace. I found the same issue here const options = { d3Module: d3, selector: '#chart', container: '
' } …
pythonNovice
  • 1,130
  • 1
  • 14
  • 36
2
votes
1 answer

SVG Multiline Text Wrapping With Sharp

I have to use sharp.js to produce PNG out of SVG that contains dynamic text. My question is, how to wrap long text in SVG elements and generate a PNG with sharp? Also if it is too long in height and width it should end up with 3 dots (...). I tried…
Crite
  • 43
  • 7
2
votes
2 answers

How to use Node Sharp package

I am actually trying to resize image using sharp package. For Reference: https://www.npmjs.com/package/sharp I am getting image data from frontend (which is in react) to Backend (Which is in node) as below imageData { name: 'xyz.JPEG', …
Sai sri
  • 515
  • 12
  • 25
2
votes
1 answer

Sharp nodejs, axios input receiving undefined

Hey guys so basically I'm making an http request using axios to get an image as an "arraybuffer". After I receive the image I'm passing it to sharp but getting this error. TypeError [ERR_INVALID_ARG_TYPE]: The first argument must be of type string…
The Coder
  • 293
  • 2
  • 15