Skip to content

Instantly share code, notes, and snippets.

@simonharrer
Created August 5, 2015 12:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save simonharrer/fb0656957b0e3a12a9ae to your computer and use it in GitHub Desktop.
Save simonharrer/fb0656957b0e3a12a9ae to your computer and use it in GitHub Desktop.
How to convert a SVG to a PNG in a gradle build script.
configurations {
rasterizer
}
dependencies {
rasterizer 'org.apache.xmlgraphics:batik-rasterizer:1.7'
rasterizer 'org.apache.xmlgraphics:batik-codec:1.7'
}
task svg2png(type: org.gradle.api.tasks.JavaExec) {
classpath configurations.rasterizer
main "org.apache.batik.apps.rasterizer.Main"
// -scriptSecurityOff required as the security manager of batik would interfere with the security manager of gradle
args "-scriptSecurityOff", "-d", "src/main/resources/images/splash.png", "-m", "image/png", "src/graphics/splash/splash-release.svg"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment