Solved

Adding semi-transparent image on BufferedImage

Posted on 2003-10-31
5
691 Views
Last Modified: 2007-12-19
I recently wrote a little servlet that adds a semi-transparent copyright message on top of any image displayed on a web-site.
It works pretty well, using the BufferedImage.getGraphics() method and then using Graphics.drawString().

Now the client would like to use their logo instead of a text string as the semi-transparent "watermark".

Can anyone tell me where I could find the proper classes and methods to draw a semi-transparent image (shape) on top of an existing image?

I was looking at Graphics.drawImage(...) and Graphics2D.fill(Shape s)

The former does not seem to offer the capability to specify a transparency and the later would work if I hade a Shape, that specified the borders of the logo.
However, how do I turn their Logo into a Shape object? Is there a way to read a Shape in from an EPS (vector) file or something like it?

Or should I look somewhere else?
0
Comment
Question by:Bohumil
[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
5 Comments
 
LVL 92

Expert Comment

by:objects
ID: 9661284
You need to first filter the image you want to add required level of transparency.
0
 
LVL 92

Accepted Solution

by:
objects earned 500 total points
ID: 9661289
Here's an example of how to filter an image:

http://www.javaalmanac.com/egs/java.awt.image/FilterRgb.html?l=find
0
 
LVL 92

Expert Comment

by:objects
ID: 9661326
And then use drawImage() to paint the filtered semi-transparent image onto the destination image.
0
 

Author Comment

by:Bohumil
ID: 9667145
Who'd a thunk It'd be that easy!

Thanks a lot, objects!!!!
0
 
LVL 92

Expert Comment

by:objects
ID: 9667271
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone 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

Java Flight Recorder and Java Mission Control together create a complete tool chain to continuously collect low level and detailed runtime information enabling after-the-fact incident analysis. Java Flight Recorder is a profiling and event collectio…
Introduction This article is the first of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article explains our test automation goals. Then rationale is given for the tools we use to a…
Viewers learn about the third conditional statement “else if” and use it in an example program. Then additional information about conditional statements is provided, covering the topic thoroughly. Viewers learn about the third conditional statement …
Viewers learn about the scanner class in this video and are introduced to receiving user input for their programs. Additionally, objects, conditional statements, and loops are used to help reinforce the concepts. Introduce Scanner class: Importing…
Suggested Courses

751 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