Skip to content
ImageGrinder: Image manipulation for Gradle
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.ci
gradle
images
src
.gitignore
.travis.yml
CHANGES.md
CODE_OF_CONDUCT.md
CONTRIBUTING.md
LICENSE.txt
PULL_REQUEST_TEMPLATE.md
README.md
build.gradle
gradle.properties
gradlew
gradlew.bat

README.md

ImageGrinder:
image manipulation for Gradle

Gradle plugin Maven central

Changelog Javadoc Travis CI Live chat License Apache

Simple image processing

To use it, just add image-grinder to your buildscript, and configure it as so:

imageGrinder {
    // creates a task called 'processEclipseSvg', you can name it whatever you want
    // if the name starts with 'process', then the 'processResources' task will depend on it
    processEclipseSvg {
        srcDir = file('src')
        dstDir = file('dst')
        grinder { img ->
            img.render('.png')
            img.render('@2x.png', 2)
        }
        // used for up-to-date checking, bump this if the function above changes
        bumpThisNumberWhenTheGrinderChanges = 1
    }
}

Every single file in srcDir needs to be an image that ImageGrinder can parse. Each image will be parsed, and wrapped into an Img. Call its methods to grind it into whatever you need in the dstDir.

ImageGrinder uses the gradle Worker API introduced in Gradle 4.1 to use all your CPU cores for grinding. It also uses gradle's incremental task support to do the minimum amount of grinding required.

Limitations

  • ImageGrinder can only read SVG images.
  • ImageGrinder can only write PNG images.
  • ImageGrinder needs Gradle 4.1 or higher.

Not much of a grinder, but it does everything we needed. If you need more, we're happy to take PR's!

Acknowledgements

You can’t perform that action at this time.