?
Solved

merging images

Posted on 2005-03-27
7
Medium Priority
?
185 Views
Last Modified: 2010-03-31
I have some images 100x100 and I want to replace the area in the top left corner 20x20 with a different image.  I'm using Java 1.1.8 so I can't use buffered images to handle this.  What is another way to accomplish this?

Thanks,
David
0
Comment
Question by:lomidien
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 2
7 Comments
 
LVL 86

Expert Comment

by:CEHJ
ID: 13639127
I think this library supports 1.1. If there is no built-in method to do what you want, simply paint the new image over the old using the same graphics context then save it to file:

http://rsb.info.nih.gov/ij/index.html
0
 

Author Comment

by:lomidien
ID: 13640006
I had already tried using the Graphics context by caling .getGraphics() and issuing paint commands, however I get the following error:

getGraphics() not valid for images created with createImage(producer)

I'm using getImage() to get the image from a file and I don't understand why this error would happen.....I'm doing this in an applet if that makes any difference.

Thanks,
David
0
 
LVL 86

Accepted Solution

by:
CEHJ earned 2000 total points
ID: 13640093
Try calling createImage and then call getGraphics on that. draw both images to *that* graphics context
0
Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

 
LVL 92

Expert Comment

by:objects
ID: 13640522
Create a new blank image, and paint your loaded image to that one. Then paint your 20x20 tile on that image.
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 13640551
>> Create a new blank image ..

Already said that ;-)
0
 
LVL 92

Expert Comment

by:objects
ID: 13640596
Can you also please post how you are loading the image, and from where exactly.
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 13854984
:-)
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

An old method to applying the Singleton pattern in your Java code is to check if a static instance, defined in the same class that needs to be instantiated once and only once, is null and then create a new instance; otherwise, the pre-existing insta…
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
This theoretical tutorial explains exceptions, reasons for exceptions, different categories of exception and exception hierarchy.
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
Suggested Courses
Course of the Month12 days, 4 hours left to enroll

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question