Command-line application for converting SVG to PNG on Mac OS X
Are there any command-line programs that can convert an SVG to PNG, that run on Mac OS X?
Edit: Dylan B had a good answer with ImageMagick. For reference, to install ImageMagick with SVG support on Mac OS X using MacPorts, do
port install imagemagick +rsvg
macos command-line png svg
add a comment |
Are there any command-line programs that can convert an SVG to PNG, that run on Mac OS X?
Edit: Dylan B had a good answer with ImageMagick. For reference, to install ImageMagick with SVG support on Mac OS X using MacPorts, do
port install imagemagick +rsvg
macos command-line png svg
1
I found a way if you have Google Chrome... and no need to install any other things: superuser.com/questions/134679/…
– 太極者無極而生
Feb 7 '16 at 19:06
add a comment |
Are there any command-line programs that can convert an SVG to PNG, that run on Mac OS X?
Edit: Dylan B had a good answer with ImageMagick. For reference, to install ImageMagick with SVG support on Mac OS X using MacPorts, do
port install imagemagick +rsvg
macos command-line png svg
Are there any command-line programs that can convert an SVG to PNG, that run on Mac OS X?
Edit: Dylan B had a good answer with ImageMagick. For reference, to install ImageMagick with SVG support on Mac OS X using MacPorts, do
port install imagemagick +rsvg
macos command-line png svg
macos command-line png svg
edited Apr 10 '11 at 16:40
paradroid
19.1k95898
19.1k95898
asked Apr 26 '10 at 1:53
Lorin Hochstein
1,53542224
1,53542224
1
I found a way if you have Google Chrome... and no need to install any other things: superuser.com/questions/134679/…
– 太極者無極而生
Feb 7 '16 at 19:06
add a comment |
1
I found a way if you have Google Chrome... and no need to install any other things: superuser.com/questions/134679/…
– 太極者無極而生
Feb 7 '16 at 19:06
1
1
I found a way if you have Google Chrome... and no need to install any other things: superuser.com/questions/134679/…
– 太極者無極而生
Feb 7 '16 at 19:06
I found a way if you have Google Chrome... and no need to install any other things: superuser.com/questions/134679/…
– 太極者無極而生
Feb 7 '16 at 19:06
add a comment |
16 Answers
16
active
oldest
votes
Or without installing anything:
qlmanage -t -s 1000 -o . picture.svg
It will produce picture.svg.png that is 1000 pixels wide.
I have tested it only on OS X 10.6.3.
34
Unfortunately this clips images to a square.
– Martijn Pieters
Jan 30 '11 at 15:13
5
Ah,qlmanage -tgives the thumbnail used by Quick Look (in Finder, etc). Clever idea. Unfortunately, these thumbnails can be buggy, especially when there's text involved.
– ShreevatsaR
Jun 6 '11 at 8:07
6
This produces images with the svg file in the 1st quadrant. Doesn't auto crop. Trying to convert files from noun project - wish this worked.
– Alex Cook
Nov 12 '12 at 20:40
6
This solution fails to take transparency into account. The toolrsvg-convertin @ahti's answer worked out before for me.
– BenR
May 19 '16 at 8:30
3
Putting both width and height parameters after the-soption didn't work for me. Still crops it to a square. Very frustrating!
– Erik van der Neut
Aug 25 '17 at 7:45
|
show 10 more comments
I found that for me the best tool for the job is rsvg-convert.
It can be found in brew with brew install librsvg and is used like this:
rsvg-convert -h 32 icon.svg > icon-32.png
(This example creates a 32px high png. The width is determined automatically.
This is the only one that worked for me on Mavericks and commons.wikimedia.org/wiki/…
– Aron Ahmadia
Jun 10 '14 at 1:03
Actually this one worked, while ImageMagick'sconvertissued errors and failed to covert a complex SVG
– Brice
Apr 27 '15 at 10:03
6
This is by far the best solution I've found for OS X Yosemite +1!
– Greg Martin
May 9 '15 at 15:03
This failed for some of my SVGs, strangely. Theqlmanageanswer worked for all of them but put a white background, which I don't want.
– sudo
Jun 25 '15 at 0:35
1
Withrsvg-convert, the resulting .png had the right dimensions, but the image came out all black instead of the original colors. Withqlmanagethe image is cropped to a square. Still searching for a solution :-(
– Erik van der Neut
Aug 25 '17 at 7:47
|
show 7 more comments
ImageMagick is an extremely versatile command-line image editor, which would probably rival Photoshop if it had, you know, a GUI. But who needs those anyways. :P
Something like the following would convert a .svg to .png, after installation:
$ convert picture.svg picture.png
The original .svg isn't deleted.
It sort of has a GUI, indisplay.
– Ignacio Vazquez-Abrams
Apr 26 '10 at 4:04
1
When I installed ImageMagick with Fink, I couldn't convert svg to png - there were some errors. It turned out that I needed to install librsvg2-bin as well.
– tst
May 21 '10 at 12:44
If librsvg2-bin isn't installed (like on OS X) this will fail. Couldn't find a way to get that installed on OS X.
– John Sheehan
Aug 3 '12 at 18:53
3
This won't work well if you want to resize the SVG as it generates blurry images.
– Behrang
May 23 '13 at 3:04
3
It doesn't convert all SVG files correctly either; at least qlmanage got all the parts of the image.
– Johan
Feb 21 '14 at 19:50
|
show 2 more comments
Inkscape with it's Commandline-Interface produces the best results for me:
/Applications/Inkscape.app/Contents/Resources/bin/inkscape --export-png output.png -w 1024 -h 768 input.svg
Good thing is, you can specify the exact pixel size of the resulting image, without having to mess with density.
this is working for me! - ihave a bigger SVG created with Inkscape
– matheszabi
Oct 7 '13 at 21:56
This is the only method that rendered my hand-written svg correctly
– Griffin
Jul 31 '14 at 23:45
Convert does not generate good PNG files from SVG. Using Inkscape is the best way I have found so far.
– ol_v_er
Feb 27 '15 at 7:43
This works for me, but creates extremely blurry files.
– Marcin
Apr 16 '15 at 13:04
3
I had a problem to find files so run it asinkscape $(pwd)/logo.svg --export-png $(pwd)/logo.png
– Andrei
Jun 7 '15 at 8:32
|
show 1 more comment
OK, I found a simple way to do it on the Mac if you have Google Chrome.
In one sentence, it is to see the svg image in a webpage (must be in an html file), right click on image and choose "Copy Image" and paste to the Preview app.
Steps:
- Download or have the
svgfile in your hard drive, say,somefile.svg
- Now, in the same folder, just make an html file
tmp.htmlthat contains this line:<img src="somefile.svg">
- Now, open that html file in Google Chrome
- You should see the image. Now just right click on the image and choose "Copy Image"
- Go to Mac's Preview App, and choose,
"File -> New from Clipboard"
- Now
File -> Savethe file and you have thepngfile. (or other file types).
This is tested on the current Chrome (version 48.0) on Mac OS X El Capitan.
Update: I am not sure whether it is due to some restriction imposed by Google Chrome. I just try an SVG file using Chrome 58.0, and I get a tiny image from the method above. If you see this case too, you can also use
<img src="somefile.svg" style="height: 82vh; margin-top: 9vh; margin-left: 9vh">
and you will have an image on screen good enough for you to do a screenshot -- using CmdShift4 or CmdShift3 on the Mac, for example. Make sure you resize your Chrome window to the maximum allowed on screen.
Smart solution!
– Manu
Mar 2 '16 at 15:07
This actually produces the best results for me since it renders exactly the same as the browser.
– Jason Haslam
Jan 26 '17 at 1:25
the resulting image was very poor resolution for me
– Michael
Sep 22 '17 at 16:02
Ingenious :) but for very large SVGs, the resolution of the resulting image is too low, as @Michael mentioned.
– waldyrious
Oct 23 '18 at 10:24
add a comment |
If you want to do many at once, you can:
mogrify -format png *.svg
There are options to resize etc on the fly, too..
3
mogrifyis also par of ImageMagick.
– ShreevatsaR
Jun 6 '11 at 8:19
Works great, but brutally slow.
– Meekohi
Jan 24 '14 at 21:58
-1? Someone thinks this isn't helpful? What's the error?
– DefenestrationDay
Jul 29 '14 at 20:41
I'm not the one who downvoted, but worth noting is that ImageMagick stupidly converts svg to a raster image of arbitrary size before resizing, resulting in blurry output.
– Dae
Nov 1 '15 at 19:47
add a comment |
Try Apache Batik.
java -jar batik-rasterizer.jar FILES
It also supports batch conversion and has many other useful options.
add a comment |
I have made svgexport using node/npm for this, it is cross-platform and can be as simple as:
svgexport input.svg output.png
This was the easiest one to use and remember by far. Also, the only one that produced a correct result in my case.
– Marko Grešak
May 9 '17 at 22:09
resulting resolution wasn't great for me.
– Michael
Sep 22 '17 at 16:22
add a comment |
You can also use phantomjs to render the svg. The advantage is that it renders it like a browser would since it's basically a headless WebKit.
Once you download it you need phantomjs (binary) and the rasterizer.js file from the examples folder.
phantomjs examples/rasterize.js Tiger.svg out.png
For reference, this can be installed withbrew cask install phantomjs. In my install, the examples folder was located in the path/usr/local/Caskroom/phantomjs/2.1.1/phantomjs-2.1.1-macosx/examples/.
– waldyrious
Oct 23 '18 at 10:26
add a comment |
I use this command on my linux. It should work for you as well.
mogrify +antialias -density 2000 -verbose -format png *.svg
I learned that without the "-density" argument, the bitmap would be very pixelized. Change the -density value to match your need.
2
Even with density, the conversion does not generate an image that is as sharp as a vector image. Try Apache Batik instead.
– Behrang
May 23 '13 at 3:06
add a comment |
ImageMagick's convert command, using some other parameters, is what did it for me. Here's my batch Bash script solution that divides the task across multiple processes to make use of all your cores! Modify as needed.
batchConvertToSVG.sh (takes number of processes as argument):
end=$(( $1 - 1 ))
for i in `seq 0 $end`;
do
echo Spawning helper $i of $end
./convertToSvgHelper.sh $i $1 &
done
convertToSvgHelper.sh:
n=$1
for file in ./*.svg; do
filename=${file%.svg}
echo converting file named $filename
test $n -eq 0 && convert -format png -resize 74 -background transparent -density 600 $file $filename.png
n=$((n+1))
n=$((n%$2))
done
add a comment |
As commented previously ImageMagick does the trick. I just wanted to add a point for GraphicsMagick, an old fork of ImageMagick that has some improvements (and much less dependency bloat when installed via fink).
add a comment |
You can perform a batch conversion on an entire folder of SVG files to PNG. I used Inkscape command line interface to produce png files with a width of 80px.
find ~/desktop/toconvert '*.svg' -exec /Applications/Inkscape.app/Contents/Resources/bin/inkscape -z -w 80 -e "{}".png "{}" ;
png will be saved with original name *.png
add a comment |
This is what I used:
brew install imagemagick --with-librsvg
Then run the following commands:
find . -type f -name "*.svg" -exec bash -c 'convert $0 $0.png' {} ;
rename 's/svg.png/png/' *
Hope it helps.
add a comment |
wkhtmltoimage (from project wkhtmltopdf) did this convert well:
wkhtmltoimage --zoom 2 foo.svg foo.png
ImageMagick renders CJK character as blank on my mac.
While this link may answer the question, it is better to include the essential parts of the answer here and provide the link for reference. Link-only answers can become invalid if the linked page changes. - From Review
– Blackwood
Dec 14 '18 at 4:09
@Blackwood fine, updated.
– georgexsh
Dec 14 '18 at 8:11
add a comment |
sips — scriptable image processing system. No external binaries required.
sips -s format png mypdf.pdf --out myimage.png
Here's a script I use after a session of screen captures.
PWD=`pwd`
IMAGES=`ls "$PWD"/*.tiff`
TARGET=png
for IMAGE in $IMAGES
do
SOURCE="$IMAGE"
DESTINATION=`echo "$SOURCE" | sed "s/tiff/$TARGET/g"`
sips -s format "$TARGET" "$SOURCE" --out "$DESTINATION" &2>/dev/null
done
Tried it, didn't produce any output.
– xApple
Feb 12 '13 at 13:26
3
-1 The man page clearly states sips is is used to query or modify raster image files so starting from a SVG which is what the OP was asking will not work
– RobV
Aug 22 '13 at 18:16
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "3"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: false,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f134679%2fcommand-line-application-for-converting-svg-to-png-on-mac-os-x%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
StackExchange.ready(function () {
$("#show-editor-button input, #show-editor-button button").click(function () {
var showEditor = function() {
$("#show-editor-button").hide();
$("#post-form").removeClass("dno");
StackExchange.editor.finallyInit();
};
var useFancy = $(this).data('confirm-use-fancy');
if(useFancy == 'True') {
var popupTitle = $(this).data('confirm-fancy-title');
var popupBody = $(this).data('confirm-fancy-body');
var popupAccept = $(this).data('confirm-fancy-accept-button');
$(this).loadPopup({
url: '/post/self-answer-popup',
loaded: function(popup) {
var pTitle = $(popup).find('h2');
var pBody = $(popup).find('.popup-body');
var pSubmit = $(popup).find('.popup-submit');
pTitle.text(popupTitle);
pBody.html(popupBody);
pSubmit.val(popupAccept).click(showEditor);
}
})
} else{
var confirmText = $(this).data('confirm-text');
if (confirmText ? confirm(confirmText) : true) {
showEditor();
}
}
});
});
16 Answers
16
active
oldest
votes
16 Answers
16
active
oldest
votes
active
oldest
votes
active
oldest
votes
Or without installing anything:
qlmanage -t -s 1000 -o . picture.svg
It will produce picture.svg.png that is 1000 pixels wide.
I have tested it only on OS X 10.6.3.
34
Unfortunately this clips images to a square.
– Martijn Pieters
Jan 30 '11 at 15:13
5
Ah,qlmanage -tgives the thumbnail used by Quick Look (in Finder, etc). Clever idea. Unfortunately, these thumbnails can be buggy, especially when there's text involved.
– ShreevatsaR
Jun 6 '11 at 8:07
6
This produces images with the svg file in the 1st quadrant. Doesn't auto crop. Trying to convert files from noun project - wish this worked.
– Alex Cook
Nov 12 '12 at 20:40
6
This solution fails to take transparency into account. The toolrsvg-convertin @ahti's answer worked out before for me.
– BenR
May 19 '16 at 8:30
3
Putting both width and height parameters after the-soption didn't work for me. Still crops it to a square. Very frustrating!
– Erik van der Neut
Aug 25 '17 at 7:45
|
show 10 more comments
Or without installing anything:
qlmanage -t -s 1000 -o . picture.svg
It will produce picture.svg.png that is 1000 pixels wide.
I have tested it only on OS X 10.6.3.
34
Unfortunately this clips images to a square.
– Martijn Pieters
Jan 30 '11 at 15:13
5
Ah,qlmanage -tgives the thumbnail used by Quick Look (in Finder, etc). Clever idea. Unfortunately, these thumbnails can be buggy, especially when there's text involved.
– ShreevatsaR
Jun 6 '11 at 8:07
6
This produces images with the svg file in the 1st quadrant. Doesn't auto crop. Trying to convert files from noun project - wish this worked.
– Alex Cook
Nov 12 '12 at 20:40
6
This solution fails to take transparency into account. The toolrsvg-convertin @ahti's answer worked out before for me.
– BenR
May 19 '16 at 8:30
3
Putting both width and height parameters after the-soption didn't work for me. Still crops it to a square. Very frustrating!
– Erik van der Neut
Aug 25 '17 at 7:45
|
show 10 more comments
Or without installing anything:
qlmanage -t -s 1000 -o . picture.svg
It will produce picture.svg.png that is 1000 pixels wide.
I have tested it only on OS X 10.6.3.
Or without installing anything:
qlmanage -t -s 1000 -o . picture.svg
It will produce picture.svg.png that is 1000 pixels wide.
I have tested it only on OS X 10.6.3.
answered May 17 '10 at 13:32
tst
2,1661102
2,1661102
34
Unfortunately this clips images to a square.
– Martijn Pieters
Jan 30 '11 at 15:13
5
Ah,qlmanage -tgives the thumbnail used by Quick Look (in Finder, etc). Clever idea. Unfortunately, these thumbnails can be buggy, especially when there's text involved.
– ShreevatsaR
Jun 6 '11 at 8:07
6
This produces images with the svg file in the 1st quadrant. Doesn't auto crop. Trying to convert files from noun project - wish this worked.
– Alex Cook
Nov 12 '12 at 20:40
6
This solution fails to take transparency into account. The toolrsvg-convertin @ahti's answer worked out before for me.
– BenR
May 19 '16 at 8:30
3
Putting both width and height parameters after the-soption didn't work for me. Still crops it to a square. Very frustrating!
– Erik van der Neut
Aug 25 '17 at 7:45
|
show 10 more comments
34
Unfortunately this clips images to a square.
– Martijn Pieters
Jan 30 '11 at 15:13
5
Ah,qlmanage -tgives the thumbnail used by Quick Look (in Finder, etc). Clever idea. Unfortunately, these thumbnails can be buggy, especially when there's text involved.
– ShreevatsaR
Jun 6 '11 at 8:07
6
This produces images with the svg file in the 1st quadrant. Doesn't auto crop. Trying to convert files from noun project - wish this worked.
– Alex Cook
Nov 12 '12 at 20:40
6
This solution fails to take transparency into account. The toolrsvg-convertin @ahti's answer worked out before for me.
– BenR
May 19 '16 at 8:30
3
Putting both width and height parameters after the-soption didn't work for me. Still crops it to a square. Very frustrating!
– Erik van der Neut
Aug 25 '17 at 7:45
34
34
Unfortunately this clips images to a square.
– Martijn Pieters
Jan 30 '11 at 15:13
Unfortunately this clips images to a square.
– Martijn Pieters
Jan 30 '11 at 15:13
5
5
Ah,
qlmanage -t gives the thumbnail used by Quick Look (in Finder, etc). Clever idea. Unfortunately, these thumbnails can be buggy, especially when there's text involved.– ShreevatsaR
Jun 6 '11 at 8:07
Ah,
qlmanage -t gives the thumbnail used by Quick Look (in Finder, etc). Clever idea. Unfortunately, these thumbnails can be buggy, especially when there's text involved.– ShreevatsaR
Jun 6 '11 at 8:07
6
6
This produces images with the svg file in the 1st quadrant. Doesn't auto crop. Trying to convert files from noun project - wish this worked.
– Alex Cook
Nov 12 '12 at 20:40
This produces images with the svg file in the 1st quadrant. Doesn't auto crop. Trying to convert files from noun project - wish this worked.
– Alex Cook
Nov 12 '12 at 20:40
6
6
This solution fails to take transparency into account. The tool
rsvg-convert in @ahti's answer worked out before for me.– BenR
May 19 '16 at 8:30
This solution fails to take transparency into account. The tool
rsvg-convert in @ahti's answer worked out before for me.– BenR
May 19 '16 at 8:30
3
3
Putting both width and height parameters after the
-s option didn't work for me. Still crops it to a square. Very frustrating!– Erik van der Neut
Aug 25 '17 at 7:45
Putting both width and height parameters after the
-s option didn't work for me. Still crops it to a square. Very frustrating!– Erik van der Neut
Aug 25 '17 at 7:45
|
show 10 more comments
I found that for me the best tool for the job is rsvg-convert.
It can be found in brew with brew install librsvg and is used like this:
rsvg-convert -h 32 icon.svg > icon-32.png
(This example creates a 32px high png. The width is determined automatically.
This is the only one that worked for me on Mavericks and commons.wikimedia.org/wiki/…
– Aron Ahmadia
Jun 10 '14 at 1:03
Actually this one worked, while ImageMagick'sconvertissued errors and failed to covert a complex SVG
– Brice
Apr 27 '15 at 10:03
6
This is by far the best solution I've found for OS X Yosemite +1!
– Greg Martin
May 9 '15 at 15:03
This failed for some of my SVGs, strangely. Theqlmanageanswer worked for all of them but put a white background, which I don't want.
– sudo
Jun 25 '15 at 0:35
1
Withrsvg-convert, the resulting .png had the right dimensions, but the image came out all black instead of the original colors. Withqlmanagethe image is cropped to a square. Still searching for a solution :-(
– Erik van der Neut
Aug 25 '17 at 7:47
|
show 7 more comments
I found that for me the best tool for the job is rsvg-convert.
It can be found in brew with brew install librsvg and is used like this:
rsvg-convert -h 32 icon.svg > icon-32.png
(This example creates a 32px high png. The width is determined automatically.
This is the only one that worked for me on Mavericks and commons.wikimedia.org/wiki/…
– Aron Ahmadia
Jun 10 '14 at 1:03
Actually this one worked, while ImageMagick'sconvertissued errors and failed to covert a complex SVG
– Brice
Apr 27 '15 at 10:03
6
This is by far the best solution I've found for OS X Yosemite +1!
– Greg Martin
May 9 '15 at 15:03
This failed for some of my SVGs, strangely. Theqlmanageanswer worked for all of them but put a white background, which I don't want.
– sudo
Jun 25 '15 at 0:35
1
Withrsvg-convert, the resulting .png had the right dimensions, but the image came out all black instead of the original colors. Withqlmanagethe image is cropped to a square. Still searching for a solution :-(
– Erik van der Neut
Aug 25 '17 at 7:47
|
show 7 more comments
I found that for me the best tool for the job is rsvg-convert.
It can be found in brew with brew install librsvg and is used like this:
rsvg-convert -h 32 icon.svg > icon-32.png
(This example creates a 32px high png. The width is determined automatically.
I found that for me the best tool for the job is rsvg-convert.
It can be found in brew with brew install librsvg and is used like this:
rsvg-convert -h 32 icon.svg > icon-32.png
(This example creates a 32px high png. The width is determined automatically.
answered Feb 28 '14 at 20:47
Ahti
97963
97963
This is the only one that worked for me on Mavericks and commons.wikimedia.org/wiki/…
– Aron Ahmadia
Jun 10 '14 at 1:03
Actually this one worked, while ImageMagick'sconvertissued errors and failed to covert a complex SVG
– Brice
Apr 27 '15 at 10:03
6
This is by far the best solution I've found for OS X Yosemite +1!
– Greg Martin
May 9 '15 at 15:03
This failed for some of my SVGs, strangely. Theqlmanageanswer worked for all of them but put a white background, which I don't want.
– sudo
Jun 25 '15 at 0:35
1
Withrsvg-convert, the resulting .png had the right dimensions, but the image came out all black instead of the original colors. Withqlmanagethe image is cropped to a square. Still searching for a solution :-(
– Erik van der Neut
Aug 25 '17 at 7:47
|
show 7 more comments
This is the only one that worked for me on Mavericks and commons.wikimedia.org/wiki/…
– Aron Ahmadia
Jun 10 '14 at 1:03
Actually this one worked, while ImageMagick'sconvertissued errors and failed to covert a complex SVG
– Brice
Apr 27 '15 at 10:03
6
This is by far the best solution I've found for OS X Yosemite +1!
– Greg Martin
May 9 '15 at 15:03
This failed for some of my SVGs, strangely. Theqlmanageanswer worked for all of them but put a white background, which I don't want.
– sudo
Jun 25 '15 at 0:35
1
Withrsvg-convert, the resulting .png had the right dimensions, but the image came out all black instead of the original colors. Withqlmanagethe image is cropped to a square. Still searching for a solution :-(
– Erik van der Neut
Aug 25 '17 at 7:47
This is the only one that worked for me on Mavericks and commons.wikimedia.org/wiki/…
– Aron Ahmadia
Jun 10 '14 at 1:03
This is the only one that worked for me on Mavericks and commons.wikimedia.org/wiki/…
– Aron Ahmadia
Jun 10 '14 at 1:03
Actually this one worked, while ImageMagick's
convert issued errors and failed to covert a complex SVG– Brice
Apr 27 '15 at 10:03
Actually this one worked, while ImageMagick's
convert issued errors and failed to covert a complex SVG– Brice
Apr 27 '15 at 10:03
6
6
This is by far the best solution I've found for OS X Yosemite +1!
– Greg Martin
May 9 '15 at 15:03
This is by far the best solution I've found for OS X Yosemite +1!
– Greg Martin
May 9 '15 at 15:03
This failed for some of my SVGs, strangely. The
qlmanage answer worked for all of them but put a white background, which I don't want.– sudo
Jun 25 '15 at 0:35
This failed for some of my SVGs, strangely. The
qlmanage answer worked for all of them but put a white background, which I don't want.– sudo
Jun 25 '15 at 0:35
1
1
With
rsvg-convert, the resulting .png had the right dimensions, but the image came out all black instead of the original colors. With qlmanage the image is cropped to a square. Still searching for a solution :-(– Erik van der Neut
Aug 25 '17 at 7:47
With
rsvg-convert, the resulting .png had the right dimensions, but the image came out all black instead of the original colors. With qlmanage the image is cropped to a square. Still searching for a solution :-(– Erik van der Neut
Aug 25 '17 at 7:47
|
show 7 more comments
ImageMagick is an extremely versatile command-line image editor, which would probably rival Photoshop if it had, you know, a GUI. But who needs those anyways. :P
Something like the following would convert a .svg to .png, after installation:
$ convert picture.svg picture.png
The original .svg isn't deleted.
It sort of has a GUI, indisplay.
– Ignacio Vazquez-Abrams
Apr 26 '10 at 4:04
1
When I installed ImageMagick with Fink, I couldn't convert svg to png - there were some errors. It turned out that I needed to install librsvg2-bin as well.
– tst
May 21 '10 at 12:44
If librsvg2-bin isn't installed (like on OS X) this will fail. Couldn't find a way to get that installed on OS X.
– John Sheehan
Aug 3 '12 at 18:53
3
This won't work well if you want to resize the SVG as it generates blurry images.
– Behrang
May 23 '13 at 3:04
3
It doesn't convert all SVG files correctly either; at least qlmanage got all the parts of the image.
– Johan
Feb 21 '14 at 19:50
|
show 2 more comments
ImageMagick is an extremely versatile command-line image editor, which would probably rival Photoshop if it had, you know, a GUI. But who needs those anyways. :P
Something like the following would convert a .svg to .png, after installation:
$ convert picture.svg picture.png
The original .svg isn't deleted.
It sort of has a GUI, indisplay.
– Ignacio Vazquez-Abrams
Apr 26 '10 at 4:04
1
When I installed ImageMagick with Fink, I couldn't convert svg to png - there were some errors. It turned out that I needed to install librsvg2-bin as well.
– tst
May 21 '10 at 12:44
If librsvg2-bin isn't installed (like on OS X) this will fail. Couldn't find a way to get that installed on OS X.
– John Sheehan
Aug 3 '12 at 18:53
3
This won't work well if you want to resize the SVG as it generates blurry images.
– Behrang
May 23 '13 at 3:04
3
It doesn't convert all SVG files correctly either; at least qlmanage got all the parts of the image.
– Johan
Feb 21 '14 at 19:50
|
show 2 more comments
ImageMagick is an extremely versatile command-line image editor, which would probably rival Photoshop if it had, you know, a GUI. But who needs those anyways. :P
Something like the following would convert a .svg to .png, after installation:
$ convert picture.svg picture.png
The original .svg isn't deleted.
ImageMagick is an extremely versatile command-line image editor, which would probably rival Photoshop if it had, you know, a GUI. But who needs those anyways. :P
Something like the following would convert a .svg to .png, after installation:
$ convert picture.svg picture.png
The original .svg isn't deleted.
answered Apr 26 '10 at 2:00
Jessie
1,6181010
1,6181010
It sort of has a GUI, indisplay.
– Ignacio Vazquez-Abrams
Apr 26 '10 at 4:04
1
When I installed ImageMagick with Fink, I couldn't convert svg to png - there were some errors. It turned out that I needed to install librsvg2-bin as well.
– tst
May 21 '10 at 12:44
If librsvg2-bin isn't installed (like on OS X) this will fail. Couldn't find a way to get that installed on OS X.
– John Sheehan
Aug 3 '12 at 18:53
3
This won't work well if you want to resize the SVG as it generates blurry images.
– Behrang
May 23 '13 at 3:04
3
It doesn't convert all SVG files correctly either; at least qlmanage got all the parts of the image.
– Johan
Feb 21 '14 at 19:50
|
show 2 more comments
It sort of has a GUI, indisplay.
– Ignacio Vazquez-Abrams
Apr 26 '10 at 4:04
1
When I installed ImageMagick with Fink, I couldn't convert svg to png - there were some errors. It turned out that I needed to install librsvg2-bin as well.
– tst
May 21 '10 at 12:44
If librsvg2-bin isn't installed (like on OS X) this will fail. Couldn't find a way to get that installed on OS X.
– John Sheehan
Aug 3 '12 at 18:53
3
This won't work well if you want to resize the SVG as it generates blurry images.
– Behrang
May 23 '13 at 3:04
3
It doesn't convert all SVG files correctly either; at least qlmanage got all the parts of the image.
– Johan
Feb 21 '14 at 19:50
It sort of has a GUI, in
display.– Ignacio Vazquez-Abrams
Apr 26 '10 at 4:04
It sort of has a GUI, in
display.– Ignacio Vazquez-Abrams
Apr 26 '10 at 4:04
1
1
When I installed ImageMagick with Fink, I couldn't convert svg to png - there were some errors. It turned out that I needed to install librsvg2-bin as well.
– tst
May 21 '10 at 12:44
When I installed ImageMagick with Fink, I couldn't convert svg to png - there were some errors. It turned out that I needed to install librsvg2-bin as well.
– tst
May 21 '10 at 12:44
If librsvg2-bin isn't installed (like on OS X) this will fail. Couldn't find a way to get that installed on OS X.
– John Sheehan
Aug 3 '12 at 18:53
If librsvg2-bin isn't installed (like on OS X) this will fail. Couldn't find a way to get that installed on OS X.
– John Sheehan
Aug 3 '12 at 18:53
3
3
This won't work well if you want to resize the SVG as it generates blurry images.
– Behrang
May 23 '13 at 3:04
This won't work well if you want to resize the SVG as it generates blurry images.
– Behrang
May 23 '13 at 3:04
3
3
It doesn't convert all SVG files correctly either; at least qlmanage got all the parts of the image.
– Johan
Feb 21 '14 at 19:50
It doesn't convert all SVG files correctly either; at least qlmanage got all the parts of the image.
– Johan
Feb 21 '14 at 19:50
|
show 2 more comments
Inkscape with it's Commandline-Interface produces the best results for me:
/Applications/Inkscape.app/Contents/Resources/bin/inkscape --export-png output.png -w 1024 -h 768 input.svg
Good thing is, you can specify the exact pixel size of the resulting image, without having to mess with density.
this is working for me! - ihave a bigger SVG created with Inkscape
– matheszabi
Oct 7 '13 at 21:56
This is the only method that rendered my hand-written svg correctly
– Griffin
Jul 31 '14 at 23:45
Convert does not generate good PNG files from SVG. Using Inkscape is the best way I have found so far.
– ol_v_er
Feb 27 '15 at 7:43
This works for me, but creates extremely blurry files.
– Marcin
Apr 16 '15 at 13:04
3
I had a problem to find files so run it asinkscape $(pwd)/logo.svg --export-png $(pwd)/logo.png
– Andrei
Jun 7 '15 at 8:32
|
show 1 more comment
Inkscape with it's Commandline-Interface produces the best results for me:
/Applications/Inkscape.app/Contents/Resources/bin/inkscape --export-png output.png -w 1024 -h 768 input.svg
Good thing is, you can specify the exact pixel size of the resulting image, without having to mess with density.
this is working for me! - ihave a bigger SVG created with Inkscape
– matheszabi
Oct 7 '13 at 21:56
This is the only method that rendered my hand-written svg correctly
– Griffin
Jul 31 '14 at 23:45
Convert does not generate good PNG files from SVG. Using Inkscape is the best way I have found so far.
– ol_v_er
Feb 27 '15 at 7:43
This works for me, but creates extremely blurry files.
– Marcin
Apr 16 '15 at 13:04
3
I had a problem to find files so run it asinkscape $(pwd)/logo.svg --export-png $(pwd)/logo.png
– Andrei
Jun 7 '15 at 8:32
|
show 1 more comment
Inkscape with it's Commandline-Interface produces the best results for me:
/Applications/Inkscape.app/Contents/Resources/bin/inkscape --export-png output.png -w 1024 -h 768 input.svg
Good thing is, you can specify the exact pixel size of the resulting image, without having to mess with density.
Inkscape with it's Commandline-Interface produces the best results for me:
/Applications/Inkscape.app/Contents/Resources/bin/inkscape --export-png output.png -w 1024 -h 768 input.svg
Good thing is, you can specify the exact pixel size of the resulting image, without having to mess with density.
answered Jan 5 '13 at 13:04
seb
38933
38933
this is working for me! - ihave a bigger SVG created with Inkscape
– matheszabi
Oct 7 '13 at 21:56
This is the only method that rendered my hand-written svg correctly
– Griffin
Jul 31 '14 at 23:45
Convert does not generate good PNG files from SVG. Using Inkscape is the best way I have found so far.
– ol_v_er
Feb 27 '15 at 7:43
This works for me, but creates extremely blurry files.
– Marcin
Apr 16 '15 at 13:04
3
I had a problem to find files so run it asinkscape $(pwd)/logo.svg --export-png $(pwd)/logo.png
– Andrei
Jun 7 '15 at 8:32
|
show 1 more comment
this is working for me! - ihave a bigger SVG created with Inkscape
– matheszabi
Oct 7 '13 at 21:56
This is the only method that rendered my hand-written svg correctly
– Griffin
Jul 31 '14 at 23:45
Convert does not generate good PNG files from SVG. Using Inkscape is the best way I have found so far.
– ol_v_er
Feb 27 '15 at 7:43
This works for me, but creates extremely blurry files.
– Marcin
Apr 16 '15 at 13:04
3
I had a problem to find files so run it asinkscape $(pwd)/logo.svg --export-png $(pwd)/logo.png
– Andrei
Jun 7 '15 at 8:32
this is working for me! - ihave a bigger SVG created with Inkscape
– matheszabi
Oct 7 '13 at 21:56
this is working for me! - ihave a bigger SVG created with Inkscape
– matheszabi
Oct 7 '13 at 21:56
This is the only method that rendered my hand-written svg correctly
– Griffin
Jul 31 '14 at 23:45
This is the only method that rendered my hand-written svg correctly
– Griffin
Jul 31 '14 at 23:45
Convert does not generate good PNG files from SVG. Using Inkscape is the best way I have found so far.
– ol_v_er
Feb 27 '15 at 7:43
Convert does not generate good PNG files from SVG. Using Inkscape is the best way I have found so far.
– ol_v_er
Feb 27 '15 at 7:43
This works for me, but creates extremely blurry files.
– Marcin
Apr 16 '15 at 13:04
This works for me, but creates extremely blurry files.
– Marcin
Apr 16 '15 at 13:04
3
3
I had a problem to find files so run it as
inkscape $(pwd)/logo.svg --export-png $(pwd)/logo.png– Andrei
Jun 7 '15 at 8:32
I had a problem to find files so run it as
inkscape $(pwd)/logo.svg --export-png $(pwd)/logo.png– Andrei
Jun 7 '15 at 8:32
|
show 1 more comment
OK, I found a simple way to do it on the Mac if you have Google Chrome.
In one sentence, it is to see the svg image in a webpage (must be in an html file), right click on image and choose "Copy Image" and paste to the Preview app.
Steps:
- Download or have the
svgfile in your hard drive, say,somefile.svg
- Now, in the same folder, just make an html file
tmp.htmlthat contains this line:<img src="somefile.svg">
- Now, open that html file in Google Chrome
- You should see the image. Now just right click on the image and choose "Copy Image"
- Go to Mac's Preview App, and choose,
"File -> New from Clipboard"
- Now
File -> Savethe file and you have thepngfile. (or other file types).
This is tested on the current Chrome (version 48.0) on Mac OS X El Capitan.
Update: I am not sure whether it is due to some restriction imposed by Google Chrome. I just try an SVG file using Chrome 58.0, and I get a tiny image from the method above. If you see this case too, you can also use
<img src="somefile.svg" style="height: 82vh; margin-top: 9vh; margin-left: 9vh">
and you will have an image on screen good enough for you to do a screenshot -- using CmdShift4 or CmdShift3 on the Mac, for example. Make sure you resize your Chrome window to the maximum allowed on screen.
Smart solution!
– Manu
Mar 2 '16 at 15:07
This actually produces the best results for me since it renders exactly the same as the browser.
– Jason Haslam
Jan 26 '17 at 1:25
the resulting image was very poor resolution for me
– Michael
Sep 22 '17 at 16:02
Ingenious :) but for very large SVGs, the resolution of the resulting image is too low, as @Michael mentioned.
– waldyrious
Oct 23 '18 at 10:24
add a comment |
OK, I found a simple way to do it on the Mac if you have Google Chrome.
In one sentence, it is to see the svg image in a webpage (must be in an html file), right click on image and choose "Copy Image" and paste to the Preview app.
Steps:
- Download or have the
svgfile in your hard drive, say,somefile.svg
- Now, in the same folder, just make an html file
tmp.htmlthat contains this line:<img src="somefile.svg">
- Now, open that html file in Google Chrome
- You should see the image. Now just right click on the image and choose "Copy Image"
- Go to Mac's Preview App, and choose,
"File -> New from Clipboard"
- Now
File -> Savethe file and you have thepngfile. (or other file types).
This is tested on the current Chrome (version 48.0) on Mac OS X El Capitan.
Update: I am not sure whether it is due to some restriction imposed by Google Chrome. I just try an SVG file using Chrome 58.0, and I get a tiny image from the method above. If you see this case too, you can also use
<img src="somefile.svg" style="height: 82vh; margin-top: 9vh; margin-left: 9vh">
and you will have an image on screen good enough for you to do a screenshot -- using CmdShift4 or CmdShift3 on the Mac, for example. Make sure you resize your Chrome window to the maximum allowed on screen.
Smart solution!
– Manu
Mar 2 '16 at 15:07
This actually produces the best results for me since it renders exactly the same as the browser.
– Jason Haslam
Jan 26 '17 at 1:25
the resulting image was very poor resolution for me
– Michael
Sep 22 '17 at 16:02
Ingenious :) but for very large SVGs, the resolution of the resulting image is too low, as @Michael mentioned.
– waldyrious
Oct 23 '18 at 10:24
add a comment |
OK, I found a simple way to do it on the Mac if you have Google Chrome.
In one sentence, it is to see the svg image in a webpage (must be in an html file), right click on image and choose "Copy Image" and paste to the Preview app.
Steps:
- Download or have the
svgfile in your hard drive, say,somefile.svg
- Now, in the same folder, just make an html file
tmp.htmlthat contains this line:<img src="somefile.svg">
- Now, open that html file in Google Chrome
- You should see the image. Now just right click on the image and choose "Copy Image"
- Go to Mac's Preview App, and choose,
"File -> New from Clipboard"
- Now
File -> Savethe file and you have thepngfile. (or other file types).
This is tested on the current Chrome (version 48.0) on Mac OS X El Capitan.
Update: I am not sure whether it is due to some restriction imposed by Google Chrome. I just try an SVG file using Chrome 58.0, and I get a tiny image from the method above. If you see this case too, you can also use
<img src="somefile.svg" style="height: 82vh; margin-top: 9vh; margin-left: 9vh">
and you will have an image on screen good enough for you to do a screenshot -- using CmdShift4 or CmdShift3 on the Mac, for example. Make sure you resize your Chrome window to the maximum allowed on screen.
OK, I found a simple way to do it on the Mac if you have Google Chrome.
In one sentence, it is to see the svg image in a webpage (must be in an html file), right click on image and choose "Copy Image" and paste to the Preview app.
Steps:
- Download or have the
svgfile in your hard drive, say,somefile.svg
- Now, in the same folder, just make an html file
tmp.htmlthat contains this line:<img src="somefile.svg">
- Now, open that html file in Google Chrome
- You should see the image. Now just right click on the image and choose "Copy Image"
- Go to Mac's Preview App, and choose,
"File -> New from Clipboard"
- Now
File -> Savethe file and you have thepngfile. (or other file types).
This is tested on the current Chrome (version 48.0) on Mac OS X El Capitan.
Update: I am not sure whether it is due to some restriction imposed by Google Chrome. I just try an SVG file using Chrome 58.0, and I get a tiny image from the method above. If you see this case too, you can also use
<img src="somefile.svg" style="height: 82vh; margin-top: 9vh; margin-left: 9vh">
and you will have an image on screen good enough for you to do a screenshot -- using CmdShift4 or CmdShift3 on the Mac, for example. Make sure you resize your Chrome window to the maximum allowed on screen.
edited Jun 29 '17 at 16:29
answered Feb 7 '16 at 19:02
太極者無極而生
4,2222295158
4,2222295158
Smart solution!
– Manu
Mar 2 '16 at 15:07
This actually produces the best results for me since it renders exactly the same as the browser.
– Jason Haslam
Jan 26 '17 at 1:25
the resulting image was very poor resolution for me
– Michael
Sep 22 '17 at 16:02
Ingenious :) but for very large SVGs, the resolution of the resulting image is too low, as @Michael mentioned.
– waldyrious
Oct 23 '18 at 10:24
add a comment |
Smart solution!
– Manu
Mar 2 '16 at 15:07
This actually produces the best results for me since it renders exactly the same as the browser.
– Jason Haslam
Jan 26 '17 at 1:25
the resulting image was very poor resolution for me
– Michael
Sep 22 '17 at 16:02
Ingenious :) but for very large SVGs, the resolution of the resulting image is too low, as @Michael mentioned.
– waldyrious
Oct 23 '18 at 10:24
Smart solution!
– Manu
Mar 2 '16 at 15:07
Smart solution!
– Manu
Mar 2 '16 at 15:07
This actually produces the best results for me since it renders exactly the same as the browser.
– Jason Haslam
Jan 26 '17 at 1:25
This actually produces the best results for me since it renders exactly the same as the browser.
– Jason Haslam
Jan 26 '17 at 1:25
the resulting image was very poor resolution for me
– Michael
Sep 22 '17 at 16:02
the resulting image was very poor resolution for me
– Michael
Sep 22 '17 at 16:02
Ingenious :) but for very large SVGs, the resolution of the resulting image is too low, as @Michael mentioned.
– waldyrious
Oct 23 '18 at 10:24
Ingenious :) but for very large SVGs, the resolution of the resulting image is too low, as @Michael mentioned.
– waldyrious
Oct 23 '18 at 10:24
add a comment |
If you want to do many at once, you can:
mogrify -format png *.svg
There are options to resize etc on the fly, too..
3
mogrifyis also par of ImageMagick.
– ShreevatsaR
Jun 6 '11 at 8:19
Works great, but brutally slow.
– Meekohi
Jan 24 '14 at 21:58
-1? Someone thinks this isn't helpful? What's the error?
– DefenestrationDay
Jul 29 '14 at 20:41
I'm not the one who downvoted, but worth noting is that ImageMagick stupidly converts svg to a raster image of arbitrary size before resizing, resulting in blurry output.
– Dae
Nov 1 '15 at 19:47
add a comment |
If you want to do many at once, you can:
mogrify -format png *.svg
There are options to resize etc on the fly, too..
3
mogrifyis also par of ImageMagick.
– ShreevatsaR
Jun 6 '11 at 8:19
Works great, but brutally slow.
– Meekohi
Jan 24 '14 at 21:58
-1? Someone thinks this isn't helpful? What's the error?
– DefenestrationDay
Jul 29 '14 at 20:41
I'm not the one who downvoted, but worth noting is that ImageMagick stupidly converts svg to a raster image of arbitrary size before resizing, resulting in blurry output.
– Dae
Nov 1 '15 at 19:47
add a comment |
If you want to do many at once, you can:
mogrify -format png *.svg
There are options to resize etc on the fly, too..
If you want to do many at once, you can:
mogrify -format png *.svg
There are options to resize etc on the fly, too..
answered Apr 10 '11 at 14:12
DefenestrationDay
19915
19915
3
mogrifyis also par of ImageMagick.
– ShreevatsaR
Jun 6 '11 at 8:19
Works great, but brutally slow.
– Meekohi
Jan 24 '14 at 21:58
-1? Someone thinks this isn't helpful? What's the error?
– DefenestrationDay
Jul 29 '14 at 20:41
I'm not the one who downvoted, but worth noting is that ImageMagick stupidly converts svg to a raster image of arbitrary size before resizing, resulting in blurry output.
– Dae
Nov 1 '15 at 19:47
add a comment |
3
mogrifyis also par of ImageMagick.
– ShreevatsaR
Jun 6 '11 at 8:19
Works great, but brutally slow.
– Meekohi
Jan 24 '14 at 21:58
-1? Someone thinks this isn't helpful? What's the error?
– DefenestrationDay
Jul 29 '14 at 20:41
I'm not the one who downvoted, but worth noting is that ImageMagick stupidly converts svg to a raster image of arbitrary size before resizing, resulting in blurry output.
– Dae
Nov 1 '15 at 19:47
3
3
mogrify is also par of ImageMagick.– ShreevatsaR
Jun 6 '11 at 8:19
mogrify is also par of ImageMagick.– ShreevatsaR
Jun 6 '11 at 8:19
Works great, but brutally slow.
– Meekohi
Jan 24 '14 at 21:58
Works great, but brutally slow.
– Meekohi
Jan 24 '14 at 21:58
-1? Someone thinks this isn't helpful? What's the error?
– DefenestrationDay
Jul 29 '14 at 20:41
-1? Someone thinks this isn't helpful? What's the error?
– DefenestrationDay
Jul 29 '14 at 20:41
I'm not the one who downvoted, but worth noting is that ImageMagick stupidly converts svg to a raster image of arbitrary size before resizing, resulting in blurry output.
– Dae
Nov 1 '15 at 19:47
I'm not the one who downvoted, but worth noting is that ImageMagick stupidly converts svg to a raster image of arbitrary size before resizing, resulting in blurry output.
– Dae
Nov 1 '15 at 19:47
add a comment |
Try Apache Batik.
java -jar batik-rasterizer.jar FILES
It also supports batch conversion and has many other useful options.
add a comment |
Try Apache Batik.
java -jar batik-rasterizer.jar FILES
It also supports batch conversion and has many other useful options.
add a comment |
Try Apache Batik.
java -jar batik-rasterizer.jar FILES
It also supports batch conversion and has many other useful options.
Try Apache Batik.
java -jar batik-rasterizer.jar FILES
It also supports batch conversion and has many other useful options.
answered May 23 '13 at 3:05
Behrang
96251221
96251221
add a comment |
add a comment |
I have made svgexport using node/npm for this, it is cross-platform and can be as simple as:
svgexport input.svg output.png
This was the easiest one to use and remember by far. Also, the only one that produced a correct result in my case.
– Marko Grešak
May 9 '17 at 22:09
resulting resolution wasn't great for me.
– Michael
Sep 22 '17 at 16:22
add a comment |
I have made svgexport using node/npm for this, it is cross-platform and can be as simple as:
svgexport input.svg output.png
This was the easiest one to use and remember by far. Also, the only one that produced a correct result in my case.
– Marko Grešak
May 9 '17 at 22:09
resulting resolution wasn't great for me.
– Michael
Sep 22 '17 at 16:22
add a comment |
I have made svgexport using node/npm for this, it is cross-platform and can be as simple as:
svgexport input.svg output.png
I have made svgexport using node/npm for this, it is cross-platform and can be as simple as:
svgexport input.svg output.png
edited Nov 1 '14 at 11:03
answered Sep 27 '14 at 8:47
Ali Shakiba
15117
15117
This was the easiest one to use and remember by far. Also, the only one that produced a correct result in my case.
– Marko Grešak
May 9 '17 at 22:09
resulting resolution wasn't great for me.
– Michael
Sep 22 '17 at 16:22
add a comment |
This was the easiest one to use and remember by far. Also, the only one that produced a correct result in my case.
– Marko Grešak
May 9 '17 at 22:09
resulting resolution wasn't great for me.
– Michael
Sep 22 '17 at 16:22
This was the easiest one to use and remember by far. Also, the only one that produced a correct result in my case.
– Marko Grešak
May 9 '17 at 22:09
This was the easiest one to use and remember by far. Also, the only one that produced a correct result in my case.
– Marko Grešak
May 9 '17 at 22:09
resulting resolution wasn't great for me.
– Michael
Sep 22 '17 at 16:22
resulting resolution wasn't great for me.
– Michael
Sep 22 '17 at 16:22
add a comment |
You can also use phantomjs to render the svg. The advantage is that it renders it like a browser would since it's basically a headless WebKit.
Once you download it you need phantomjs (binary) and the rasterizer.js file from the examples folder.
phantomjs examples/rasterize.js Tiger.svg out.png
For reference, this can be installed withbrew cask install phantomjs. In my install, the examples folder was located in the path/usr/local/Caskroom/phantomjs/2.1.1/phantomjs-2.1.1-macosx/examples/.
– waldyrious
Oct 23 '18 at 10:26
add a comment |
You can also use phantomjs to render the svg. The advantage is that it renders it like a browser would since it's basically a headless WebKit.
Once you download it you need phantomjs (binary) and the rasterizer.js file from the examples folder.
phantomjs examples/rasterize.js Tiger.svg out.png
For reference, this can be installed withbrew cask install phantomjs. In my install, the examples folder was located in the path/usr/local/Caskroom/phantomjs/2.1.1/phantomjs-2.1.1-macosx/examples/.
– waldyrious
Oct 23 '18 at 10:26
add a comment |
You can also use phantomjs to render the svg. The advantage is that it renders it like a browser would since it's basically a headless WebKit.
Once you download it you need phantomjs (binary) and the rasterizer.js file from the examples folder.
phantomjs examples/rasterize.js Tiger.svg out.png
You can also use phantomjs to render the svg. The advantage is that it renders it like a browser would since it's basically a headless WebKit.
Once you download it you need phantomjs (binary) and the rasterizer.js file from the examples folder.
phantomjs examples/rasterize.js Tiger.svg out.png
answered Mar 19 '17 at 16:18
Stofke
14615
14615
For reference, this can be installed withbrew cask install phantomjs. In my install, the examples folder was located in the path/usr/local/Caskroom/phantomjs/2.1.1/phantomjs-2.1.1-macosx/examples/.
– waldyrious
Oct 23 '18 at 10:26
add a comment |
For reference, this can be installed withbrew cask install phantomjs. In my install, the examples folder was located in the path/usr/local/Caskroom/phantomjs/2.1.1/phantomjs-2.1.1-macosx/examples/.
– waldyrious
Oct 23 '18 at 10:26
For reference, this can be installed with
brew cask install phantomjs. In my install, the examples folder was located in the path /usr/local/Caskroom/phantomjs/2.1.1/phantomjs-2.1.1-macosx/examples/.– waldyrious
Oct 23 '18 at 10:26
For reference, this can be installed with
brew cask install phantomjs. In my install, the examples folder was located in the path /usr/local/Caskroom/phantomjs/2.1.1/phantomjs-2.1.1-macosx/examples/.– waldyrious
Oct 23 '18 at 10:26
add a comment |
I use this command on my linux. It should work for you as well.
mogrify +antialias -density 2000 -verbose -format png *.svg
I learned that without the "-density" argument, the bitmap would be very pixelized. Change the -density value to match your need.
2
Even with density, the conversion does not generate an image that is as sharp as a vector image. Try Apache Batik instead.
– Behrang
May 23 '13 at 3:06
add a comment |
I use this command on my linux. It should work for you as well.
mogrify +antialias -density 2000 -verbose -format png *.svg
I learned that without the "-density" argument, the bitmap would be very pixelized. Change the -density value to match your need.
2
Even with density, the conversion does not generate an image that is as sharp as a vector image. Try Apache Batik instead.
– Behrang
May 23 '13 at 3:06
add a comment |
I use this command on my linux. It should work for you as well.
mogrify +antialias -density 2000 -verbose -format png *.svg
I learned that without the "-density" argument, the bitmap would be very pixelized. Change the -density value to match your need.
I use this command on my linux. It should work for you as well.
mogrify +antialias -density 2000 -verbose -format png *.svg
I learned that without the "-density" argument, the bitmap would be very pixelized. Change the -density value to match your need.
edited Sep 5 '11 at 9:48
slhck
159k47442465
159k47442465
answered Sep 5 '11 at 8:20
BersekerBernhard
191
191
2
Even with density, the conversion does not generate an image that is as sharp as a vector image. Try Apache Batik instead.
– Behrang
May 23 '13 at 3:06
add a comment |
2
Even with density, the conversion does not generate an image that is as sharp as a vector image. Try Apache Batik instead.
– Behrang
May 23 '13 at 3:06
2
2
Even with density, the conversion does not generate an image that is as sharp as a vector image. Try Apache Batik instead.
– Behrang
May 23 '13 at 3:06
Even with density, the conversion does not generate an image that is as sharp as a vector image. Try Apache Batik instead.
– Behrang
May 23 '13 at 3:06
add a comment |
ImageMagick's convert command, using some other parameters, is what did it for me. Here's my batch Bash script solution that divides the task across multiple processes to make use of all your cores! Modify as needed.
batchConvertToSVG.sh (takes number of processes as argument):
end=$(( $1 - 1 ))
for i in `seq 0 $end`;
do
echo Spawning helper $i of $end
./convertToSvgHelper.sh $i $1 &
done
convertToSvgHelper.sh:
n=$1
for file in ./*.svg; do
filename=${file%.svg}
echo converting file named $filename
test $n -eq 0 && convert -format png -resize 74 -background transparent -density 600 $file $filename.png
n=$((n+1))
n=$((n%$2))
done
add a comment |
ImageMagick's convert command, using some other parameters, is what did it for me. Here's my batch Bash script solution that divides the task across multiple processes to make use of all your cores! Modify as needed.
batchConvertToSVG.sh (takes number of processes as argument):
end=$(( $1 - 1 ))
for i in `seq 0 $end`;
do
echo Spawning helper $i of $end
./convertToSvgHelper.sh $i $1 &
done
convertToSvgHelper.sh:
n=$1
for file in ./*.svg; do
filename=${file%.svg}
echo converting file named $filename
test $n -eq 0 && convert -format png -resize 74 -background transparent -density 600 $file $filename.png
n=$((n+1))
n=$((n%$2))
done
add a comment |
ImageMagick's convert command, using some other parameters, is what did it for me. Here's my batch Bash script solution that divides the task across multiple processes to make use of all your cores! Modify as needed.
batchConvertToSVG.sh (takes number of processes as argument):
end=$(( $1 - 1 ))
for i in `seq 0 $end`;
do
echo Spawning helper $i of $end
./convertToSvgHelper.sh $i $1 &
done
convertToSvgHelper.sh:
n=$1
for file in ./*.svg; do
filename=${file%.svg}
echo converting file named $filename
test $n -eq 0 && convert -format png -resize 74 -background transparent -density 600 $file $filename.png
n=$((n+1))
n=$((n%$2))
done
ImageMagick's convert command, using some other parameters, is what did it for me. Here's my batch Bash script solution that divides the task across multiple processes to make use of all your cores! Modify as needed.
batchConvertToSVG.sh (takes number of processes as argument):
end=$(( $1 - 1 ))
for i in `seq 0 $end`;
do
echo Spawning helper $i of $end
./convertToSvgHelper.sh $i $1 &
done
convertToSvgHelper.sh:
n=$1
for file in ./*.svg; do
filename=${file%.svg}
echo converting file named $filename
test $n -eq 0 && convert -format png -resize 74 -background transparent -density 600 $file $filename.png
n=$((n+1))
n=$((n%$2))
done
answered Jun 26 '15 at 2:48
sudo
3791216
3791216
add a comment |
add a comment |
As commented previously ImageMagick does the trick. I just wanted to add a point for GraphicsMagick, an old fork of ImageMagick that has some improvements (and much less dependency bloat when installed via fink).
add a comment |
As commented previously ImageMagick does the trick. I just wanted to add a point for GraphicsMagick, an old fork of ImageMagick that has some improvements (and much less dependency bloat when installed via fink).
add a comment |
As commented previously ImageMagick does the trick. I just wanted to add a point for GraphicsMagick, an old fork of ImageMagick that has some improvements (and much less dependency bloat when installed via fink).
As commented previously ImageMagick does the trick. I just wanted to add a point for GraphicsMagick, an old fork of ImageMagick that has some improvements (and much less dependency bloat when installed via fink).
answered Apr 26 '10 at 19:16
user31752
add a comment |
add a comment |
You can perform a batch conversion on an entire folder of SVG files to PNG. I used Inkscape command line interface to produce png files with a width of 80px.
find ~/desktop/toconvert '*.svg' -exec /Applications/Inkscape.app/Contents/Resources/bin/inkscape -z -w 80 -e "{}".png "{}" ;
png will be saved with original name *.png
add a comment |
You can perform a batch conversion on an entire folder of SVG files to PNG. I used Inkscape command line interface to produce png files with a width of 80px.
find ~/desktop/toconvert '*.svg' -exec /Applications/Inkscape.app/Contents/Resources/bin/inkscape -z -w 80 -e "{}".png "{}" ;
png will be saved with original name *.png
add a comment |
You can perform a batch conversion on an entire folder of SVG files to PNG. I used Inkscape command line interface to produce png files with a width of 80px.
find ~/desktop/toconvert '*.svg' -exec /Applications/Inkscape.app/Contents/Resources/bin/inkscape -z -w 80 -e "{}".png "{}" ;
png will be saved with original name *.png
You can perform a batch conversion on an entire folder of SVG files to PNG. I used Inkscape command line interface to produce png files with a width of 80px.
find ~/desktop/toconvert '*.svg' -exec /Applications/Inkscape.app/Contents/Resources/bin/inkscape -z -w 80 -e "{}".png "{}" ;
png will be saved with original name *.png
answered May 2 '14 at 18:25
James Matthew Mudgett
11
11
add a comment |
add a comment |
This is what I used:
brew install imagemagick --with-librsvg
Then run the following commands:
find . -type f -name "*.svg" -exec bash -c 'convert $0 $0.png' {} ;
rename 's/svg.png/png/' *
Hope it helps.
add a comment |
This is what I used:
brew install imagemagick --with-librsvg
Then run the following commands:
find . -type f -name "*.svg" -exec bash -c 'convert $0 $0.png' {} ;
rename 's/svg.png/png/' *
Hope it helps.
add a comment |
This is what I used:
brew install imagemagick --with-librsvg
Then run the following commands:
find . -type f -name "*.svg" -exec bash -c 'convert $0 $0.png' {} ;
rename 's/svg.png/png/' *
Hope it helps.
This is what I used:
brew install imagemagick --with-librsvg
Then run the following commands:
find . -type f -name "*.svg" -exec bash -c 'convert $0 $0.png' {} ;
rename 's/svg.png/png/' *
Hope it helps.
answered Dec 17 '18 at 23:46
Alan Dong
1336
1336
add a comment |
add a comment |
wkhtmltoimage (from project wkhtmltopdf) did this convert well:
wkhtmltoimage --zoom 2 foo.svg foo.png
ImageMagick renders CJK character as blank on my mac.
While this link may answer the question, it is better to include the essential parts of the answer here and provide the link for reference. Link-only answers can become invalid if the linked page changes. - From Review
– Blackwood
Dec 14 '18 at 4:09
@Blackwood fine, updated.
– georgexsh
Dec 14 '18 at 8:11
add a comment |
wkhtmltoimage (from project wkhtmltopdf) did this convert well:
wkhtmltoimage --zoom 2 foo.svg foo.png
ImageMagick renders CJK character as blank on my mac.
While this link may answer the question, it is better to include the essential parts of the answer here and provide the link for reference. Link-only answers can become invalid if the linked page changes. - From Review
– Blackwood
Dec 14 '18 at 4:09
@Blackwood fine, updated.
– georgexsh
Dec 14 '18 at 8:11
add a comment |
wkhtmltoimage (from project wkhtmltopdf) did this convert well:
wkhtmltoimage --zoom 2 foo.svg foo.png
ImageMagick renders CJK character as blank on my mac.
wkhtmltoimage (from project wkhtmltopdf) did this convert well:
wkhtmltoimage --zoom 2 foo.svg foo.png
ImageMagick renders CJK character as blank on my mac.
edited Dec 14 '18 at 8:11
answered Dec 14 '18 at 3:33
georgexsh
1095
1095
While this link may answer the question, it is better to include the essential parts of the answer here and provide the link for reference. Link-only answers can become invalid if the linked page changes. - From Review
– Blackwood
Dec 14 '18 at 4:09
@Blackwood fine, updated.
– georgexsh
Dec 14 '18 at 8:11
add a comment |
While this link may answer the question, it is better to include the essential parts of the answer here and provide the link for reference. Link-only answers can become invalid if the linked page changes. - From Review
– Blackwood
Dec 14 '18 at 4:09
@Blackwood fine, updated.
– georgexsh
Dec 14 '18 at 8:11
While this link may answer the question, it is better to include the essential parts of the answer here and provide the link for reference. Link-only answers can become invalid if the linked page changes. - From Review
– Blackwood
Dec 14 '18 at 4:09
While this link may answer the question, it is better to include the essential parts of the answer here and provide the link for reference. Link-only answers can become invalid if the linked page changes. - From Review
– Blackwood
Dec 14 '18 at 4:09
@Blackwood fine, updated.
– georgexsh
Dec 14 '18 at 8:11
@Blackwood fine, updated.
– georgexsh
Dec 14 '18 at 8:11
add a comment |
sips — scriptable image processing system. No external binaries required.
sips -s format png mypdf.pdf --out myimage.png
Here's a script I use after a session of screen captures.
PWD=`pwd`
IMAGES=`ls "$PWD"/*.tiff`
TARGET=png
for IMAGE in $IMAGES
do
SOURCE="$IMAGE"
DESTINATION=`echo "$SOURCE" | sed "s/tiff/$TARGET/g"`
sips -s format "$TARGET" "$SOURCE" --out "$DESTINATION" &2>/dev/null
done
Tried it, didn't produce any output.
– xApple
Feb 12 '13 at 13:26
3
-1 The man page clearly states sips is is used to query or modify raster image files so starting from a SVG which is what the OP was asking will not work
– RobV
Aug 22 '13 at 18:16
add a comment |
sips — scriptable image processing system. No external binaries required.
sips -s format png mypdf.pdf --out myimage.png
Here's a script I use after a session of screen captures.
PWD=`pwd`
IMAGES=`ls "$PWD"/*.tiff`
TARGET=png
for IMAGE in $IMAGES
do
SOURCE="$IMAGE"
DESTINATION=`echo "$SOURCE" | sed "s/tiff/$TARGET/g"`
sips -s format "$TARGET" "$SOURCE" --out "$DESTINATION" &2>/dev/null
done
Tried it, didn't produce any output.
– xApple
Feb 12 '13 at 13:26
3
-1 The man page clearly states sips is is used to query or modify raster image files so starting from a SVG which is what the OP was asking will not work
– RobV
Aug 22 '13 at 18:16
add a comment |
sips — scriptable image processing system. No external binaries required.
sips -s format png mypdf.pdf --out myimage.png
Here's a script I use after a session of screen captures.
PWD=`pwd`
IMAGES=`ls "$PWD"/*.tiff`
TARGET=png
for IMAGE in $IMAGES
do
SOURCE="$IMAGE"
DESTINATION=`echo "$SOURCE" | sed "s/tiff/$TARGET/g"`
sips -s format "$TARGET" "$SOURCE" --out "$DESTINATION" &2>/dev/null
done
sips — scriptable image processing system. No external binaries required.
sips -s format png mypdf.pdf --out myimage.png
Here's a script I use after a session of screen captures.
PWD=`pwd`
IMAGES=`ls "$PWD"/*.tiff`
TARGET=png
for IMAGE in $IMAGES
do
SOURCE="$IMAGE"
DESTINATION=`echo "$SOURCE" | sed "s/tiff/$TARGET/g"`
sips -s format "$TARGET" "$SOURCE" --out "$DESTINATION" &2>/dev/null
done
edited Jan 5 '13 at 8:21
answered Jan 5 '13 at 8:06
jww
4,1812474144
4,1812474144
Tried it, didn't produce any output.
– xApple
Feb 12 '13 at 13:26
3
-1 The man page clearly states sips is is used to query or modify raster image files so starting from a SVG which is what the OP was asking will not work
– RobV
Aug 22 '13 at 18:16
add a comment |
Tried it, didn't produce any output.
– xApple
Feb 12 '13 at 13:26
3
-1 The man page clearly states sips is is used to query or modify raster image files so starting from a SVG which is what the OP was asking will not work
– RobV
Aug 22 '13 at 18:16
Tried it, didn't produce any output.
– xApple
Feb 12 '13 at 13:26
Tried it, didn't produce any output.
– xApple
Feb 12 '13 at 13:26
3
3
-1 The man page clearly states sips is is used to query or modify raster image files so starting from a SVG which is what the OP was asking will not work
– RobV
Aug 22 '13 at 18:16
-1 The man page clearly states sips is is used to query or modify raster image files so starting from a SVG which is what the OP was asking will not work
– RobV
Aug 22 '13 at 18:16
add a comment |
Thanks for contributing an answer to Super User!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f134679%2fcommand-line-application-for-converting-svg-to-png-on-mac-os-x%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
1
I found a way if you have Google Chrome... and no need to install any other things: superuser.com/questions/134679/…
– 太極者無極而生
Feb 7 '16 at 19:06