manuels / unix-toolbox.js-imagemagick

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How to convert tiff to png with this API?

yarafatin opened this issue · comments

Could you please let me know if TIFF to PNG conversion is supported in this API? If so, what would be the command?

Something like

var convert = new Interface('../convert-worker.js');
convert.on_stdout = function(txt) { console.log(txt); };

convert.on_stderr = function(txt) { console.log(txt); };
convert.addUrl('./src/config/magic.xml', '/usr/local/etc/ImageMagick/', true);
convert.addUrl('./src/config/coder.xml', '/usr/local/etc/ImageMagick/');
convert.addUrl('./src/config/policy.xml', '/usr/local/etc/ImageMagick/');
convert.addUrl('./src/config/english.xml', '/usr/local/etc/ImageMagick/');
convert.addUrl('./src/config/locale.xml', '/usr/local/etc/ImageMagick/');
convert.addUrl('./src/config/delegates.xml', '/usr/local/etc/ImageMagick/');
convert.addUrl('demo/test.tif', '/');
convert.allDone().then(function() {
    convert.run('demo/test.tif', '/test.png').then(function() {
        convert.getFile('/test.png').then(function(png) {
            console.log(png);
        });
    });
});

should do it

I get this error -
"Magick: no decode delegate for this image format /test.tif' @ error/constitute.c/ReadImage/550. test.html:7 Magick: no images defined/test1.png' @ error/convert.c/ConvertImageCommand/3066."

I tried couple of tiff files with different compression levels and it gave the same error for all of them.

please check if ./src/config/delegates.xml really exists

Yes, it does. I see the delegate for tiff - "<delegate decode="tiff" encode="launch" mode...." in this file.