Post on wall - image dimensions limit? - android

I'm posting images ot wall. Tried 200x200. Result on wall is: 96x96.
But I saw images on other posts with bigger dimmensions.
Where are the limitations described?

Images with dimensions bigger than 96x96 in feed is photos that was uploaded by user, and not posts created by application.
Documentation is a bit poor on that but there is no hard limit for image dimensions but the image will be displayed in different sizes across different views (this was stated in comments to several bugs, and I cannot find the source right now).
This means that in feed image will be displayed one size and the Timeline may display bigger version if available, and some other views may use other dimensions as well. One rule exists (which is stated about images across different documentation pages: Share, OpenGraph Protocol, Feed Dialog)
The image must be at least 50px by 50px and have a maximum aspect ratio of 3:1

When you share a URL, the maximal size for a linked image is 90x90.

Related

Thumbnail image for original picture

I have a mobile app which has a screen with list of small images (3x3 grid). Click on image takes user to detail screen, where user can see that image in original size. Now, problem is that, for now, on backend side i only store full sized images (which i know is bad), but when i retrieve images for list i would like to return thumbs for original sized images.
The question is - what is the recommended thumbnail size to return?
Consider that this is an iOS and Android app.
Thanks in advance!
It depends how big you want to show it to the user.
i personally prefer 256X256

Retrieve a photo from FB API GRAPH

I'm trying to retrieve a photo from fb doing this call:
/id_photo?fields=picture
I take the field "picture" from the response and that give me an URL from where i can download the image.
The problem is that the image have a really poor quality and no matter if i change the parameters height and weight the result is the same.
So how can i download a specific photo from facebook in a good quality? (I have the photo ID)
?fields=images should give you all different photo sizes there are.
(Using width and height modifiers should also work, in theory - but depending on how close or not the sizes you request are to what's available, it might not always return the desired result. I have found it better to get all images sizes, and then pick the most appropriate one out of those.)

Android scale a bitmap to a specific file size

Before to say this is a duplicate, please read as I did not find my answer on the other topics. I am trying to resize (if needed) a bitmap to a specific size but this size is in Ko (not height/width).
The problem is the following
1) In my app, the user can select pictures from facebook, gallery or the camera
2) I get all of those as bitmap format and they all came with different width to height ratio and different compression rate.
3) I need to store those pictures on my server so that the user can see them in my app at a later point if he comes back. But I want to save a version of about 200/100Ko for each picture.
4) The problem is that if I resize the bitmap to be the same size say 800*600, and then compress the picture to 50% then some bitmaps (that were compressed) will basically take more space than if I was doing nothing and they will not look as good too as 2 layer of compression will be done.
5) I need to find a way to compress my bitmap only if it needs to be compressed and not increasing his size by doing those manipulations. The documentation on this topic looks much more limited, as every questions asked about resizing a picture to a certain size in width/height but not in terms of space.
If any one has links or recommendations on this, would be very happy to hear from you, thanks

Posting-a-photo usecase in android and server

I want to have the posting-a-photo usecase in my android app.
This is the scenario I have implemented:
1. User posts a photo.
2. On the client side I scale the photo* , compress it and send
it to the server.
3. I store the photo on the server.
4. Users, who can view the photo, fetch the photo from the server.
The problem with this approach is that it doesn't take into consideration
the different-screen-sizes problem.
Let's say user A posts a photo.
User B, which has a phone with a larger screen**, fetches the photo
from the server. The photo doesn't fit good in the environment
since it has fixed width and height determined by user A (scaling in step 2).
I cannot simply scale the photo and put it into user B's ImageView, because
I am risking to loose the aspect ratio of the photo.
One approach that comes to mind is to simply remove the step 2 from the scenario.
I send the photo to the server, and when a user tries to fetch it
I scale the image according to the user's screen size (which I receive as parameters in the fetch request).
The problem with this approach is that, on each request, I will have
to scale the photo on-the-fly and send it to the client.
Another problem is the efficiency of uploading a photo, because I don't scale the photo (before uploading it).
It takes much more time to upload a full 2MB (or even a 500KB) photo than to simply upload a scaled photo (~20KB).
What are my options?
Since I am relatively new to Android, chances are that I am missing something essential.
Cheers!
*I scale maintaining the aspect ratio.
** Sorry for the terminology, i don't know how and when to use high density/pixels correctly. :-)
I have own dedicated server with unlimited traffic and 4T HDD. So, basically what I do is:
User take a picture by phone
User upload image to the webserver
Using ImageMagick + mozjpeg 3 I resize image 3 times and save it with prefixes small_, medium_, large_ OR with prefixes pre size: 1024_, 640_...
Now, my app can find user's screen dimensions and load image by doing request for specified prefix.
My arguments for doing in this war are:
Free traffic
Big HDD
Fast user's internet speed
When upload in another thread, and show to user another activity, he doesn't feel the "long waiting time" for uploading large images.
You always can resize photo on device, from 10Mb to 2Mb, for example, and on server do other resizes.
Now about image ratio. There you cannot to do a lot. You must decide, what to do in case that user with large screen and own aspect ratio tries to load image that was uploaded by user with small screen and own aspect ratio.
The truth is that screen size doesn't matter. What is matter is a ratio. So, you can load image, put it in ImageView, and this will filled with black background if the image is "smaller". O r you can load large size of image, crop it and put it to the ImageView. Larger image is used only for better quality.
In my case, I always do crop images if I use it as preview. I think it's looks more beautiful. When user want to view full size image, I download full image and show it as is.
A good server that handles images should:
receive images at high-quality
save or cache the images in multiple sizes (small, medium, large)
serve images according to a size parameter (larger phones ask for the large image)
There are many solutions for this kind of server. Most of them resize the image on-the-fly and cache the result. The client tells the server what size it wants. One example is the image handling in Google Play. Go to the play webside and view the urls of the app-icons (example). They have a width parameter.
You can also think of a maximum dimension (like 2048px) and resize the image before upload only if needed.
The client that views the image needs to decide on what size it asks from the server or it can resize the image on the phone, instead of relying on the server. Do this if traffic is not an issue. Consider using Picasso or Glide to make things easier.
Regarding aspect ratio: The client that views the image should handle this. It should expect any aspect ratio and be prepared for it. Use android:scaleType on the ImageView and decide which scale type fits your scenario. Here are the scale types. If you don't want black lines and want to occupy as much as possible from the screen, use CENTER_CROP - but you might end up losing parts of the image.
In most apps the original aspect ratio in maintained and two black "stripes" are added if your screen doesn't match.
I think it's not possible to manage all screen ratios...
ImageView has android:scaleType attr that preserves aspect ration to be broken,
like fitCenter or centerInside
And also calculate size of fetched image and set view size by yourself.

How do I take a picture of what fits inside a square in android?

I have to make my app capable of taking pictures of only whatever it fits a squared frame that is superimposed on the preview.
The idea is: the client wants the app to send pictures of 600x600px tops. To avoid cropping important parts of the picture, he decided to put this superimposed squared frame (similar to the one in QR-reading apps) and to crop out everything out of said frame.
To do this I need two things.
1) How do I set the frame dimensions for multiple screens while getting the output within the required dimensions?
2) Once the frame is up and running... how do I crop out the rest of the picture?
Thanks in advance.
Update
What I want to do is something similar to what is explained here http://www.londatiga.net/featured-articles/how-to-select-and-crop-image-on-android/
Thing is:
This how-to checks if there's an image-cropper app installed, it
doesn't do the cropping by itself (or so I understand, maybe I'm
wrong?).
The frame seems to be 200x200... px? dp? Would that frame take up the
same portion of screen on xhdpi screens that on ldpi screens?
What's the size of the resulting image? Can I decide it somehow?

Categories

Resources