Hi,

Understanding image file formats in the 1st place would help - to let you
get the picture -> In general there are 2 types of image file formats:
compressed (png, jpg, gif, tga etc) and uncompressed (bmp) (if you are
unfamiliar with the "compression" really is, look up on wikipedia or so). To
use any image it needs to be in uncompressed form (raw pixels). This means
source file format nor file size does not really matter for your task. What
matters is image resolutions, because that indicates how much memory given
image would really tak when you get it in the unpacked form you can further
process. And calculations are quite simple: width * height * depth, where
width and height are image dimensions in pixles and depth indicates how many
bytes each pixels takes. Usually you got 3 bytes (R + G + B) or 4 bytes (R +
G + B + Alpha). This means that if you want to convert 1024x1024 pixels JPG
to BMP you would initially need 3145728 bytes (3072KB) to get it unpacked.
If you got that memory then writting BPM is trivial as it is just header +
dump of non processed bytes. However, JPGes are compressed and compression
ratio depends how image pixels are really look like - the less complicated
image the higher compression ratio and smaller output file (you may want to
grab Gimp or Photoshop, create i.e. 2048x2048 true color, fill it all with
single color (say, black #000000) and save as JPG, PNG and BPM and see how
your file sizes look like. So conculusion - you shall check image file size
first (this shall be easily doable as such information are usually stored in
image header data so you do not need to unpack nor read the image to find
that out) then do simple calc and check if there's any chance you exceed
available memory, as it's quite easy to have 10KB JPG image which would
requre all you have on whole device :)

Regards,
Marcin Orlowski

*Tray Agenda <http://bit.ly/trayagenda>* - keep you daily schedule handy...
*Date In Tray* <http://bit.ly/dateintraypro> - current date at glance...
WebnetMobile on *Facebook <http://webnetmobile.com/fb/>* and
*Twitter<http://webnetmobile.com/twitter/>
*



On 5 May 2011 13:06, echizen <[email protected]> wrote:

> I would like to ask if there are any maximum KB for an image from jpg
> converting to bmp via the android code of bitmap.decode.
> I've tried sizes of images ranging from 100KB - 600KB, whereas after
> 390KB, the image won't be processed and showed on the application. Is
> there a restriction of <400KB size of image that can be converted to
> bmp from jpg?
>
> Thanks
>
> --
> 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

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