You Are Here:

Community: Developer Discussion Boards

#1 Old Problem when creating images of large sizes. - 2009-04-03, 07:52

Join Date: Nov 2008
Posts: 13
mamatha_j2me
Offline
Registered User
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
Reply With Quote

#2 Old Thumbs up Re: Problem when creating images of large sizes. - 2009-04-03, 08:53

Join Date: Sep 2008
Posts: 1,195
Location: DELHI
Send a message via Yahoo to jitu_goldie
jitu_goldie's Avatar
jitu_goldie
Offline
Forum Nokia Champion
Quote:
Originally Posted by mamatha_j2me View Post
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
Ur question is ur answer. The exception shows that heap size is not sufficient to load the image.. which device r u using. Please check ur code with some high end set. check for any object created in a loop. Please avoid that if is it so. If still u got the same error with high end sets then please post ur code here.


thanks,
jitu_goldie..

KEEP TRYING..
Reply With Quote

#3 Old Re: Problem when creating images of large sizes. - 2009-04-03, 10:55

Join Date: Nov 2008
Posts: 13
mamatha_j2me
Offline
Registered User
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();

}

}
Reply With Quote

#4 Old Re: Problem when creating images of large sizes. - 2009-04-03, 11:54

Join Date: Jun 2003
Posts: 4,325
Location: Cheshire, UK
grahamhughes's Avatar
grahamhughes
Offline
Forum Nokia Champion
What do you mean by "big"? I'd guess you're running out of memory.

Cheers,
Graham.
Reply With Quote

#5 Old Re: Problem when creating images of large sizes. - 2009-04-03, 12:33

Join Date: Nov 2008
Posts: 13
mamatha_j2me
Offline
Registered User
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.
Reply With Quote

#6 Old Re: Problem when creating images of large sizes. - 2009-04-03, 12:58

Join Date: Jun 2003
Posts: 4,325
Location: Cheshire, UK
grahamhughes's Avatar
grahamhughes
Offline
Forum Nokia Champion
What is the size of the images, in pixels?
Reply With Quote

#7 Old Re: Problem when creating images of large sizes. - 2009-04-03, 14:39

Join Date: Nov 2008
Posts: 13
mamatha_j2me
Offline
Registered User
Image size: 373KB
Pixels : 1280x960
Reply With Quote

#8 Old Re: Problem when creating images of large sizes. - 2009-04-03, 16:58

Join Date: Jun 2003
Posts: 4,325
Location: Cheshire, UK
grahamhughes's Avatar
grahamhughes
Offline
Forum Nokia Champion
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.
Reply With Quote

#9 Old Re: Problem when creating images of large sizes. - 2009-04-05, 00:03

Join Date: Apr 2009
Posts: 3
gauraviz_4u
Offline
Registered User
I think there is a heap issue tht's why its throwing error. Try this with images having less size(less than 200).
Reply With Quote
Reply « Previous Thread | Next Thread »
Display Modes
Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules

You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Forum Jump
Similar Threads
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

Rate This

 
Bookmark this page: DeliciousDiggFacebookGoogleYahooStumbleUponRedditDiigoTechnocratiTwitter  Share this page Share this page Print this Page Print this page Invite a friend Invite a friend
京ICP备05048969号    Email Newsletters Press Terms & Conditions Privacy Policy Sitemap Contact Us © 2009 Nokia 
RDF Facets: qdcZidentifierQSxhttpE3aE2fE2fdiscussionE2eforumE2enokiaE2ecomE2fforumE2fshowthreadE2ephpE3ftE3d134434X qdcZtypeQUqfnZE45E78cludedFromGeneralE4cistingsQ qdcZtypeQUqfntypeZCommunityContentQ qdcZtypeQUqfntypeZE44iscussionQ qdcZtypeQUqfntypeZE44iscussionContentQ qdcZtypeQUqfntypeZE52esourceQ qdcZtypeQUqfntypeZWebpageQ qdcZtypeQUqmarsZManagedE52esourceQ qdcZtypeQUqwebZInformationE52esourceQ qdcZtypeQUqwebZPageQ qdcZtypeQUqwebZE52esourceQ qdcZtypeQUqrdfsZE52esourceQ qfnZtopicQUqfnTopicZentertainmentQ qfnZtopicQUqfnTopicZj2meQ qfnZtopicQUqfnTopicZjavaQ qfnZtopicQUqfnTopicZmediaQ qfnZtypeQUqfntypeZCommunityContentQ qfnZtypeQUqfntypeZE44iscussionQ qfnZtypeQUqfntypeZE44iscussionContentQ qfnZtypeQUqfntypeZE52esourceQ qfnZtypeQUqfntypeZWebpageQ qmarsZlanguageQUxhttpE3aE2fE2fswE2enokiaE2ecomE2flanguageE2d1E2fenX qrdfZtypeQUqfnZE45E78cludedFromGeneralE4cistingsQ qrdfZtypeQUqfntypeZCommunityContentQ qrdfZtypeQUqfntypeZE44iscussionQ qrdfZtypeQUqfntypeZE44iscussionContentQ qrdfZtypeQUqfntypeZE52esourceQ qrdfZtypeQUqfntypeZWebpageQ qrdfZtypeQUqmarsZManagedE52esourceQ qrdfZtypeQUqwebZInformationE52esourceQ qrdfZtypeQUqwebZPageQ qrdfZtypeQUqwebZE52esourceQ qrdfZtypeQUqrdfsZE52esourceQ