Jump to content
  • Advertisement
Sign in to follow this  
ross_w

[java] createImage on large jpegs fails on Motorola

This topic is 4483 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi guys! I am trying to make an image viewer midlet because this native image viewer in my L6 sucks (and i have heard that on V3 it is the same). So I a have made a code which browses through the image folder, gets the image list, gets the image, resizes it if it is needed to fit the screen and displays the images on the Canvas. To get an image i am first loading the content of the file into byte[] array and than I call the function createImage(byte[] array) to create an Image object. This object I than rotate and resize if needed. It works well on all images except on jpeg images taken with the camera. What is strange is that it does not throw any exception. It just does nothing. When I put the alert immediately after the createImage method it is not displayed at all! Like if it just jumps out from the procedure. Strange. I suppose that larger images are the problem.... Also do You know how to display animated gifs in the Canvas? When I draw the image it just creates the first frame. Best regards, ross

Share this post


Link to post
Share on other sites
Advertisement
well you may be having a problem with compressed image formet. Jpeg files hold their image data in a LZW compression same with gifs. I don't know if createImage is accounting for this or if you are when you read from the image file.

Also what are you doing about the header data more information on how your extracting the pixel data from the byte array after reading it from the file.

Alternatively, why don't you just javax.swing.ImageIcon(String filename) or javax.swing.ImageIcon(URL location) to load the image rather than loading it by bytes.

Share this post


Link to post
Share on other sites
It's not the problem of the compression, because smaller jpegs are loading fine. It may be the problem of the memory - we are already discussing this topic here:
http://www.gamedev.net/community/forums/topic.asp?topic_id=385661
About javax.swing.ImageIcon - I do not have javax.swing namespace accessible... I am using NetBeans with j2me wireless toolkit and using CLDC 1.0 and MIDP 2.0. I'm newcommer in the mobile Java development - which lib I have to include to use javax.swing?

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!