12-23-2010 10:04 PM
I am trying to convert a png file to a bitmap and log the errors. However, when i get to this part bitmap = image.getBitmap(); it will throw me a Uncaught: IllegalArgumentException.Am I doing something wrong? Why can't I use the getBitmap()? Thanks!
byte data = new byte[(int) file.fileSize()];
image = EncodedImage.createEncodedImage(data, 0, data.length) ;
bitmap = image.getBitmap();
Solved! Go to Solution.
12-26-2010 09:51 PM
I have removed bitmap = image.getBitmap(); and using only image = EncodedImage.createEncodedImage(data, 0, data.length) ; And when it is display on screen , it shows PNGEncodedImage@10d801c.
How do I decode this image with getting an exception?
12-26-2010 11:38 PM
How big is the PNG? As in width by height?
12-27-2010 01:16 AM
What about width and height? A PNG can compress an image a great deal if a pattern in the colors exist, but it the image is too large then BlackBerry will complain and won't give you a Bitmap.
12-27-2010 01:26 AM - edited 12-27-2010 01:54 AM
It is 225 x 225. Is it too large?
I am not sure why some of my images are not giving me bitmap as some images I can get the bitmap. Why is this so? Anyone has any ideas?
12-27-2010 01:06 PM
In that case it is odd. Does the exception give any details or is "message" null?
12-27-2010 08:28 PM
It states that Uncaught: IllegalArgumentException. When I open the image from sd card, I notice that the code is somewhat distorted. Will this be the reason it is not being converted to bitmap?
I have a program which manage to decode it to bitmap in android. But I can't seem to be able to do so in blackberry.
12-27-2010 10:02 PM
I'm not getting what you mean by "code is somewhat distorted." The image comes out distorted or something else?
Can you draw the EncodedImage?