Working on an Application that displays images in various sizes as grids, lists (Instagram like), images that take up the whole screen.
Ex. - you might have is a grid view image (not very big), but also this same image is shown in another screen that's almost the size of the entire screen. It's like a blown up version of this. There are also the smaller thumbnails of these images.
Working with the Backend team to come up with an optimal solution.
Questions:
What's the most optimal way to handle images for different screen sizes? I know instagram sends the URLs for high resolution low resolution and thumbnails.
Do we need multiple sizes for each image? example. grid view (do we need a 1x, 2x or 3x) for each image?. or can one size serve all phone screen sizes and we can just set the scale mode in code? Would this be ok even for smaller screen sizes? Would this be a poor experience for smaller phone sizes since they need images. To me this wouldn't be optimal since smaller phones like SE don't have the same processing power as iPhone 8 plus.
If we're using the same API to serve iPhone and Android - how can this api be leverage for android given that they have more image sizes to handle.
Any guidance would be greatly appreciate it.
PREMISE:
You are talking about images from web server. Not svgs, not interface
graphics. There's no official documents of this field, just
suppositions and results of experience. I'm sharing mine.
If you meant interface graphics, there are official documentations from Apple and Google. If you meant svgs, they're automatically scaled. If you intended to have answer for those, please edit the topic or open new ones
A solution could be, instead of acting only on images sizes, to change the quality of JPGs.
You can use a full quality ~200x~200 image for little thumbnails (avatars, photo icons), which could be ok for all devices sizes, resolutions and models, without being too heavy.
Then, for bigger previews/full image opened you could maintain the same size (the original one, or a maximum size you define) but, using two version of the image: one with little JPG quality (so that it can be loaded quickly, consume less bytes and show the image content) and the other with the original quality (which requires loading and bytes, but it's only shown by demand).
To choose the right value of the little thumbnail (the ~200px), check the bigger thumb size you have. If you have an avatar bubble which is 96x96 on smallest res, multiply it for 3 (96*3=288) and you have the size!
It is true that the smallest res screen will only require a 96x96 image, but, given that those are little numbers, the difference is not relevant (also, because we are talking about photos and not vectorial images, if you scale manually or if you leave the scaling to the device, the result is the same).
I've found some documentation from Google, which explains some things about image formats and how to reduce download sizes: https://developer.android.com/topic/performance/network-xfer.html
They say to use JPEGs, PNGs, or WebPs and show some examples and guidelines for choosing the right format
You can use svg resources(which is a vector-based-image) : By doing so, you don't need to generate a resource for each resolution, and just need 1 resource. In realtime, the svg image will expand to the resolution of the device.
According to the documentation, you have a lot to gain here :
Using vector drawables instead of bitmaps reduces the size of your APK
because the same file can be resized for different screen densities
without loss of image quality
I have used this in Android, and it solves your issue in Android.
I Haven't used this in iOS but, it looks like there's a similar solution as well.
Your all questions are nearly have same goal. So Basically save 6 versions of images like 50px 100px 200px 400px 800px and 1600px etc.
6 will be enough since you can cover nearly all screen sizes like google does in android. which is ldpi mdpi hdpi xhdpi xxhdpi and xxxhdpi
Use an API for picture requests, send your screen sizes to api as parameter then give back resulting images width and height. for ex: for a 800x600 screen send back 400px version of it.
If you not do so, you will have to resize them on client size which is bad for performance and also bad approach for auto layout in IOS.
You can use third party image managing solutions like Cloudinary.
https://cloudinary.com/
Cloudinary generates images of different aspect ratio which can be serve to all types of devices.
Im having some memory issues with my app. It can pick an image from the users personal gallery and store it in a file to be rendered on the screen. The issue is that the limitation on the imagesize is very small. Which I have discovered lead to pretty much every image on my device being to large to handle. So the method itself became useless since it can't handle moderate sized images. I'm experiencing this only on ios devices so far.
Is there a solution? Can I compress/minimize the size of the image to a smaller one in any way? Cutting all images to the same resolution? (Like Instagram's system).
If you want to reduce the image size in bytes, there are at least 3 areas you can work on:
Reduce image dimensions (pixel resolution). This almost always
causes loss of quality, but if your users are viewing on small
screen devices, and you don't resize too much, the loss won't be
significant. You can also use interpolation to minimize the visual
degradation when resizing.
Reduce bit depth (color resolution).If the image is full color (32
or 24 bits per pixel), you can sometimes get away with reducing it
to a lower color count such as making it 8-bit. Again this will
cause quality loss, but you can use dithering to reduce it.
Use better compression. Most images are
already compressed these days, but in some cases you can re-compress
an image to make the file smaller. One example is JPEG which
supports different quality factors. There are also different
sub-types (color sampling frequencies) in JPEG. So if you save an
image as 4:1:1 instead of 4:4:4, it will contain less color content
and become smaller in byte size, but the difference is usually not
noticeable to the human eye. This post has details on changing
JPEG Quality factor on iOS.
Various web graphics I've created are blurred on high resolution smart phone screens, unlike desktops screens.
Do I need to:
double the image size and programmatically resize it to half
increase the resolution (e.g. 72 to 300).
My understanding is that the latter only affects print rather than digital screens.
Are others experiencing this issue and if so, what it is the recommended work-around?
Your assumptions are correct. You need to double the image size, maybe even a little more if you wanted to get picky as some screen resolutions have 3x or more pixel density than a desktop monitor. Double works pretty well though so I would start there.
Resolution, as in DPI, won't do anything for web graphics on screens besides make the image resource's filesize larger than it needs to be. You could have a resolution of 5 DPI and they would look the same as 300 DPI on a screen. The main issue with lowering DPI for web graphics is when a user wants to print your page, then any images with really low DPI would be very pixelated.
Depending on the graphics you've created you have some options besides your standard image formats. You can use SVG or create your own icon font. Both are vector images so they will look sharp on any device that supports them. Icon fonts are widely supported and SVG is decent but might need a small shim depending on what you need to do.
Double image size.
You should even render image (simple or doubled), depending on the device/viewport resolution.
increasing resolution is quite a complicated matter. Print/digital/dpi/ppi; it could work on a bunch of devices but not all.
I'm writing an Android application which makes some use of stereoscopic image data from camera on HTC Evo 3D. I try to access the data using standard Android API with some 3D-specific functions provided by HTC OpenSense API. So far, I can access the camera in stereoscopic mode and I can grab the image data using onPreviewFrame() callback method.
However, the "raw" image data (data[] byte array) available in onPreviewFrame() are not complete. The image I get is a correct side-by-side stereoscopic picture, but its horizontal size is reduced by a factor of two. For example, when set the camera preview size to 1280x720 px, I expect a 2560x720 px image (two images of the desired 1280x720 px resolution). But what I get is a picture of 1280x720 resolution, half of which comes from the right camera and the other half from the left one. I don't know why is the horizontal resolution reduced.
There is a similar thread on this forum, but the answer doesn't really solve the problem. Although the DisplaySetting.setStereoscopic3DFormat() returns true in my program, it doesn't seem to have any effect on display or image data.
Has anyone any experience with this issue?
The resolution halving is by design, the parallax barrier display causes 3D photos to be half the resolution.
I have question that is connected to display images on android devices.
I have many png files that I want to display and they have got 1024 x 768 resolution and have text in image. The text in images must be readable - this is important thing. Because png it is bitmap format I understand that the loss of quality is inevitable. Maybe some one can advice me to choose some approach to solve this issue. Maybe I have to choose just devices that can display those images.
All images like this below: