I also noticed that when I call BitmapFactory.decodeFileDescriptor
(fileDescriptor) to get the Bitmap back from the file, the bitmap
returned to me is null. Any clue what I could be doing wrong (assuming
the PNG was written correctly to the file when I did bitmap.compress
())?

Rohit


On Jun 12, 6:12 pm, Rohit <[email protected]> wrote:
> bitmap.compress() returns false to me and doesnt write to the file
> when I use the PNG format. For me PNG doesnt work. Is it possible that
> this (nativeCompress) fails because I have a large bitmap that I
> passed to it?
>
> On Jun 12, 2:03 pm, Romain Guy <[email protected]> wrote:
>
> > PNG encoding definitely is supported. That is for instance how the
> > wallpaper chosen by the user is stored.
>
> > On Fri, Jun 12, 2009 at 1:57 PM, Rohit<[email protected]> wrote:
>
> > > Hi,
> > >   I have a case where I need to retrieve the bitmap from an ImageView
> > > and write that bitmap to a file so that I can later on retrieve it
> > > back again and set it on a new ImageView. I do this using
> > > bitmap.compress() method. However, the problem is that after I do this
> > > about 5 times, the quality of the Bitmap degenerates badly. The format
> > > I use for the bitmap.compress() is JPEG with the quality as 100. In my
> > > mind 100 would mean no compression of the source bitmap and that the
> > > bitmap should be lossless, but it doesnt seem to be that way. Is this
> > > a bug or is this how it is meant to be?
>
> > > I want a lossless compression and I tried to use PNG as the format
> > > with bitmap.compress() but that doesnt seem to work either. After
> > > digging around I found out that PNG encoding is not supported, which
> > > basically leads me to believe there is no way of storing (in a
> > > lossless way) a bitmap - isnt that weird?
> > >              
> > > http://developer.android.com/guide/appendix/media-formats.html
>
> > > How else can I achieve this lossless writing of bitmap to the file.
> > > Why doesn the Bitmap class simply have an encode() method to write the
> > > bitmap in memory as is?
>
> > --
> > Romain Guy
> > Android framework engineer
> > [email protected]
>
> > Note: please don't send private questions to me, as I don't have time
> > to provide private support.  All such questions should be posted on
> > public forums, where I and others can see and answer them
>
>
--~--~---------~--~----~------------~-------~--~----~
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