Compress (Bitmap.compress) the image yourself into a file.
Then use the
getContentProvider().insert(MediaStore.Images.Media.EXTERNAL_CONTENT_URI, ....)
to insert your image into the database/content-provider.

When inserting, you can create a ContentValues name-value pair with
MediaStore.MediaColumns.DATA for the name and the fully qualified file-
path to the image for the value.


On Jun 20, 11:16 pm, Julian <[email protected]> wrote:
> So from what I can tell Media.insertImage is locked to heavy
> compression on all images. This includes when passing in the path to a
> photo in the filesystem. As a test I used a 3000x2000 pixel jpg which
> had been previously saved at maximum quality and was ~6MB. After
> passing the path to Media.insertImage, the resultant copy (still
> 3000x2000) is 623KB.
>
> I passed in another copy of the 3000x2000 image, this one compressed
> down to 393KB. After Media.insertImage, the image filesize is 492KB.
>
> I'm wondering if there's a way to specify the compression when images
> are saved by insertImage.
>
> I'm also wondering why this is recompressing jpgs, rather than simply
> copying them into DCIM. A side-effect of opening and re-compressing
> these images is that it imposes a rather low VM cap on what
> insertImage can handle. I'm getting out-of-memory errors when trying
> to pass the path of a 10 megapixel image.
>
> As an aside: are there any problems with a developer creating their
> own file/folder structure under DCIM? Is this frowned upon?
>
> Thanks for any thoughts,
>
> Julian

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to