| Reply | « Previous Thread | Next Thread » |
|
Hi,
I want to read the images saved in the device and display on canvas of my application. I am able to read the image stream using fileconnection api. I could suceffully create the connection, read the stream and also the file size. But when I try to create image using Image.createImage(InputStream is) or createImage(bytearray,offset,size) methods, I am facing exceptions. (out of memory,IOException,IlegalArgumentException). The problem is with the image sizes. Did any one face such problems? I would be happy if anyone has solutions for this problem.. Waiting for the replies. Mamatha |
| mamatha_j2me |
| View Public Profile |
| Find all posts by mamatha_j2me |
|
Quote:
thanks, jitu_goldie.. KEEP TRYING.. |
| jitu_goldie |
| View Public Profile |
| Find all posts by jitu_goldie |
|
Hi,
Thanks for the reply, I checked the app in Nokia6681 and Nokia N95 as well. Same problem exists. below is the code : public void readImage(String imgPath) { try { FileConnection fileConn =(FileConnection)Connector.open(imgPath); System.gc(); InputStream fis = fileConn.openInputStream(); long overallSize = fileConn.fileSize(); System.out.println("overallSize:" + overallSize); System.gc(); currentImage = Image.createImage(fis); fis.close(); fileConn.close(); System.gc(); repaint(); } catch (IOException e) { System.out.println("io exception : " + e); } catch (Exception e) { e.printStackTrace(); } } |
| mamatha_j2me |
| View Public Profile |
| Find all posts by mamatha_j2me |
|
What do you mean by "big"? I'd guess you're running out of memory.
Cheers, Graham. |
| grahamhughes |
| View Public Profile |
| Find all posts by grahamhughes |
|
The problem arises with images of size 200KB and more.
I faced problem with image of size 285 KB.
Last edited by mamatha_j2me : 2009-04-03 at 12:42.
|
| mamatha_j2me |
| View Public Profile |
| Find all posts by mamatha_j2me |
|
What is the size of the images, in pixels?
|
| grahamhughes |
| View Public Profile |
| Find all posts by grahamhughes |
|
Image size: 373KB
Pixels : 1280x960 |
| mamatha_j2me |
| View Public Profile |
| Find all posts by mamatha_j2me |
|
And... how many such images do you load at once? An image of 1280x960 on a reasonably new phone will require around 5Mb of memory.
Also: what format(s) are the images? If you embed the image files in the application's JAR, and use Image.createImage(filename), do you have the same problem(s)? Cheers, Graham. |
| grahamhughes |
| View Public Profile |
| Find all posts by grahamhughes |
|
I think there is a heap issue tht's why its throwing error. Try this with images having less size(less than 200).
|
| gauraviz_4u |
| View Public Profile |
| Find all posts by gauraviz_4u |
| Reply | « Previous Thread | Next Thread » |
| Thread Tools | Search this Thread |
|---|---|
| Thread | Thread Starter | Forum | Replies | Last Post |
|---|---|---|---|---|
| Problem in drawing the converted .svg images.... | pawan_G | Symbian Media (Graphics & Sounds) | 39 | 2008-12-20 12:44 |
| Problem creating player on N81 | lamiaaMB | Mobile Java Media (Graphics & Sounds) | 6 | 2008-06-24 20:03 |
| Viewfinder images orientation problem: landscape / portrait inconsistencies | jtullis | Python | 2 | 2008-04-24 13:26 |
| Problem while creating images . | sachinwarang | Mobile Java General | 2 | 2006-04-12 19:42 |
| memory problem regarding creating jar files | gaziani007 | Mobile Java General | 3 | 2005-01-02 09:50 |