Meaningless Drivel is fun!*
The moose likes Beginning Java and the fly likes whats wrong with Jimi Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "whats wrong with Jimi" Watch "whats wrong with Jimi" New topic
Author

whats wrong with Jimi

Ben Klug
Ranch Hand

Joined: Jan 28, 2002
Posts: 45
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

Joined: Mar 06, 2001
Posts: 13459

Need more input.
Whats a 'Jimi'?
Dave Landers
Ranch Hand

Joined: Jul 24, 2002
Posts: 401
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

    Joined: Jan 28, 2002
    Posts: 45
    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

    Joined: Mar 06, 2001
    Posts: 13459

    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

    Joined: Jan 28, 2002
    Posts: 45
    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 ]
     
    I agree. Here's the link: http://aspose.com/file-tools
     
    subject: whats wrong with Jimi
     
    Similar Threads
    Aspect ratio-preserving image scaling, drawing and infinite loops
    how to use drawImage in an object
    Help! Having trouble animating translucent window.
    Please help with this program
    Why doesn't paint