AWS lambda Imagemagick convert failed for images of larger file dimension to jp2(jp2000). For images of size less then 60MB, conversion works fine, but above 60MB, I am getting 0KB file. I am using Imagemagick with child_process spawning for image conversion.
Using AWS lambda with Node.js 6.1, 1.5GB memory and 300 second timeout
I am not able to identify why the following code is failing for larger dimension images. Is this a buffer limitation of the child_process?
var fs = require('fs'); var childproc= require('child_process'); var child = childproc.spawn('convert', [inputfile,outputFile,]); var file = fs.createWriteStream(tempDest, {encoding: 'binary'}); child.stdout.pipe(file); child.on('exit', function(){ file.end();console.log("file outputed");wcallback(null);}); child.on('error', function(err){ file.end();console.log(err);wcallback(err);});
I tried Imagemgick node.js wrapper package "npm Imagemagick", also. It was giving an error for the same conversion for larger file. The following is the error:
{ "errorMessage" : "Command failed: ", "errorType" : "Error", "stackTrace" : ["ChildProcess.<anonymous> (/var/task/node_modules/imagemagick/imagemagick.js:92:15)", "emitTwo (events.js:106:13)", "ChildProcess.emit (events.js:191:7)", "maybeClose (internal/child_process.js:886:16)", "Socket.<anonymous> (internal/child_process.js:342:11)", "emitOne (events.js:96:13)", "Socket.emit (events.js:188:7)", "Pipe._handle.close [as _onclose] (net.js:497:12)"]}
JPEGis enormous - what are its dimensions in pixels?/usr/bin/time -l convert -size 9000x9000 xc:gray test.jpg