Question

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 equivalent 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.

Was it helpful?

Solution

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top