bufferedimage

Java BufferedImage getting red, green and blue individually

The getRGB method returns a single int. How can I get individually the red, green and blue colors all as values between 0 and 255? ...

Transparency in bufferedimage objects.

Hi there. I noted that when i draw something with Color(0,0,0,0), which is over another image, the color shown is the JFrame background, not the image just below it. Reasons that'd help me to find a solution? Thanks!! Edit: See the circles, the grey area (corners) should be transparent but are not, instead, they are the color of the J...

Using Graphics2D to overlay text on a BufferedImage and return a BufferedImage

I have checked similarly named questions, but they don't answer this use case. Basically, I was to overlay some text (text) at a given coordinate (x,y) I have the below function in a package; protected BufferedImage Process2(BufferedImage image){ Graphics2D gO = image.createGraphics(); gO.setColor(Color.red); gO.setFont(new...

How to work with BufferedImage and YCbCr colorspace?

Hi everyone! I need to translate colors in bitmap loaded to BufferedImage from RGB to YCbCr (luminance and 2 channels chrominance) and back after process. I made it with functions used like rgb2ycbcr() in main method for each pixel, but it isn't so smart solution. I should use ColorSpace and ColorModel classes to get BufferedImage with...

BufferedImage Help

I posted a question in sun java forums sometime ago and i am finding it hard to understand the first response i received from the replier though it seems he gave me the correct approach to my problem. The link to the question is: http://forums.sun.com/thread.jspa?threadID=5436562&tstart=0 Someone replied that i should use Buffered...

Rotating A Tile In A BufferedImage

I have created a a bufferedImage of 6 tiles of 2 rows and 3 columns and i want to rotate the last tile of the second row. This tile serves as a crossing for my animation. My problems are : How can i get access to that specifc tile alone and rotate it alone without affecting others. I have googled for a while but no answer. ...

Java: how to do fast copy of a BufferedImage's pixels? (unit test included)

I want to do a copy (of a rectangle area) of the ARGB values from a source BufferedImage into a destination BufferedImage. No compositing should be done: if I copy a pixel with an ARGB value of 0x8000BE50 (alpha value at 128), then the destination pixel must be exactly 0x8000BE50, totally overriding the destination pixel. I've got a ve...

JFrame does not refresh after deleting an image

Hi! I'm working for the first time with images in a JFrame, and I have some problems. I succeeded in putting an image on my JFrame, and now i want after 2 seconds to remove my image from the JFrame. But after 2 seconds, the image does not disappear, unless I resize the frame or i minimize and after that maximize the frame. Help me if you...

Safe to update separate regions of a BufferedImage in separate threads?

I have a collection of BufferedImage instances, one main image and some subimages created by calling getSubImage on the main image. The subimages do not overlap. I am also making modifications to the subimage and I want to split this into multiple threads, one per subimage. From my understanding of how BufferedImage, Raster and DataBu...

BufferedImage.getGraphics() resulting in memory leak, is there a fix?

Hi friends, I'm having problem with some framework API calling BufferedImage.getGraphics() method and thus causing memory leak. What this method does is that it always calls BufferedImage.createGraphics(). On a windows machine, createGraphics() is handled by Win32GraphicsEnvironment which keeps a listeners list inside its field display...

How to use TYPE_BYTE_GRAY to efficiently create a grayscale bufferedimage using AWT

I need to create a grayscale image from data in an nio ShortBuffer. I have a function that maps the data in the ShortBuffer to unsigned byte but is in an int (easily changed). The method I found uses an RGB plus transparency color model and appears to be quite inefficent. i have not been able to see how to apply the TYPE_BYTE_GRAY and...

for heavy graphics apps in c# which will be more efficient double buffering or Buffered Graphics?

hello i have a heavy graphics application where i have to draw the graphics in 2-10 seconds every time this time varies depending upon the source application which is sending data to my application via UDP; i have some static graphics there is no change in them some are semi dynamic that means some time they are updated and normally rem...

Rotating A Specific Tile In A BufferedImage Made Of Tiles

Hello Guys, I am trying to rotate a tile in a BufferedImage(the bufferedimage is made up of tiles) but i got stuck and don't seem to find the answer. I have googled for hours but can't find any tutorials. So i decided to come here for help. I want to rotate the crossing(tile) at the bottom right of the buffered image. I want to rotate...

Scala - how to explicitly choose which overloaded method to use when one arg must be null?

All, I'm doing some image manipulation in Scala by making use of BufferedImages and Raster objects. I am attempting to get all the pixels in the buffered image with the following code. val raster = f.getRaster() // Preallocating the array causes ArrayIndexOutOfBoundsException .. http://forums.sun.com/thread.jspa?threadID=5297789 // R...

Fastest way to draw BufferedImages to another BufferedImage

I am attempting to create a mosaic of images in Java. I calculate the size of the new image I'm creating, and then for each subimage that will be part of the mosaic, I do a paint call. In pseudocode: create buffered image big enough to hold entire mosaic create Graphics2D context from that image for each buffered subimage that will...

urgent Attention Required-hadoop: BufferedImage and ConvolveFilter-->JHLabs:

sorry to disturb again but i like learning here. i am using JHLabs library on filters for buffered images.on running my code i am getting this exception:L java.lang.ArrayIndexOutOfBoundsException: 4 at com.jhlabs.image.ConvolveFilter.convolveHV(ConvolveFilter.java:175) at com.jhlabs.image.ConvolveFilter.convolve(ConvolveFilter.j...

How to recognize a blank/invisible image using java

I was wondering if it would be possible to recognize that a BufferedImage in java is a blank (invisible for a user in a browser) image. ...

Java BufferedImage padding.

Is there any faster way to achieve padding of pixels to a BufferedImage than drawing it centered on larger BufferedImage? ...

Differences between Bitmaps and BufferedImages

I am trying to port some code from a regular java program into the android platform. Unfortunately, a significant part of the program involves manipulating images, and java's awt was taken away from me. I am trying to replace awt.BufferedImage with a Bitmap, and was hoping that the only differences between the two classes would be their ...

Need Help In Solving Rotation Image Problem

Hi guys , I need your help please. I have spent hours trying to solve it but not working. I have an image i am rotating when the user clicks on a button. But it is not working. I would like to see the image rotating gradually till it stops but it doesn't. This it what it does. After i click the button, i don't see it rotating. But wh...