Friday, June 1, 2012

Re: [android-developers] Svg to hdpi, mdpi, ldpi

If you are just blindly scaling images, it is worth thinking about whether it is worth including them as separate densities.  If you don't provide the appropriate density, Android will at the point of loading the drawable generally scale it to match the density it needs.  So if you do things right, you will take some overhead at load time for the scaling but that is it.

Of course there is an unfortunate trade-off -- if you do this you will want to include the highest-density images, but devices with lower-density screens tend to be the lower-end ones and you are then putting more of a burden on them when loading the asset.  I don't think it should be too much of a problem, though I haven't tried it extensively.

The other negative is that the device's run-time scaling is not going to be as good as the stuff you will get with high quality time-insensitive graphics manipulation on a desktop machine.

And in either case you need to be careful with 9-patches.  Well if you are doing the scaling yourself, you of course need to be careful that the marks around the edge stay at one pixel in size.  And if you are letting the device do the scaling, it is not hard to make 9-patches that when scaled have bad artifacts.  For example, you would want to make sure that every section as at least 2 pixels in size so that they don't disappear when scaled, and more than that if you are going to let things scale by more than 2x down.

On Fri, Jun 1, 2012 at 4:38 PM, Fred Niggle <fred.niggle@googlemail.com> wrote:
If your running Ubuntu there is a magic little program in the software center called Phatch which will batch edit images - simply start with a large hi-res version of the icon, and run phatch with the actions set as you need - it saves a lot of time.



On 1 June 2012 23:37, Kostya Vasilyev <kmansoft@gmail.com> wrote:
On 06/02/2012 02:31 AM, Jeremy Villalobos wrote:
It would be nice to have a folder for svg's on the Android project (Eclipse), and have a tool that automatically creates the icons for each screen based on the svg provided by the designer.

On build, the plugin creates the png's from the svg's, but the svgs are not added to the release package.

Is there such a tool ?

FWIW, I save my artwork as PNGs at -xhdpi resolution and then run a script to update the lower-res versions:

http://kmansoft.com/2012/05/23/scale-android-drawables-with-a-script/

Supposedly you can do svg to png conversion with ImageMagick, or with Inkscape:

http://stackoverflow.com/questions/9530524/imagemagick-convert-svg-to-transparent-png-with-antialiasing

So, with just a little scripting, it should be possible to do what you're after.

-- K

--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en



--
Magnetic Door Alarm app is now available in Google Play

--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en



--
Dianne Hackborn
Android framework engineer
hackbod@android.com

Note: please don't send private questions to me, as I don't have time to provide private support, and so won't reply to such e-mails.  All such questions should be posted on public forums, where I and others can see and answer them.

--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

No comments:

Post a Comment