I'm using node-imagemagick for the first time. Disclaimer: I've never used imagemagick, and am not much of a javascript guy. Most experience is in C/C++, Objective-C.
I'm writing a snippet for a server side process that needs to take an input buffer, crop it to an arbitrary bounds, and then output that in stdout.
Currently, my code looks like this:
var im = require('imagemagick');
...
im.convert([
binaryDataBlock,
'-crop',
cropStr], function(err, stdout, stderr) {....
I know my input is good... I've done this with imagemagick's "resize" routine. "cropStr" is a string, "100x100+10+10" -- any arbitrary values go here.
But I still get errors back in stderr:
"result" : "convert: unable to open image `����': @ error/blob.c/OpenBlob/2587.\nconvert: no decode delegate for this
image format
����' @ error/constitute.c/ReadImage/532.\nconvert: option requires an argument
-crop' @ error/convert.c/ConvertImageCommand/1081.\n"
I've tried putting in a "-format" argument, which I thought would set the output format. But then it complains about the argument.
I feel like I'm missing something obvious here. It shouldn't be so hard to just crop to an arbitrary rectangle in an image.
Any help would be tremendously appreciated.