This week's book giveaway is in the Performance forum.
We're giving away four copies of The Java Performance Companion and have Charlie Hunt, Monica Beckwith, Poonam Parhar, & Bengt Rutisson on-line!
See this thread for details.
Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

whats wrong with Jimi

 
Ben Klug
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hallo,
this code opens a image, writes text on it and saves it to a file. But somethin is wrong, i can't see the text on the saved image (
Ben

[ September 12, 2002: Message edited by: Ben Klug ]
 
David O'Meara
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Need more input.
Whats a 'Jimi'?
 
Dave Landers
Ranch Hand
Posts: 401
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't know anything about Jimi, but I look at your code and you are doing this:
  • Have "Jimi" read an image
  • Create a Graphics object
  • Write the image to that graphics
  • Write some text to that graphics
  • Dispose of the graphics (bye-bye)
  • Have "Jimi" write the original image back to a file


  • Maybe you want to extract the image+text from the graphics and write that out to a file or something.
     
    Ben Klug
    Ranch Hand
    Posts: 45
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    Hi,
    sorry, Jimi is a class library for managing images from sun.
    Dave, I've tried to first save the image and then call dispose(). It didn't work too.
    thanks
    Ben
    [ September 12, 2002: Message edited by: Ben Klug ]
     
    David O'Meara
    Rancher
    Posts: 13459
    Android Eclipse IDE Ubuntu
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    I've downloaded and had a look at Jimi. Looks nice, I might have to use it myself.
    It does look like your are over complicating things with all of the 'Frame' stuff.
    You probably want to do something more like this:
  • get Jimi to load the image
  • get a Graphics context for the image
  • write the text to the graphics context
  • use Jimi to save the modified Image as the required type
  • (close the Graphics context and any other resources)


  • Without playing I can't help more, but I hope this helps.
    Dave.
     
    Ben Klug
    Ranch Hand
    Posts: 45
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    Thanks David,
    I've tried to handle th Image like this:

    but I get the following error:

    I think the problem is not Jimi, the Problem is getting the Graphics-Object from the image.

    Ben
    [ September 13, 2002: Message edited by: Ben Klug ]
    [ September 13, 2002: Message edited by: Ben Klug ]
     
    • Post Reply
    • Bookmark Topic Watch Topic
    • New Topic