2

I am running graphicsMagick along with node on windows. I want to resize image and reduce quality. Below is my code. Unforutnately the image is neither resized nor reduced in Quality although I dont have any error. Below is my code.

var gm = require('gm'), 
graphicsMagick = gm.subClass({imageMagick: true});
 //resizing image with graphicsMagick and storing in the same path
                graphicsMagick(fullPathFileName)
                    .resize(null, 150)
                    .noProfile()
                    .quality(70)
                    .write(fullPathFileName, function (err) {
                        if (!err) console.log('Image resized');
                    });

Further imageMagick is installed.
Although, I should agree that when I used imageMagick directly in node by requiring image magic, I got the error described in link imagemagick with nodejs not working so instead of imageMagick I required graphicsMagick, now there is no error but nothing happening on file too.

code that generated error while requiring imageMagick was -->

var im = require('imagemagick');
im.resize({ 
         srcPath: fullPathFileName, 
         dstPath: fullPathFileName, 
          height: 150, 
         quality: 0.8, 
         format: 'png' }, function (err, stdout, stderr) {
              if (err) throw err; 
           console.log('resized image to fit 150px height'); 
       }); 

I uploaded the app to heroku and still graphicsMagick doesn't resize image and no errors, what's happening?

Regards, Chidan

Community
  • 1
  • 1
Chidu Murthy
  • 688
  • 3
  • 10
  • 26
  • Your code is telling `gm` to use `imageMagick`. Do you have ImageMagick installed? – Ben Fortune Jan 19 '15 at 12:50
  • For sure yes and thats why I am not getting any error. – Chidu Murthy Jan 19 '15 at 13:00
  • Although, I should agree that when I used imageMagick directly in node by requiring image magic, I got the error described in link http://stackoverflow.com/questions/11703973/imagemagick-with-nodejs-not-working. so instead of imageMagick I required graphicsMagick, now there is no error but nothing happening on file too.. – Chidu Murthy Jan 19 '15 at 13:01
  • code that generated error while requiring imageMagick was --> im.resize({ srcPath: fullPathFileName, dstPath: fullPathFileName, height: 150, quality: 0.8, format: 'png' }, function (err, stdout, stderr) { if (err) throw err; console.log('resized image to fit 150px height'); }); – Chidu Murthy Jan 19 '15 at 13:03
  • you should be able to edit your original question to add the code that's generating the error so that people see this important info on first-read. – Matthew Bakaitis Jan 19 '15 at 13:49

0 Answers0