I have a recycler view on my android app main page that displays a list of pictures and I can't decide which width to give my images so that they are not too heavy but still very neat. (My images take the whole width of the screen.)
I know every Android device has a different format but I need a one-size-fits-all.
I currently have images on my res folder with width 500px (and approx. 350px height). The images weight between 30ko and 100ko. But I must admit they are not very neat ...
So I guess I have to pack pictures with a greater width to gain quality, but I have no idea how much.
How does Instagram does it ? Pictures are always very neat, how do they do this ? What are the characteristics of their pictures ? I guess they weight a ton, no ? (like 500ko per image ?) or am I wrong ?
There are utilities ('Image Optimizers') that shrink jpeg images without any significant quality loss, you can find some of them on Google for manual use.
When showing a lot of images, you can use a library such as Compressor to do this for you. I believe that apps such as Instagram might have their own code but same same. The file sizes are usually 15-300 kb, depending on the 'complexity' of the image.
After spending quite some time testing on different sizes and weights, my conclusion is that 500px wide images are not displayed very well on devices in general when you want to have image that take the whole width of the phone. But you can have light images (between 30Ko and 80Ko).
Below 500px width is not a good idea.
When you go up to 1000px wide images, you get a whole better quality, that gives your app a better look and feel in my opinion. But obviously images are somewhat bigger (between 80 and 190Ko)
When you go up to 1500px wide images, you have to be careful to the weight of the image. I wouldn't recommand having images that weight more than 200 Ko. But at least you got very good quality ... which is something nice :D
I hope that could help
Related
I am very new to ImgScalr API.I need to resize my images to different views, one of them being a mobile view and second a thumbnail view.
I have made use of the resize method, but have a doubt. Which is the best of the resize method to resizing the image out of the multiple options available that keeps the proper aspect ratio(as in the image doesnt become blurred)
One thing I noticed was that every resize method takes in a targetSize argument. How does specifiying this field make sure that the aspect ratio of the image does not get affected.
What should the ideal arguments to the resize method be, given that I need to generate a 2 KB thumbnail view of my input image that may be of size of around 2 MB.
I am a bit confused because of the lack of enough documentation and examples.
imgscalr author here - definitely understand the confusion, the code base itself (if you happen to glance at GitHub) is almost 50% comments if you are curious how the library works, but from a usage perspective you are right - I didn't put a lot of time into examples.
Hopefully I can hit some highlights quickly for you...
Aspect Ratios
A core design tenant of imgscalr is to always honor the aspect ratio - so if you pass in 200x1 (some ridiculous dimension as an example) it will attempt to calculate the minimum dimension that will meet those 'target' dimensions.
This is handy if you always want your thumbnails in a certain box, like 200x200 -- just pass that in and imgscalr will determine a final width/height that won't be bigger than that (possibly something like 200x127 or 78x200)
Quality
By default the library does what is called a 'balanced' approach to quality by considering the delta in dimension change as well as scaling up/scaling down and chooses the most approach approach (speed VS quality).
You can force it to always scale as quickly as possible (good idea for scaling up operations) or can force it to always use high or ultra quality (good idea if you want really crisp thumbnails or other operations that drastically reduce the image resolution and you want them to still look decent)
On top of that you can also ask the library to apply some additional filtering to the image (called Image Ops) -- I ship some handy defaults out of the box like the anti-aliasing one if you are getting jagged edges on a lot of source material you are scaling (common when scaling screenshots of desktops and other things with diag straight lines)
Overall
The library is meant to be as simple as possible to use, something no harder than:
BufferedImage thumbnail = Scalr.resize(src, 128);
will get you started... all the other operations around quality, fitting, modes, ops, etc. are just additional things you can chose to do if you decide the result isn't quite what you wanted.
Hope that helps!
I am working on a photobooth type app for iPhone and Android. On iPhone, I know the exact resolution of the front camera, and am able to always output 4 mini pics predictably and make a photostrip from them. But for Android, I need a way to resize 4 images I have taken to a width of 48px and height of 320px per image. This way, I can build the same size photostrip I built for the iPhone version, and easily display the photostrips in a consistent manner on a website (I don't want the size of them to vary depending on platform). On Android, how can I resize to that resolution (48x320), even if the Android camera doesn't output that aspect ratio? Basically, I'd like to resize on Android, and have it automatically zoom as necessary until 48x320 is reached and it doesn't look stretched/distorted...I'm ok with part of the image (like the outside border) being lost in favor of getting a 48x320 image. Maybe this is just a straight Java question...
Thanks so much!
I have a widget with ViewFlipper that flips between X number of images. I aim for 10 images to be flipped, and I can do this if I load very small images. My widget is size 4x2 and I want to display images with good quality, but I can't achieve this. Everything loads fine, no exceptions, but the widget never displays them. If I load very small image sizes (100x100 px), it starts flipping them. If I load larger image size (300x300), it won't start flipping the images until I reduce the number of images (flips) to 4.
This suggests a memory limitation to me, but I would expect an exception to be thrown somewhere after I do appWidgetManager.updateWidget(widgetId, remoteViewFlipper).
Going through the logs, I don't see anything nearly related to this.
I think it depends on concrete implementation of launcher - widget stuff is hosted and processsed there. You updtes are send as parcelables, so there soule be data size limit as well:
http://groups.google.com/group/android-developers/browse_thread/thread/26ce74534024f41a?pli=1
I'm getting into app/game development for android and I just wanted to know how hard it is to make your games work with all phones. or do the phones just scale the app to fit with the screens? thanks for any help
Screen resolution isn't as big a problem as the differences in screen ratios and defining things like touch-area sizes.
The commonest devices that my games and apps are running on have the following sizes...
320x480 (4x6)
480x800 (3x5)
480x854 (it defies belief to try to give a ratio to that nonsense)
I use AndEngine and libgdx - both will scale automatically BUT I have to choose a ratio to work with and it will crop (with black bars rather than lost content) on devices which don't share that ratio (for reference I choose to crop lower-resolutions as I think people with nicer screens would complain sooner!!)
Actual physical screen sizes vary too - and you have to bear-in-mind that a box which may seem big enough to hit on a 4.3" high-density phone could be near-impossible to hit on a smaller/lower-density device...
Both of those things are far more worrying than scaling...
You should remember that screen resolution is only one of many factors deciding about game compatibility.
I think this video is a good for start
http://www.google.com/events/io/2011/sessions/building-aggressively-compatible-android-games.html
This may not be explained the best but here it goes.
I have a window of 2 by 2 square icons. I found a custom layout script that spaces these equally on the screen. These 4 icons consist of a square background with a little image and title.
At the moment the width and height are defined in dp. But that stretches or shrinks the text. I am assuming I need to use fixed values. I understand that there are 4 generalised screen resolutions.
My question is, for small I would have to set the width and heights to x and y, but when the screen gets bigger due to larger devices I would have to increase x and y to keep some sort of continuity.
Is there a minimum and maximum width and height of screens for each size? How do other people get around these issues.
Sorry if it is a bit broad and sweeping, but I am new to creating dynamic (ish) displays for multiple resolutions.
Any help and advice will be greatly appreciated.
Google has actually documented this well. When you load your images in your res folder, you will need to simply put high, medium, and low res versions of your file into the file with the same name (but with hdpi and so forth appended to the name of the file). Android will handle which file to choose based on the screen size. I could go through how to do this, but this link covers the details of what I'm talking about in greater detail. Also, check out this question I answered a while back. It has a lot to do with your question.