{"id":20713857,"url":"https://github.com/diffplug/image-grinder","last_synced_at":"2025-07-30T19:13:33.672Z","repository":{"id":47284828,"uuid":"104089371","full_name":"diffplug/image-grinder","owner":"diffplug","description":"ImageGrinder: Image manipulation for Gradle","archived":false,"fork":false,"pushed_at":"2021-12-16T22:31:38.000Z","size":837,"stargazers_count":2,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-11T06:49:43.429Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/diffplug.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGES.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE.txt","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-09-19T14:57:51.000Z","updated_at":"2021-12-16T22:31:41.000Z","dependencies_parsed_at":"2022-08-28T16:23:37.052Z","dependency_job_id":null,"html_url":"https://github.com/diffplug/image-grinder","commit_stats":null,"previous_names":[],"tags_count":12,"template":false,"template_full_name":null,"purl":"pkg:github/diffplug/image-grinder","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/diffplug%2Fimage-grinder","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/diffplug%2Fimage-grinder/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/diffplug%2Fimage-grinder/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/diffplug%2Fimage-grinder/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/diffplug","download_url":"https://codeload.github.com/diffplug/image-grinder/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/diffplug%2Fimage-grinder/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":260838516,"owners_count":23070604,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-17T02:27:47.964Z","updated_at":"2025-06-19T22:07:03.936Z","avatar_url":"https://github.com/diffplug.png","language":"Java","readme":"# \u003cimg align=\"left\" src=\"images/image-grinder.png\"\u003eImageGrinder:\u003cbr\u003eimage manipulation for Gradle\n\n\u003c!---freshmark shields\noutput = [\n    link(shield('Gradle plugin', 'plugins.gradle.org', 'com.diffplug.image-grinder', 'blue'), 'https://plugins.gradle.org/plugin/com.diffplug.image-grinder'),\n    link(shield('Maven central', 'mavencentral', 'available', 'blue'), 'https://search.maven.org/artifact/com.diffplug.gradle/image-grinder'),\n    link(shield('Apache 2.0', 'license', 'apache-2.0', 'blue'), 'https://tldrlegal.com/license/apache-license-2.0-(apache-2.0)'),\n    '',\n    link(shield('Changelog', 'changelog', versionLast, 'brightgreen'), 'CHANGES.md'),\n    link(shield('Javadoc', 'javadoc', 'yes', 'brightgreen'), 'https://javadoc.io/doc/com.diffplug.gradle/image-grinder/{{versionLast}}/index.html'),\n    link(shield('Live chat', 'gitter', 'chat', 'brightgreen'), 'https://gitter.im/diffplug/image-grinder'),\n    link(image('CircleCI', 'https://circleci.com/gh/diffplug/image-grinder.svg?style=shield'), 'https://circleci.com/gh/diffplug/image-grinder')\n    ].join('\\n');\n--\u003e\n[![Gradle plugin](https://img.shields.io/badge/plugins.gradle.org-com.diffplug.image--grinder-blue.svg)](https://plugins.gradle.org/plugin/com.diffplug.image-grinder)\n[![Maven central](https://img.shields.io/badge/mavencentral-available-blue.svg)](https://search.maven.org/artifact/com.diffplug.gradle/image-grinder)\n[![Apache 2.0](https://img.shields.io/badge/license-apache--2.0-blue.svg)](https://tldrlegal.com/license/apache-license-2.0-(apache-2.0))\n\n[![Changelog](https://img.shields.io/badge/changelog-2.2.2-brightgreen.svg)](CHANGES.md)\n[![Javadoc](https://img.shields.io/badge/javadoc-yes-brightgreen.svg)](https://javadoc.io/doc/com.diffplug.gradle/image-grinder/2.2.2/index.html)\n[![Live chat](https://img.shields.io/badge/gitter-chat-brightgreen.svg)](https://gitter.im/diffplug/image-grinder)\n[![CircleCI](https://circleci.com/gh/diffplug/image-grinder.svg?style=shield)](https://circleci.com/gh/diffplug/image-grinder)\n\u003c!---freshmark /shields --\u003e\n\n\u003c!---freshmark javadoc\noutput = prefixDelimiterReplace(input, 'https://javadoc.io/doc/com.diffplug.gradle/image-grinder/', '/', versionLast);\n--\u003e\n\n## Simple image processing\n\nTo use it, just [add image-grinder to your buildscript](https://plugins.gradle.org/plugin/com.diffplug.image-grinder), and configure it as so:\n\n```groovy\nimageGrinder {\n    // creates a task called 'processEclipseSvg', you can name it whatever you want\n    // if the name starts with 'process', then the 'processResources' task will depend on it\n    processEclipseSvg {\n        srcDir = file('src')\n        dstDir = file('dst')\n        grinder { img -\u003e\n            img.render('.png')\n            img.render('@2x.png', 2)\n        }\n        // used for up-to-date checking, bump this if the function above changes\n        bumpThisNumberWhenTheGrinderChanges = 1\n    }\n}\n```\n\nEvery single file in `srcDir` needs to be an image that ImageGrinder can parse.  Each image will be parsed, and wrapped into an [`Img`](https://javadoc.io/doc/com.diffplug.gradle/image-grinder/2.2.2/com/diffplug/gradle/imagegrinder/Img.html). Call its methods to grind it into whatever you need in the `dstDir`.\n\nImageGrinder uses the gradle [Worker API](https://docs.gradle.org/6.6/userguide/custom_tasks.html#worker_api) to use all your CPU cores for grinding, the [buildcache](https://docs.gradle.org/6.6/userguide/build_cache.html) to minimize the necessary work, and it also supports the [configuration cache](https://docs.gradle.org/6.6/userguide/configuration_cache.html) for near-instant startup times. It does not currently support [incremental update](https://docs.gradle.org/6.0/userguide/custom_tasks.html#incremental_tasks), but if you go back to `2.1.3` you can get that back in return for losing the configuration cache (see [#9](https://github.com/diffplug/image-grinder/pull/9) for details).\n\n\n## Configuration avoidance\n\nThe plugin creates tasks eagerly. If you wish to avoid this, you can rewrite the example above like this:\n\n```gradle\ndef processEclipseSvg = tasks.register('processEclipseSvg', com.diffplug.gradle.imagegrinder.ImageGrinderTask) {\n    srcDir = file('src')\n    dstDir = file('dst')\n    grinder { img -\u003e\n        img.render('.png')\n        img.render('@2x.png', 2)\n    }\n    // used for up-to-date checking, bump this if the function above changes\n    bumpThisNumberWhenTheGrinderChanges = 1\n}\ntasks.named(JavaPlugin.PROCESS_RESOURCES_TASK_NAME) {\n  dependsOn processSvg\n}\n```\n\n## Limitations\n\n- ImageGrinder can only read SVG images.\n- ImageGrinder can only write PNG images.\n- ImageGrinder needs Gradle 6.0 or higher.\n\nNot much of a grinder, but it does everything we needed.  If you need more, we're [happy to take PR's](CONTRIBUTING.md)!\n\n\u003c!---freshmark /javadoc --\u003e\n\n## Acknowledgements\n\n* [Tony McCrary](https://github.com/enleeten) and [l33t labs](http://www.l33tlabs.com/) for their [org.eclipse.ui.images.renderer](https://github.com/tomsontom/org.eclipse.ui-split/tree/0402ebd10a57f9c2ca5cd2da3479470f98f70973/bundles/org.eclipse.ui.images.renderer) maven plugin.\n* Maintained by [DiffPlug](https://www.diffplug.com/).\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdiffplug%2Fimage-grinder","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdiffplug%2Fimage-grinder","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdiffplug%2Fimage-grinder/lists"}