I need to post-release support different display densities on Android
During development drawable-hdpi has grown to 160 png (like 20 of them 9 patch) assets
I now need to convert all those bitmaps to mdpi, ldpi (layouts and drawables XML are already fine, to avoid raising OOM on LayoutInflater
Is there any tool suitable to convert all those bitmaps in batch ?
I created a tool that can batch reisze images of different types (png, jpg, gif, svg, psd, 9-patch..). Uses hiqh quality scaling algorithms and supports certain lossless compression tools like pngcrush. There is a GUI and command line ui.
https://github.com/patrickfav/density-converter
In your case you would set the source scale factor to 2 and check "skip upscaling" also set the platform to Android.
Look at this:
just upload and get back in all pixels.
http://romannurik.github.io/AndroidAssetStudio/nine-patches.html
Android Asset Studio may be helpful, although it is not exactly what you asked for.
Final-Android-Resizer did the job for me and was simple to use but had all the options I needed: https://github.com/asystat/Final-Android-Resizer
I would recommend Respresso which is an online tool capable to create all the required sizes (from xxxhdpi to mdpi) for Android (and for iOS also).
You have to upload the images (in batch) then sync the resized/converted ones directly to your project using the tool's gradle plugin.
Please note that it will require you to create an account (for free) as it will sync any change to your project directly. (So you can add/change an image (svg, pdf, png, jpeg) and it will automatically add/change the converted files in your project at the next build.)
Currently it does not support 9 patch images.
(I should note that I worked on the tool and I think it is really cool and I use it personally. I have no shares in it.)
Here is a simple script to create lower-resolution Android drawables from higher-resolution ones.
For example, given a batch of -xhdpi images, it can generate -hdpi and -mdpi images.
With this script, it’s possible to export only highest-resolution artwork from authoring tools and then create the lower-resolution versions with a few batch commands.
Script usage:
This will take every png file from xhdpi and place lower-resolution versions into mdpi and hdpi folders.
http://kmansoft.com/2012/05/23/scale-android-drawables-with-a-script/
original script, https://gist.github.com/2771791
Script itself, to avoid dependency on github gist/original blogpost.
name drawable_convert.py