Resizing .SVG input file

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
Brad1011

Resizing .SVG input file

Post by Brad1011 »

I'm trying to take an input .svg file and resize it and output as a .png file. The problem is, when I output the file it looks all blurry because it looks like it was rasterized before being scaled.

Does anyone know how I can take an .svg file, resize it and save it as a .png in Magick++?


My current code is:

Code: Select all

    image.read( "Character.svg" );
	   image.resize("1000x1000");
    image.write( "xx.png" ); 
I've also tried playing around with density, but it didn't seem to help.

Anyone have any ideas on this?
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: Resizing .SVG input file

Post by anthony »

SVG is a vector language. BUT you need to specify the density (resolution) BEFORE you read the image as it is during the read that the rasterization happens.

See any Magick++ example that 'reads' a 'XC:' or 'canvas:' image file format. The method that example uses to set 'size' before reading (creating) the image, will be the same method used to set 'density'

WARNING: svg can specify some features in terms of 'pixels' and such features will NOT scale with density.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
Post Reply