Monday, April 11, 2016

SVG to PNG using Inkscape

I really like to use Inkscape to generate Icon for iOS or Android.
When using SVG you can create multiple size icons all looking great using a small script like this one


@echo off
SETLOCAL
set Programs="%ProgramFiles%"
if "%ProgramFiles(x86)%" NEQ "" (
    set Programs="%ProgramFiles(x86)%"
)
REM Trim the double-quotes
set Programs=%Programs:~1,-1%

SET INKSCAPE=%Programs%\Inkscape\Inkscape.com

echo.%~dp0
echo.%INKSCAPE%
pause
pushd  graphics
"%INKSCAPE%" --export-png=target.png --export-area-drawing source.svg  -w 48 -h 48
popd

ENDLOCAL

No comments: