0

I am using the following code to convert images from jpg to png:

    gm('C:/random.jpg').stream('png', function (err, stdout, stderr) {
    var writeStream = fs.createWriteStream('C:/reform.png');
    stdout.pipe(writeStream);
    });

It creates a 0 bytes image inside the folder.I have followed the answer on the thread https://stackoverflow.com/a/25389136/5141784 But all the three methods are generating the same result. Any help would be highly appreciated

Annu
  • 51
  • 1
  • 7

1 Answers1

-1

Something similar happened to me (I got empty Streams from gm), The cause was that I had not installed either the GraphicsMagick or the ImageMagick packages in my computer (Windows) which is a requirement. Check getting started section of the repo if that is your case too: https://github.com/aheckmann/gm#getting-started

How to install graphicsmagick: http://www.graphicsmagick.org/INSTALL-windows.html

How to install Imagemagick: https://www.youtube.com/watch?v=8qLr1IdBElc

PS: Do not forget to check you have the package(s) directory in the PATH variable and restart your computer after installation!

Cibergarri
  • 154
  • 1
  • 5