how to edit big images in android? - android

I am trying to save small images from the original which I load from SDcard. Android doesn't allow me to create bitmap of bigger image sizes so I had to use options, doing so my images' resolution is altered so now how i am supposed to edit the original image??
And saving images, do I have the bitmap.compress option alone? If so, this reduces the quality of the image when i open and save it in JPG
And how can I display them independent of the screen???

I found a way to display big image in Android by using BitmapRegionDecoder. http://developer.android.com/reference/android/graphics/BitmapRegionDecoder.html

Related

same image, different sizes: with picasso

I have an image that is to be displayed in about four different sizes depending on which activity the user is viewing. For instance a ListView will show one size, a GridView will show one size, a slide show will show one size, etc. If I use Picasso, will it download the image once or will it download one image for each size? Of course, I am taking into account that Picasso caches images (which is what I want). The key point here is that I have a single url for the image since it is one image.
Note that to keep the example simple, I mention one image. But of course I am talking about a set of images each of which needs to be manipulated as mentioned in the paragraph above.
If I use Picasso, will it download the image once or will it download
one image for each size?
Once for the original size as you get from the URL.
You can use the resize() method to resize the image and the original image would still stay at full resolution. I have done that in my app where I displayed a 600x600 image at 150x150 in a thumbnail and in full resolution later.

Scaling image without losing quality

Is it possible to scale image without loosing its quality?I have seen posts that say to use Ninepatch images but how can we download an image and convert it to ninepatch image so that i can show it in ImageView.
Is there any other way so that my images with smaller size can be scaled like in whats app
Everytime you scale an image it's losing quality, the only thing you can do to keep the quality is keeping a copy of the original image (which doesn't make much sense since you can just load it again from resources).
If you mean the problem was that android was scaling your images (and changing the quality) you can put images on a folder named "raw" inside res.
Ninepatch images can be made manually by you, you just paint an image that has two extra pixels on width and two on height, and when you save it , name it something.9.png
if you want to know how to draw them correctly follow this: http://developer.android.com/tools/help/draw9patch.html

Android imageview image quality matter?

I am writing a Android app which need to display some high quality picture(took from professional DSLR). The problem is it can't be display from gallery.
I choose a photo in Gallery first. The target picture is 2464*1632 JPEG, roughly 4.5M;
Then I just need to compress it to 800*600 and display it in imageview:
image.setImageBitmap(this.bmp);
Thing is that I have tested other image I downloaded form internet(really low quality), and it works without any problem. Can anybody tell me why it can't be displayed? I will be really appericiated
Large images are tricky to handle due to limited memory. You have several choices:
Use a WebView (this allows you to have pinch and zoom functionality to make use of those extra pixels
Decode the image down to the size of the display and then put it in an ImageView using BitmapOpts http://developer.android.com/reference/android/graphics/BitmapFactory.Options.html and changing inSampleSize. It seems you may be having difficulty with that, so consider using createScaledBitmap which just needs the dest width and height.

Android Efficient Bitmap processing

My scenario:
In my activity, I have to show 2 galleries, 1 with large image and another is a thumbnail(same exactly like default Gallery application).
My doubts:
I am planning to save as 2 images(1 with large size and another one with thumbnail size) in sdcard for fast processing. Is that good practice? since it will increase the size.
Or Shall I resize the large image during the getView method of BaseAdapter to small size for displaying in thumbnail gallery?
Which one is the good practice? I don't want to slow down my app.
See this example.
I will suggest you that, put only your large image inside your sdcard. But at runtime, Android provides a good facility to get Thumbnails using MediaStore.Images.Thumbnails.
Edit:
You can also get use Loading Sample Sized Bitmap. This will first create a sample size of your requirement. Then will give you a Thumbnail sized Bitmap.
StackOverflowAnswers:
1) Get thumbnail of image on SD card

Is there a way to crop a large image on android without loading into memory?

I don't want to display the bitmap on the screen. Just trying to create a max square image out of the original image from sdcard and then uploading to server. Is there a way to crop an image without loading the image into memory? or load the image in chunks and then save to file?
I don't know if I understand well the question but this could help:
http://developer.android.com/reference/android/graphics/BitmapRegionDecoder.html
BitmapRegionDecoder can be used to decode a rectangle region from an image. BitmapRegionDecoder is particularly useful when an original image is large and you only need parts of the image.
Hope to help :)

Categories

Resources