0

I want to reduce the resolution/size of a picture I received via share intent and I only have its URI. The pictures can be in different formats and I may receive several pictures at once. I used the following intent-filter:

 <intent-filter android:icon="@drawable/icon" android:label="Share">
  <action android:name="android.intent.action.SEND" />
  <action android:name="android.intent.action.SEND_MULTIPLE" />
  <category android:name="android.intent.category.DEFAULT" />
  <category android:name="android.intent.category.ALTERNATIVE" />
  <category android:name="android.intent.category.SELECTED_ALTERNATIVE" />
  <data android:mimeType="image/*" />
 </intent-filter>

How can I do it?

Do I have to save the picture(s) to the SD card again with another name if I want to share it/them again with another app?

Thanks!

Sitoplex
  • 125
  • 7
  • Look at this question, then getting it working for one image, then if you are stuck on an array of strings, then ask that: http://stackoverflow.com/questions/2507898/how-to-pick-a-image-from-gallery-sd-card-for-my-app-in-android – James Black Oct 12 '11 at 00:15

1 Answers1

3

Use the Bitmap.compress(...) API.

Edit To copy and scaledown the picture. Create a new empty bitmap, use it as a place for a canvas to draw to. Draw the old bitmap on the canvas with an appropriate Scale matrix or draw the old bitmap with a destination rectangle the same dimensions as your destination bitmap (depending on the api and effect you'd like to have), then save the destination bitmap.

Or for only scaling use Bitmap.createScaledBitmap().

Dan S
  • 9,139
  • 3
  • 37
  • 48
  • I want to reduce the size in pixels of the picture(s), not the accuracy. Like rescaling it. Any idea? – Sitoplex Oct 14 '11 at 00:08