开发者

ImageMagick "convert" utility Magick++ equivalent?

开发者 https://www.devze.com 2023-01-24 21:13 出处:网络
Sorry if the title didn\'t make any sense. Currently, the following parameters on the imagemagick convert utility are perfect for what I need. I\'m tring to take an .svg file, make it larger and writ

Sorry if the title didn't make any sense.

Currently, the following parameters on the imagemagick convert utility are perfect for what I need. I'm tring to take an .svg file, make it larger and write it as a png file.

 convert -density 36  home.svg  home_1.png

Unfortunately, I need to be using Magick++ (the C++ Interface/API for ImageMagick), but I can't seem to get the equival开发者_JAVA百科ent operation in Magick++.

Are there any ImageMagick pros that would be able to help me out on this?

My current code is:

image.density(Geometry(36,36));

    image.read( "Character.svg" );

    image.write( "xx.png" ); 

I've tried moving the image.density() part around, but my image is never changes. It's simply rasterized and saved as a png.


I'm no ImageMagick pro, but when I tried this code:

#include <Magick++.h>

int main(int argc, char **argv) {
  Magick::Image img;
  img.density(Magick::Geometry(36,36));
  img.read(argv[1]);
  img.write(argv[2]);

  img.density(Magick::Geometry(72,72));
  img.read(argv[1]);
  img.write(argv[3]);
}

with this SVG file, e.g.:

$ ./resize example.svg out_small.png out_large.png

...the file out_small.png was 300x300 pixels, whereas out_large.png was 600x600 pixels.

This was on Windows 7 via cygwin.

0

精彩评论

暂无评论...
验证码 换一张
取 消