What is Android Image Resizer?

Android Image Resizer is a tool to automate android project image files resizing for all screen density supported by your app.

For example a image in res/drawable/xhdpi with 200x200px as a base file will be resized to :

  • res/drawable/hdpi with 150×150 px
  • res/drawable/mdpi with 100×100 px
  • res/drawable/ldpi with 75×75 px

Install Instructions

gem install android_img_resizer

Note: For Mac OSX you need to install rimagick first. Please follow the instructions described in this page rimagick

How To use it

In a Android Project directory (PATH that has a AndroidManifest.xml) please type:

To list all drawable resource imagefiles

android_img_resizer list [xhdpi|hdpi]

To Resize a resource image File

android_img_resizer img <image_file> [xhdpi|hdpi]

To Resize all resource image files

android_img_resizer all [xhdpi|hdpi]

Note: by default Android Image resizer will use xhdpi as base image file.

To use hdpi as base image file please type hdpi in the optional argument

Resize a image example:

cd /home/john/WorkSpace/smssheduler
android_img_resizer img ic_home_log.png
OUTPUT:
Resizing Image = ic_home_log.png with size = 64×64
Image = ic_home_log.png hdpi = 48×48
Image = ic_home_log.png mdpi = 32×32
Image = ic_home_log.png ldpi = 24×24

Resize all images example:

cd /home/john/WorkSpace/smssheduler
android_img_resizer all xhdpi
OUTPUT:
Resizing Image = ic_micro_site.png with size = 64×64
Image = ic_micro_site.png hdpi = 48×48
Image = ic_micro_site.png mdpi = 32×32
Image = ic_micro_site.png ldpi = 24×24
Resizing Image = ic_micro_logo.png with size = 64×64
Image = ic_micro_logo.png hdpi = 48×48
Image = ic_micro_logo.png mdpi = 32×32
Image = ic_micro_logo.png ldpi = 24×24
…..

License and copyright

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the “Software”), to
deal in the Software without restriction, including without limitation the
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
sell copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

Contributions are welcome ! The project is mainly missing documentation and examples…

Bearstouch Team