1

I have been trying to resize the images using image magick in lambda. It is working for smaller images.But if the image size is larger, I am getting below error

Error: Stream yields empty buffer
at Socket.<anonymous> (/var/task/node_modules/gm/lib/command.js:57:17)
at emitNone (events.js:111:20)
at Socket.emit (events.js:208:7)
at endReadableNT (_stream_readable.js:1064:12)
at _combinedTickCallback (internal/process/next_tick.js:138:11)
at process._tickDomainCallback (internal/process/next_tick.js:218:9)
I have increased lambda limit to maximum. Is there a way we could restrict maximum image size(irrespective of width ,height) while image transformation. Below is my re-size code

gm(response).command('convert')
                .resize(_sizesArray[key].width,_sizesArray[key].width)
                .gravity('Center')
                .extent(_sizesArray[key].width,_sizesArray[key].width)
                //.quality(50)
                .toBuffer(
                        'JPG', function(err,
                            buffer)
merla
  • 489
  • 1
  • 5
  • 12
  • How big are the images that fail in dimension and in file size? What is your version of Imagemagick? Are you really using Imagemagick and not GraphicsMagick? I know little about lambda, but Imagemagick has a policy.xml file that may be limiting it in dimension or file size. Or perhaps lambda has set some limits. – fmw42 Oct 09 '18 at 20:49
  • My images are 12MB. I am using GraphicsMagick in lambda. var gm = require('gm').subClass({ imageMagick: true – merla Oct 09 '18 at 21:37
  • What are the Width and Height of the images? I do not know Graphicsmagick. I use Imagemagick and in that there is a policy.xml file that you can edit. But I do not know how that works with lambda. Sorry. – fmw42 Oct 09 '18 at 21:56

0 Answers0