Creating images with Android Asset Studio using iPhone images - android

I have the iPhone / iPad images from an already created application.
Now I would like to create the images for Android using the tool
Android Asset Studio.
Which is the best approach ?
Creating the Android images using the images from iPhone 6 Plus (#3x)?
Using the images from the iPhone 6 and iPhone 5 (#2x)?
Or from iPad 2 and iPad mini (#1x)?

For better results, all of them.
1x images should go into the drawable folder.
2x ones into the drawable-xhdpi folder, and
3x ones into the drawable-xxhdpi folder.
In alternative, to save some apk size, you could use only the 3x ones and put them into the drawable-xxhdpi folder.
Android will do its best to scale them down.

Related

Image with different dimensions?

android studio 3.6
In android app I use one image with different dimensions. I put image in the next folders:
drawable-hdpi, drawable-mdpi, drawable-xhdpi, drawable-xxhdpi, drawable-xxxhdpi
Nice. It's work fine.
Now what about flutter app. Is I also need to create different folders for every image's dimension?
P.S. I need this image for android and iOS version
As mentioned in the Declaring resolution-aware image assets. You can create folders based on the resolution and add images to it.
The main asset is assumed to correspond to a resolution of 1.0. For
example, consider the following asset layout for an image named
my_icon.png:
.../my_icon.png
.../2.0x/my_icon.png
.../3.0x/my_icon.png
On devices with a device pixel ratio of 1.8, the asset
.../2.0x/my_icon.png would be chosen. For a device pixel ratio of 2.7,
the asset .../3.0x/my_icon.png would be chosen.
Reference Assets and Images
For an Android App created using Flutter, You can still use these folders as shown below for varying screen densities

Converting SVG into Raster PNGs by Android Studio

I am working with Android Studio 2.2.2. I am developing a project and it will be used in Tab 7 inch.
I am importing SVG through vector asset wizard. My tablet, where I am compiling the APK is 7-inch. After installation, the application showing the SVGs in very bad quality.
I made several types of research and concluded that my Tablet is having API-19 and android studio is converting all SVGs into the Raster PNGs (For all devices below V-21) at compile time and place them on the following path
D:....\app\build\generated\res\pngs\debug
When I looked at this folder I found
I know for 7-inch Tablet drawable-large-mdpi or drawable-large-hdpi is required, because android studio is not creating the drawable folder for larger screens and placing the Raster PNGs into smal screens drawable folder, That's may be the reason of bad quality of SVGs because 7-inch tablet is using the PNG from drawable-mdpi which is made for small screens.
Can anyone advice how to force Android-Studio to create drawable-large-mdpi folder under app\build\generated\res\pngs\debug and place the converted Raster PNG into it.

App Crashes. Error Inflating XML. Cant find image because xxxhdpi folder is not there

Switched my eclipse project to Android studio. I was maintaining resources under drawable-mdpi folder only. Now in studio the preview of XML loads images correctly. However when I run the app in a device with resolution higher than mdpi the app crashes, shows error inflating binary XML.
After a long analysis I found the issue that the device was trying to load images from its corresponding density folder which is not available. So I created the folder drawable-xhdpi and put images in that folder. Now the app works fine.
Why android studio can't pick image from other density drawable folder and resize which is possible by eclipse. I can't maintain 5 different drawable folders because there are lots of images.
you have to add "drawable-hdpi" resource directory and paste all the hdpi resources there because currently 70% android devices supports hdpi resolution images.
if you only maintain the hdpi, then it is also ok.
android manages all remaining resouces from hdpi resouce directory.
Android application resource directories provide different layout designs for different screen sizes and different drawables. These different drawables are used by android to support a major range of all the android devices present out there. It's a standard practice to put your resources considering these densities. Coming back to your query:
Why android studio can't pick image from other density drawable folder and resize which is possible by eclipse. I can't maintain 5 different drawable folders because there are lots of images.
For your case,In order to maintain this you could create a drawable with nodpi and put your all resources there. nodpi focus resources for all densities.Your resources should be density-independent resources. The system does not scale resources tagged with this qualifier, regardless of the current screen's density.
Hope this will clear your doubts, for more insight you can also look this.
you don't need to add all images to each difference size folder but depending the size of the image you might need to add images to different folders.
simple example is this can occour once you add high res/size images in normal drawble folder
Skipped 100 frames! The application may be doing too much work on its main thread.
This might not crash your app but will make it's performance down.
and
Different density folders were added later on for Android which means that...
If you wanted to be lazy and just add one asset the best choice would probably be the HDPI asset if your min app target < 8 and XHDPI if its >= 8. This is because the system will scale the resource up and down, but you would still want to start off with the highest resolution possible.
If you want to have complete control over how the assets are scaled then you can by all means provide your own for all / some of the densitys. In practise I generally provide HDPI / XHDPI as above and give all the resource buckets for things like logos / AB icons / App icons etc. I generally find the auto scaling to be pretty good and work for most situations, but will occasionally have to supply and extra LD/MD asset if its a small asset / contains small text etc. Plus if i duplicated all assets for things like XXXHDPI I would get pretty good apk bloat.
You can also use IDEs built in tools to add a single asset for many densitys at once. In Android Studio 0.6 this is File->New->Image Asset and a wizard will appear.
I have never noticed or heard of any perfomance impact of allowing Android to scale assets automatically - presumably this is done in hardware.
It may not look great when auto scaling down to LDPI say so you can optionally provide your own scaled assets for all other densities.
taken from : https://developer.android.com/guide/topics/resources/providing-resources.html#AlternativeResources
Do we need to add all images with different dpi to Android Apps

Correct image drawable folder for Galaxy tab

My Android application is not loading the correct graphic images when running on a Galaxy tab 1.0. They look blurry and slightly pixelated.
My guess is that it is loading the images from the mdpi folder, because the device density is 1.0, but they are small for the tablet screen.
What should I do in this case? I don't want to increase the size of the images in the mdpi folder, because I have tested the application in a fair quantity of emulators and devices and it worked well, but I still want a way of loading bigger images for the tablet.
The device model is GT-P7510 and Android version is 3.1. The density of the device is 1.0, which I got using the code:
getResources().getDisplayMetrics().density
I have different image sizes placed in the folders:
drawable-hdpi
drawable-ldpi
drawable-mdpi
drawable-xhdpi
I am developing in API level 8, platform 2.2.
Thanks!
you should probably create
res/drawable-large-mdpi/
and put resources for large screens there. Instead of large you may evaluate to use other qualifiers, such as drawable-sw600dp,
see http://developer.android.com/guide/practices/screens_support.html and http://developer.android.com/guide/topics/resources/providing-resources.html#BestMatch

Android - Adding Images To Project

I am brand new to Android and I am using Eclipse ADT to create a simple application. This application has a button that changes it's background image based on user clicks.
I noticed that there are 4 folders for images in my project: drawable-hdpi, drawable-ldpi, drawable-mdpi, and drawable-xhdpi.
and I also noticed that the images that are in there currently (the launcher icon) are all different sizes.
Does this mean that I have to use some image editing software to create one image for each resolution for each of my images? Or (hopefully) is there a way to import an image and have this done for me automatically?
Thanks!
Images and other visual files are stored in one or more drawable directories. If only in one directory, Android will scale the image as needed. If more than one directory is used, Android will select the appropriately sized image.
drawable-ldpi - Low density images
drawable-mdpi - Medium density images
drawable-hdpi - High density images
drawable-xhdpi - Extra high density images (i.e. retina-like displays)
drawable-xxhdpi - Extra extra high density images (devices like Nexus 10, Samsung Galaxy S4, HTC One and Sony Xperia Z)
drawable-xxxhdpi - Triple extra high density images (Nexus 6 and 9)
(Side note: XML files can also be written and stored as drawables. These kinds of files can control when multiple images are to be used based on the state of a view, or other visual settings like gradients, borders, etc.)
So, what should you do?
For best results (from the Android developer docs):
To generate these images, you should start with your raw resource in vector format and generate the images for each density using the following size scale:
xxxhdpi: 4.0
xxhdpi: 3.0
xhdpi: 2.0
hdpi: 1.5
tvdpi: 1.33 (TVs only)
mdpi: 1.0 (baseline)
ldpi: 0.75
This means that if you generate a 200x200 image for xhdpi devices, you should generate the same resource in 150x150 for hdpi, 133x133 for tvdpi, 100x100 for mdpi, and finally a 75x75 image for ldpi devices.
If you just want to use one image and let Android scale for you:
More than 75% of Android devices now have hdpi or greater resolutions, according to the Dashboard on the Android Developer site. So if you create one image at hdpi, for example, it will look perfect on about a third of devices, scale up for some, and scale down for about 25% of devices. In general I think you'd be better off scaling down than scaling up, too.
Does this mean that I have to use some image editing software to create one image for each resolution for each of my images? Or (hopefully) is there a way to import an image and have this done for me automatically?
If you already have high resolution sources (or vector graphic formats) of your images, you can use the Android Asset Studio to generate icons/images from your own source images for every density (minus xxhdpi). You can also create icons/images from default Android clipart, that can be themed for various versions of Android. This will save you some of the hassle of resizing and saving with an image editing tool.

Categories

Resources