Converting SVG to PNG without interpolating colors[Resolved]
Posted: 2014-10-28T09:56:11-07:00
Version: ImageMagick 6.8.9-8 Q16 amd64 2014-10-21 (Unix)
I have simple SVG images with very few colors, and want to convert them to PNGs with the same number of colors. Every attempt that I make will either interpolate (and make new colors), or badly distort the colors. Here's some things I've tried:
Output:
Of all those images, only the first (which has 34 colors) looks right:
I have simple SVG images with very few colors, and want to convert them to PNGs with the same number of colors. Every attempt that I make will either interpolate (and make new colors), or badly distort the colors. Here's some things I've tried:
Code: Select all
url=http://upload.wikimedia.org/wikipedia/commons/9/9d/FedEx_Express.svg
convert $url fedex00.png
convert -colors 3 $url fedex01.png
convert -colors 3 -resize 50% $url fedex02.png
convert -colors 3 -resize 200% $url fedex03.png
convert -resize 200% -colors 3 $url fedex04.png
convert -colors 3 -resize 200% -colors 3 $url fedex05.png
for i in fedex*.png; do identify -format %k $i; echo " $i";done
Code: Select all
34 fedex00.png
3 fedex01.png
381 fedex02.png
2259 fedex03.png
3 fedex04.png
3 fedex05.png