• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to create an Image

 
Mathews P Srampikal
Ranch Hand
Posts: 211
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can anybody explain how to create an Image using java.Thanks in advance.
 
Ernest Friedman-Hill
author and iconoclast
Marshal
Pie
Posts: 24212
35
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Which do you mean:
  • Draw a picture from lines and shapes onscreen?
  • Paint an existing JPEG/GIF/PNG file onscreen?
  • Create a JPEG/GIF/PNG file?
  • Print a picture?

  •  
    Mathews P Srampikal
    Ranch Hand
    Posts: 211
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    Earnest...Thanks for the quick response.....
    I have to read from the .xml file and Create a JPEG/GIF?...
    Thanks in Advance.
     
    Mathews P Srampikal
    Ranch Hand
    Posts: 211
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    Can anybody help it out
     
    Steve Lovelace
    Ranch Hand
    Posts: 125
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    I don't know how you're retrieving the image from XML, but assuming you do that, something like the following works:

    If result == false, there was a problem, which is almost certainly a no-match on the format name. The format names are whatever identifiers match the codecs that happen to be loaded in the jvm. You can get the list by executing ImageIO.getWriterFormatNames() (ImageIO is chock full of useful stuff). The usual list is {"jpg", "jpeg", "png"} in upper and lower case. Note that "gif" is missing. The reason is that in order to legally write gif files you must first sort out royalty issues with Unisys.
    [ September 06, 2003: Message edited by: Steve Lovelace ]
     
    Mathews P Srampikal
    Ranch Hand
    Posts: 211
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    Hi,
    I have to read from the .xml file means that Read all the tags in the xml and accordingly create a gif or jpg image dynamically.It has to happen when ever the xml file changes.means when the xml file updated image also should be updated.
    Thanks.
     
    Steve Lovelace
    Ranch Hand
    Posts: 125
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    Still don't have enough info to understand what you're trying to do. What's in those tags? URLs? If you just need to display images from URLs then use MediaTracker or ImageIcon. If you have to watch for changes in a file, look at File and related classes in io package. You might have to start a thread which keeps its eye on file dates.
     
    • Post Reply
    • Bookmark Topic Watch Topic
    • New Topic