A friendly place for programming greenhorns!
Big Moose Saloon
Search
|
Java FAQ
|
Recent Topics
Register / Login
JavaRanch
»
Java Forums
»
Mobile
»
Android
Author
how to compress an image in android
Suzzane Pinto
Ranch Hand
Joined: Feb 10, 2012
Posts: 204
posted
Apr 25, 2012 00:58:10
0
hi,
i want to compress an image and insert into database.
which compression technique should i use without loosing quality of my image....
Pondurai Singh
Ranch Hand
Joined: Jun 27, 2011
Posts: 32
posted
Apr 25, 2012 01:17:14
0
compress an image and save the image
BitmapFactory.Option imageOpts = new BitmapFactory.Options (); imageOpts.inSampleSize = 2; // for 1/2 the image to be loaded Bitmap thumb = Bitmap.createScaledBitmap (BitmapFactory.decodeFile(photoPath, imageOpts), 96, 96, false);
For your reference
http://developer.android.com/reference/android/graphics/Bitmap.html#createScaledBitmap%28android.graphics.Bitmap,%20int,%20int,%20boolean%29
Software Developer, Oracle
Java Certification
Training Labs at EPractize Labs
OCPJP 7
|
OCAJP 7
Tim Moores
Rancher
Joined: Sep 21, 2011
Posts: 2407
posted
Apr 25, 2012 01:19:17
0
Lossless compression generally results in at most a 50% reduction in size - hardly worthwhile given the cost of hard disk storage these days.
I agree. Here's the link:
http://zeroturnaround.com/jrebel
- it saves me about five hours per week
subject: how to compress an image in android
Similar Threads
Image compression and decompression
WA #1.....word association
DICOM
I want to compress png image(loose-less compression)
compress jpg image file
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter