mariotaku/imgenie-plugin


Download


Step 1. Add the JitPack repository to your build file

Add it in your root settings.gradle at the end of repositories:

	dependencyResolutionManagement {
		repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
		repositories {
			mavenCentral()
			maven { url 'https://jitpack.io' }
		}
	}

Add it in your settings.gradle.kts at the end of repositories:

	dependencyResolutionManagement {
		repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
		repositories {
			mavenCentral()
			maven { url = uri("https://jitpack.io") }
		}
	}

Add to pom.xml

	<repositories>
		<repository>
		    <id>jitpack.io</id>
		    <url>https://jitpack.io</url>
		</repository>
	</repositories>

Add it in your build.sbt at the end of resolvers:

 
    resolvers += "jitpack" at "https://jitpack.io"
        
    

Add it in your project.clj at the end of repositories:

 
    :repositories [["jitpack" "https://jitpack.io"]]
        
    

Step 2. Add the dependency

	dependencies {
		implementation 'com.github.mariotaku:imgenie-plugin:0.2.6'
	}
	dependencies {
		implementation("com.github.mariotaku:imgenie-plugin:0.2.6")
	}
	<dependency>
	    <groupId>com.github.mariotaku</groupId>
	    <artifactId>imgenie-plugin</artifactId>
	    <version>0.2.6</version>
	</dependency>

                            
    libraryDependencies += "com.github.mariotaku" % "imgenie-plugin" % "0.2.6"
        
        

                            
    :dependencies [[com.github.mariotaku/imgenie-plugin "0.2.6"]]
        
        

Readme


Say goodbye to manually updating drawable assets!


ImGenie is a gradle plugin for Android projects, it automatically converts many kind of images to drawable/mipmap resources.

Usage

Add dependencies to your build.gradle:

apply plugin: 'com.android.application'
// Add plugin
apply plugin: 'imgenie'

buildscript {
    repositories {
        // Add jitpack repo
        maven { url 'https://jitpack.io' }
    }

    dependencies {
        // Add plugin classpath
        classpath 'com.github.mariotaku:imgenie-plugin:0.0.5' 
    }
}

Place images to src/*/images just like how you put normal drawable files:

src/main/images/
├── drawable
│   ├── bg_foo.svg
├── drawable-mdpi
│   ├── ic_action_foo.svg
├── mipmap-mdpi
│   ├── ic_launcher.pdf
└── mipmap-xxhdpi
    └── bg_bar.png

...aaaand that's done!

Features

  • Generate drawables from svg/pdf/png/jpg images
  • Override output format by filename: bg_output_to_jpeg.jpg.svg

Caveats

  • If image placed in folders without density configuration e.g. drawable/, no other densities will be generated.
  • You may need to perform clear task if you deleted image files.