This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes Blending images using arrays Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Blending images using arrays" Watch "Blending images using arrays" New topic
Author

Blending images using arrays

John Jefferson
Greenhorn

Joined: Dec 04, 2011
Posts: 1
Hi, I'm trying to blend images together and display them. Right now it is not displaying the images. I need help figuring out the blendImages method. Any help is appreciated.

Stephan van Hulst
Bartender

Joined: Sep 20, 2010
Posts: 3573
    
  14

You're never actually blending pixels. You just create a new array, read all it's pixels to an int which you immediately discard, and then you return a new image of the new (black) array.

Maybe in your for loop, you should blend the pixels in the original two images, and then assign them to the corresponding cell in the new array, before you create an image out of it.

I would also suggest the new image's clip becomes the union of the original two images' clips. That means, make it's width the same as the widest of the two original images, and the same for the height.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Blending images using arrays
 
Similar Threads
How to group these JLabels?
Problem in reloading graphics object.
How to display Text String at the bottom of JLabel??
Bouncing balls
animation