Meaningless Drivel is fun!*
The moose likes Swing / AWT / SWT and the fly likes BufferedImage(s) 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 » Swing / AWT / SWT
Bookmark "BufferedImage(s) " Watch "BufferedImage(s) " New topic
Author

BufferedImage(s)

Lucas Smith
Ranch Hand

Joined: Apr 20, 2009
Posts: 804
    
    1

Hallo everyone. I'm just a newbe so please be patient .
I've a problem. I write Graphics Editor and I use BufferedImages as layers. I'd like to save a couple of BufferedImages' objects in one file. Moreover I'd like to move one BufferdImage object to another one - layers' integration.
Any ideas?
Thanks in advance.


SCJP6, SCWCD5, OCE:EJBD6.
BLOG: http://leakfromjavaheap.blogspot.com
Maneesh Godbole
Saloon Keeper

Joined: Jul 26, 2007
Posts: 10171
    
    8

Hi Lukas,
Welcome to the Ranch.

Check out ImageIO#write to save your images.
How are you rendering your layers? Do all the layers share the same graphics object?
You might find this useful
http://blog.elevenworks.com/?p=2

[How to ask questions] [Donate a pint, save a life!] [Onff-turn it on!]
Lucas Smith
Ranch Hand

Joined: Apr 20, 2009
Posts: 804
    
    1

I mean something like that:


I have an array of BufferedImages an I'd like to put them together on one BufferedImage object and save it to file.
Lucas Smith
Ranch Hand

Joined: Apr 20, 2009
Posts: 804
    
    1

Noone knows?
Maneesh Godbole
Saloon Keeper

Joined: Jul 26, 2007
Posts: 10171
    
    8

Did you check out the link I posted?
It shows how to have multiple layers in one image. Does it help?
Lucas Smith
Ranch Hand

Joined: Apr 20, 2009
Posts: 804
    
    1

I can't find anything about layers
Maneesh Godbole
Saloon Keeper

Joined: Jul 26, 2007
Posts: 10171
    
    8

There is a link in there where you can download the source code.
Download and study the source code, especially the paintComponent()
Lucas Smith
Ranch Hand

Joined: Apr 20, 2009
Posts: 804
    
    1

OK, I've studied it. Unfortunately I haven't found the answer. The author uses similar way to mine with showing BufferdImage object, but he has only one BufferedImage object, he invokes createGraphics() on it and he gets the context to draw. Then he invokes g2.drawImage to show the object.
I can invoke g2.drawImage inside the "for loop" to show a few of BufferedImage's objects. It's OK, but the problem is when I want to save those objects to one JPG or PNG file. The static method of ImageIO takes only one BufferedImage object.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: BufferedImage(s)
 
Similar Threads
Using a spritesheet
AJAX, Swing doubts
Sliding door like behavior
Is there a better way to blend colors when painting with Graphics2D?
Multipage HTML Forms