Search...
FAQs
Subscribe
Pie
FAQs
Recent topics
Flagged topics
Hot topics
Best topics
Search...
Search within Beginning Java
Search Coderanch
Advance search
Google search
Register / Login
Post Reply
Bookmark Topic
Watch Topic
New Topic
programming forums
Java
Mobile
Certification
Databases
Caching
Books
Engineering
Micro Controllers
OS
Languages
Paradigms
IDEs
Build Tools
Frameworks
Application Servers
Open Source
This Site
Careers
Other
Pie Elite
all forums
this forum made possible by our volunteer staff, including ...
Marshals:
Campbell Ritchie
Jeanne Boyarsky
Ron McLeod
Paul Clapham
Liutauras Vilda
Sheriffs:
paul wheaton
Rob Spoor
Devaka Cooray
Saloon Keepers:
Stephan van Hulst
Tim Holloway
Carey Brown
Frits Walraven
Tim Moores
Bartenders:
Mikalai Zaikin
Forum:
Beginning Java
Combining many images into a big one
Jon Mattson
Greenhorn
Posts: 19
posted 18 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
I'd like to load four equal sized images from .png files and combine them to one big image. How do I do that?
I tried by painting all four images to a Graphic but I didn't find a way to convert a Graphic to an Image, is there a way?
Joe Ess
Bartender
Posts: 9626
16
I like...
posted 18 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
You don't convert a Graphics to an Image, you use the Graphics context of an Image to paint onto the Image:
image = new BufferedImage(width, height, type); Graphics g = image.createGraphics(); // do the following for each of your images, changing x and y g.drawImage(image, 0, 0, null); // don't forget to clean up g.dispose();
Your code may vary depending on how you are creating the image and other details.
[
How To Ask Questions On JavaRanch
]
Jeff Albertson
Ranch Hand
Posts: 1780
posted 18 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
For more info, take the
graphics tutorial
.
There is no emoticon for what I am feeling!
reply
reply
Bookmark Topic
Watch Topic
New Topic
Boost this thread!
Similar Threads
BlueJ Error Message Please Help
Failed to load byte array of an png image into an midp application
several animation frames in one file, transparency issues
DISPLAYING IMAGE
Button state tracking
More...