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
2
votes
1 answer

GraphicsMagick: toBuffer() Stream yields empty buffer (Lambda)

I am trying to create a thumb from a pdf file in a lambda, but when I create the image I get the following error: Error: stream throws an empty buffer. I have already increased to 300mb of lambda memory and it doesn't work. const gm =…
tanjiro
  • 81
  • 6
2
votes
1 answer

TypeError: Cannot read property 'width' of undefined gm library

Previously, I had followed this link to successfully create thumbnail images using AWS Lambda. The node version was 8.10. Now, as AWS will be deprecating any application with this node version, i have to update the node version to 10.x. We are…
Setu Kumar Basak
  • 11,460
  • 9
  • 53
  • 85
2
votes
1 answer

Image upload to aws s3 bucket after resizing with graphicMagic

I am using graphicMagic to resize an image before uploading it to aws s3 bucket. The code below uploads an image with 0 byte size, though the response from s3 upload is fine. The following code is what I am doing. The path is the path of the image…
Uchit Kumar
  • 667
  • 10
  • 26
2
votes
1 answer

node gm (imagemagick) seems like not working with when invoked with bas64 string as argument

I'm not getting any output image when image is not path & is base 64 encoded image. const image = 'base64 encoded string'; gm(image, ['jpeg']) .resize(72, 72) .strip() .write('./aks.png', function (err) { if (!err)…
2
votes
0 answers

Swift 4: tableView and scopeButtons slide under searchBar in iOS 11

I made an App in Swift 3 with a tableView that has a searchBar in its header. The searchBar also has a bar with a scopeButton. In iOS 10 the searchBar slid up to where the navigationBar was and everything worked fine. In iOS 11 however the…
2
votes
0 answers

Upload Full Imagemagick to AWS Lambda and use with graphics magic module

Here is a prior post that discusses how the pre-loaded Imagemagick is limited for security reasons on AWS Lambda. "Note: This update contains an updated /etc/ImageMagick/policy.xml file that disables the EPHEMERAL, HTTPS, HTTP, URL, FTP, MVG,…
Tom22
  • 498
  • 5
  • 15
2
votes
1 answer

Use node gm with promises and buffers

I've been trying to use gm with Bluebird like this: var gm = require('gm'); var bluebird = require('bluebird'); gm = bluebird.promisifyAll(gm); But then, when I try something like this: gm(req.file.buffer) .crop(tWidth, tHeight, tWidth/2,…
danielrvt
  • 10,177
  • 20
  • 80
  • 121
2
votes
1 answer

Nodejs bluebird promise fails while processing image

//Created a promise for each image size. var promises = sizes.map(function (size) { return new Promise(function (resolve, reject) { var destinationDir = fileUtil.getAbsolutePathOfImage(destinationPath); …
Manish Singh
  • 518
  • 3
  • 13
2
votes
1 answer

gm Error in aws lambda: string yields empty buffer

I'm trying to upload a buffer to s3 after doing an auto-orient transformation using amazon lambda. I'm sending the buffer from a Nodejs api like so: var data = request.payload; if (data.file) { var Media =…
Sally
  • 75
  • 1
  • 15
2
votes
2 answers

GraphicsMagick unable to process Unicode filenames

I have found that GraphicsMagick is unable to process my files named in Chinese. I did the same test on ImageMagick but IM worked as expected. I thought this might be a bug so I filed a bug report here:…
Daniel Cheung
  • 4,779
  • 1
  • 30
  • 63
2
votes
1 answer

Manipulate GridFS file with GraphicsMagick and store it as new file

I'm trying to read a GridFS file via gridfs-stream (https://github.com/aheckmann/gridfs-stream), rotate it 90° with gm and store it as a new GridFS file. My result looks very 'unstylish'... So I'm asking for help to optimize this little code…
user3142695
  • 15,844
  • 47
  • 176
  • 332
1
vote
0 answers

Graphics Magick stream()'s stdout.on('data') does not run; Is the stdout stream empty?

I am using node Graphics Magick (gm): https://github.com/aheckmann/gm Background: I am having some trouble with using gm.stream() and I would like to understand how to use it. I am attempting to use the data buffer that I get from the "data" event…
KJ Ang
  • 305
  • 3
  • 9
1
vote
0 answers

(npm package) gm only edits the last frame of GIF

I'm trying to overlay text on top of a GIF using the gm package. It does overlay the text on top of regular images, however on GIFs it just overlays the last 2 frames. I don't have much experience using this package and Imagemagick. Here's the code…
1
vote
1 answer

How to change font weight of text added on image using gm

I am using gm for adding text on the image. Now I want to make it bold, but I am not getting an option to change the font-weight. Any help is appreciated. const gm = require('gm').subClass({imageMagick: true}); const imageUrl = 'image_url' const…
Shrutika Patil
  • 565
  • 3
  • 18
1
vote
2 answers

Node.js GraphicsMagick - Compose 2 images together with position and dimensions

I'm trying to compose two images on top of each other using the Node.js gm library. For the final image, avatar.png needs to go on top of bg.png. Here's the code I started with: const image = gm("bg.png") .composite("avatar.png"); This works…
APixel Visuals
  • 1,508
  • 4
  • 20
  • 38