How Can I Download Scaled Down Version Of An Image?
Solution 1:
It must be supported by the server from which you download.
If the server is not yours, you need to look up that server's documentation (or reverse-engineer).
If the server is yours, it depends on the used technology. Look up an image manipulation library for that particular server-side technology you are using.
in case of imgur.com,
look here: http://api.imgur.com/
Imgur lets you make 500 calls per hour per IP, or 1000 if you are registered. Uploads count tenfold.
The metadata about an image is documented here: http://api.imgur.com/resources_anon#image_hash . Access either api.imgur.com/2/image/[hash].xml
or api.imgur.com/2/image/[hash].json
, and pick either image.links.small_square
(90x90) or image.links.large_thumbnail
(?x640) from the response. Note that imgur also generates thumbnails (160x160) for its home page. URLs for these seem to be i.imgur.com/[hash]b.jpg
The link to the large image is i.imgur.com/[hash].jpg
, so if your link is http://i.imgur.com/xDpEF.jpg
or http://imgur.com/xDpEF
, then xDpEF
is the hash you need.
Solution 2:
It is NOT possible to download a scaled down version of some image when the web server does not provide a scaled down version.
You'll need to scale them in the web/on the server, where you host them. So the question is not java/android, but on the webserver, and depends on it.
Solution 3:
You can't, unless your server supports scaling down the image before you download it. If the server doesn't have that option, your best option is to scale it down while you read the image from the stream, using BitmapFactory.Options inSampleSize.
Solution 4:
Sir it is impossible because if you are downloading it from any server then server must have the scaled image in many forms like 50% scale or 25% scaled. So it is possible only when the server is maintained by you from where you are downloading the image and at backend you have provided some method to scale the image.
If you are downloading the image from any server then is is not possible to get scaled image from server without any backend procedure to scale image.
Solution 5:
You will need to download the image to a file, then use BitmapFactory
with BitmapFactory.Options
to determine the size of the image. From the image size, calculate how much you want to scale it, and again use BitmapFactory
(with Options
) to load a scaled version of the image.
Post a Comment for "How Can I Download Scaled Down Version Of An Image?"