Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4

Thread: Output image

  1. #1
    Regular Coder
    Join Date
    Oct 2011
    Posts
    106
    Thanks
    12
    Thanked 0 Times in 0 Posts

    Output image

    How can I make a java applet that will, upon pressing the "save" button (I can make that), will save the visual output output as a PNG image file and (if possible/ideally) exclude the menu bar (the text input items, generate image button and save image button)? I want to make a puzzle (working on that. I want to give myself a chance before I ask for help) and save it as an image (or pdf, but too much stuff to do to make the encoder, and I can just tell them to use PDFCreator or something: why this will be a free software, besides the fact that I barely know what I'm doing)
    Last edited by Scriptr; 12-18-2011 at 03:06 AM.

  • #2
    Regular Coder
    Join Date
    Oct 2011
    Posts
    106
    Thanks
    12
    Thanked 0 Times in 0 Posts

    Perhaps this would be easier:

    How can I display a buffered image on the screen, and how do you save it?

  • #3
    God Emperor Fou-Lu's Avatar
    Join Date
    Sep 2002
    Location
    Saskatoon, Saskatchewan
    Posts
    16,978
    Thanks
    4
    Thanked 2,659 Times in 2,628 Posts
    You can use a back buffer to create the drawing space. Effectively, its identical to using the Graphic from a method like paint, except you store an instance of Image and Graphic in the object itself. Then when you paint, you simply force the use of the instance graphic instead, and draw it into the Graphics provided.
    I'd typically use Graphics and Image to deal with a back buffer, but (I believe it will work anyway :/) you should be able to use a BufferedImage if you want. Writing is trivial, that is just an ImageIO.write call. Just google up Java Backbuffer tutorial, and you'll find a few techniques to do this.
    If you use a Image though, you will need to convert it. I just found this method for converting which looks okay, but I have no idea of the age: http://www.exampledepot.com/egs/java...image2buf.html

  • Users who have thanked Fou-Lu for this post:

    Scriptr (12-20-2011)

  • #4
    Regular Coder
    Join Date
    Oct 2011
    Posts
    106
    Thanks
    12
    Thanked 0 Times in 0 Posts
    I don't need to import an image; I need to generate one, which it appears from what you have said, I can do with this.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •