• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Jeanne Boyarsky
  • Ron McLeod
Sheriffs:
  • Paul Clapham
  • Liutauras Vilda
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

UTFDataFormatException

 
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
(J2Me)
I'm trying to draw a background image in the gamecanvas to use as a background. It's a pacman game. The background I created in GIMP with in .png format. When I try to load the image I get this...

java.io.UTFDataFormatException: malformed input around byte 25

Code is as follows.

try{
backgroundImg = Image.createImage("/PacmanBackground.png");
}
catch (IOException e) {}

g.drawImage(backgroundImg, 0, 0, Graphics.TOP | Graphics.LEFT);

I'm very new I didn't know whether to put this in game section or beginners java section :O Any advice appreciated, thanks.
 
Bartender
Posts: 15737
368
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Joseph. Can you please post an SSCCE that demonstrates your problem?
 
Joseph Tulowiecki
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi I read your reply. Sorry about that. Next time I will remember to do that. However in this situation I have been playing around with it a little and I've come to the conclusion its not the code because I tried another .png image with the same code and it loaded fine. So the problem is obviously with the image. I tried opening it in paint and renaming it but still getting the same problem. It was originally created in paint. Anyone have any ideas?
 
Joseph Tulowiecki
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Correction to previous reply. "It was originally created in paint." <-- Is suppose to be "It was was originally created in GIMP" ;]
 
Stephan van Hulst
Bartender
Posts: 15737
368
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I could have a look if you posted the particular image and an SSCCE.
 
Aaaaaand ... we're on the march. Stylin. Get with it tiny ad.
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
    Bookmark Topic Watch Topic
  • New Topic