You might want to actually compress that JPG by passing a value less than 100.
Try saving the image on your SD card, check what compression gives you
a reasonable size and then set that compression and check w/ the
network code.
Also, you probably won't get that much benefit with buffering the
output because the network is not that fast, unless you're on 3G, so
either set an explicit buffer size or remove the buffering altogether.

On Fri, Jan 9, 2009 at 3:18 PM, [email protected]
<[email protected]> wrote:
>
> Hi, I added the following code, however, I got an OutOfMemoryError. It
> comes from the bos.flush() line... Am I doing it wrong? I
>
> BufferedOutputStream bos = new BufferedOutputStream(os);
> bm.compress(CompressFormat.JPEG, 100, bos);
>
> try {
>        bos.flush();
>        bos.close();
>        os.close();
> } catch (IOException e) {
>        e.printStackTrace();
> }
> conn.disconnect();
>
> Thank you!
>
>
>
>>
>> bm.compress(CompressFormat.PNG, 100, os);
>>
>> Note that PNG is lossless and will ignore the 2nd argument.
>> Now, the API *could* have a helper method called save(CompressFormat,
>> Stream) passing the max quality as a default 2nd parameter but that's
>> another story...
>>
>> Cheers,
>> Stoyan
> >
>

--~--~---------~--~----~------------~-------~--~----~
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