Questions tagged [gm]

Use this tag for questions regarding usages of the gm library for node.js

gm, and for node.js, is a node.js library that can execute native commands for image processing.

119 questions
0
votes
0 answers

How to wait for a file to be created before trying to read it in node.js?

I am creating an image with GraphicsMagick and then I would like to wait for it to be created before reading it, this is what I have tried: const fs = require('fs'); const { v5: uuidv5 } = require('uuid'); const readImage = async path => { let…
Nik
  • 23
  • 1
  • 6
0
votes
0 answers

Error: Command failed: Invalid Parameter - -resize

const express = require('express'); const multer = require('multer'); var fs = require('fs') , gm = require('gm').subClass({imageMagick: true}); const router = express.Router(); const storage = multer.diskStorage({ destination: (req,…
0
votes
0 answers

Can i get buffer or stream when upload file for gm?

I want make thumbnail of pdffile when upload the file. But, I don't wanna get stream from url after upload to storage(s3). I wanna a get stream or buffer from request. const upload = multer({ storage: multerS3({ s3: s3, bucket:…
곽대용
  • 399
  • 2
  • 3
  • 15
0
votes
1 answer

GraphicsMagick (GM) resize into square without changing ratio and add background

I'm trying to get GraphicsMagick to resize my various images into a standard square. The input is always variable - vertical, horizontal images, different sizes etc. I want to basically have: - A white background canvas @ 600px x 600px - The image…
Jonathan Bird
  • 313
  • 5
  • 19
0
votes
0 answers

Thumbnail for pdf in aws lambda using node js

I am using this node js script as an aws lambda script to create thumbnail of a pdf file as soon as pdf is uploaded to s3 bucket. var async = require('async'); var s3 = new AWS.S3(); var ffmpeg = require('fluent-ffmpeg'); var fs = require('fs'); var…
Tarun Goel
  • 11
  • 4
0
votes
2 answers

Convert tiff to jpeg in node.js and GraphicsMagick

How could I convert a tiff to jpg in node.js and GraphicsMagick gm (https://aheckmann.github.io/gm/)? I want to do this on AWS lambda, so cant write() out to disk as such.
fpghost
  • 2,834
  • 4
  • 32
  • 61
0
votes
1 answer

How to remove alpha channel of an image using gm?

I'm looking for functionality similar to 'convert -alpha off ' command of imagemagick, how to achieve the same using gm node module? I couldn't figure out using their documentation.
Yogeesh Hegde
  • 31
  • 1
  • 3
0
votes
1 answer

node.js: gm throws spawn E2BIG error when passed too much data

The following code throws an error: const COUNT = 2528; // 2527 works, 2528 errors const gm = require('gm').subClass({ imageMagick: true }); const brokenData = []; for (let i = 0; i < COUNT; i++) { brokenData.push([ Math.random() * 500,…
callumacrae
  • 8,185
  • 8
  • 32
  • 49
0
votes
1 answer

How do I convert jpg image to tiff with 300DPI and reduce noise to 100% in Image magic?

I have been working on an image from last 25 days with zero output. So I came here in search of an answer. I have a jpg image of 7MB. I upload it in Photoshop and changed the width to 96 Inch, Resolution for 300 pixels/inch, checked resample option…
0
votes
1 answer

Change color of an image using gm

I have a png image and I want to change the color of that image using the GraphicsMagick node module. Does GraphicsMagick provide the functionality to change the color of an image?. Is there any other library through which I can change the color of…
Vikas
  • 1
  • 1
0
votes
0 answers

Multiple Fonts in writeText() function in 'gm' (graphicsMagick + ImageMagick)?

I am trying to write on image with multiple language. I am using npm package 'gm' . gm(inputFilePath) .font(fontFilePath) // .ttf format .writeText(x,y,TextToBeWritten) .write(outputFile , callBackFunction()) Here I want to write in Multiple…
drexdelta
  • 87
  • 3
  • 9
0
votes
1 answer

watermark in image using nodejs

I have added watermark on image using node_module 'gm', i had make font color grey but i found an bug in that if image content grey color so my watermark merged with image so i can't read the watermark text, that's why i want to create an overlay…
Mohammad Zeeshan
  • 825
  • 1
  • 9
  • 20
0
votes
1 answer

NodeJS gm hanging when importing images

I have the following script to import raw images from an api: let importImages = function (meal,accessToken) { let imagesData = meal.afbeeldingenInfo; let mealFolder = 'client/import/meal-'+meal.maaltijdId; ensureExists(mealFolder, 0o755,…
xfscrypt
  • 16
  • 5
  • 28
  • 59
0
votes
0 answers

GraphicsMagick node write not working as expected

I am trying to resize an image and write back to file system using gm node. However when I try to write resized image it gives following error: Error: Command failed: gm convert: Option '-size' requires an argument or argument is malformed. at…
Umer Hayat
  • 1,993
  • 5
  • 31
  • 58
0
votes
0 answers

Problems forming Imagemagick commands using nodejs gm module

I am trying to run an imageMagick command on AWS Lambda and using the gm module. I keep getting an error no decode delegate for this image format `' @ error/constitute.c/ReadImage/544. I believe this error indicates that my syntax isn't correct for…
Ecropolis
  • 2,005
  • 2
  • 22
  • 27