Media.insertImage locked to heavy compression

by Julian » Tue, 22 Jun 2010 04:28:16 GMT


Sponsored Links
 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

--



Media.insertImage locked to heavy compression

by Julian » Tue, 22 Jun 2010 04:34:16 GMT


 I've done some tests with the insertImage call and it looks like it
hard coded to always use a high rate of compression. In my tests I
took a 3000x2000 pixel image, which is ~6MB as a jpeg at max quality,
and passed the file path in to insertImage. The image that was saved
to the phone's DCIM folder ends up being ~600KB, which is tiny for a 6
megapixel image. (I also tried passing in the path to the same
3000x2000 image, this time saved at minimum quality, which made it
around 300KB. After passing through insertImage the resultant image
was ~400KB.)

I have a few questions:
- is it possible to vary the compression that insertImage uses when it
saves?
- why is insertImage reading in a jpeg and then writing it back out,
rather than simply copying it? in addition to the undesirable effects
of repeated lossy compression on the same image, this means that the
device's VM becomes a limiting factor. in practice this means that
insertImage fails on a 10 megapixel image on my n1
- finally, are there any guidelines or rules on writing an image
myself to the device's DCIM folder? is this an accepted practice or
frowned upon? in addition to avoiding repeated compression on my
images, this would allow me to create my own subfolder, giving my
images their own gallery

(I tried submitting this a day ago and haven't seen it show up; I'm
not sure if this is simply how long it takes, or if my message got
lost in the shuffle somewhere, so I'm resubmitting.)

--


Sponsored Links


Other Threads

1. Cant get basic HTML5 stuff to work

I made a video of my app, the part where I am having trouble started
at 30 seconds.

http://www.screentoaster.com/watch/stUElTQ0BJRFtXQ1VUUl5RX1JQ/html5

This is my code http://pastie.org/1144392

This is a html5 site using webview/webkit wrapper.

1.  The problem I am having is that when I click a link to load the
comics, there is no sign of loading, is there any built in loader or
progress bar I can use, otherwise people think the app has frozen.
When the links load I then can click them to load the picture but I
have the same problem, it can be a big file picture and people will
think the app is frozen.

2.  Last problem is that I cant zoom in and out of any picture that is
loaded?

Thanks

-- 

2. Android 2.2 and CSS

Last week, I finished a project to convert a CSS file to display
correctly on the Verizon Droid phone.  At the time, the OS was Android
2.1 and I got the CSS to display the site well.

Today, I get an OTA for Android 2.2 and install it.  Now, when I go to
my site, the page is completely squished up to the left and the fonts
are so tiny I can't read anything.

I don't really want to have to change the CSS again for my client, but
it appears I might have to unless there is a known bug or a simple
tweak I can use to get the CSS to layout the site correctly on Android
2.2.

Does anyone know:
a)  A list of all changes in Android 2.2, specifically regarding
webkit/browser (I fear it was the flash thing)

b)  If this is a known issue and there is a simple one-line
workaround?

Thanks in advance.

-- 

3. Strange GregorianCalendar Issue [only on Desire?]

4. copy area of bitmap to another

5. Issue 82 or 2,5 years without Ad-hoc

6. CertPathValidatorException (TrustAnchor for CertPath not found)

7. How to save browser page content?