Questions tagged [bufferedimage]

The Java class BufferedImage is used to read and manipulate images and assist in double-buffering in desktop GUI applications.

The java.awt.image.BufferedImage Java class is part of the Abstract Windowing Toolkit group of classes that form part of the standard JDK.

The BufferedImage class contains methods to manipulate pixel values and is also used for double-buffering in applications that have a Java Swing GUI.

2150 questions
7
votes
5 answers

What is the fastest way to draw pixels in Java

I have some code that generates particles at random locations, and moving in random directions and speed. Each iteration through a loop, I move all the particles, and call repaint on my jpanel. For 1,000 particles, I'm getting around 20 to 30 frames…
Lance Wentz
  • 89
  • 1
  • 5
7
votes
2 answers

JFrame to image without showing the JFrame

I am trying to render a JFrame to an image without ever displaying the JFrame itself (similar to what this question is asking). I have tried using this piece of code: private static BufferedImage getScreenShot(Component component) { …
npinti
  • 51,780
  • 5
  • 72
  • 96
7
votes
3 answers

Drawing a Component to BufferedImage causes display corruption

I am using the JScrollNavigator component described here, in order to provide a navigation window onto a large "canvas-like" CAD component I have embedded within a JScrollPane. I have tried to adapt the JScrollNavigator to draw a thumbnail image of…
Adamski
  • 54,009
  • 15
  • 113
  • 152
7
votes
3 answers

how do I scale a BufferedImage

I have viewed this question, but it does not seem to actually answer the question that I have. I have a, image file, that may be any resolution. I need to load that image into a BufferedImage Object at a specific resolution (say, for this example,…
ewok
  • 20,148
  • 51
  • 149
  • 254
7
votes
1 answer

Eclipse plugin to view image while debugging

Is there an Eclipse plugin that will let me view an image variable while I'm paused at a breakpoint? e.g. I would like to see the image when inspecting a BufferedImage object instead of seeing it's toString value.
Ajay
  • 763
  • 5
  • 17
7
votes
3 answers

How can i find out where a BufferedImage has Alpha in Java?

I've got a BuferredImage and a boolean[][] array. I want to set the array to true where the image is completely transparant. Something like: for(int x = 0; x < width; x++) { for(int y = 0; y < height; y++) { alphaArray[x][y] =…
Rapti
  • 2,520
  • 3
  • 20
  • 23
6
votes
2 answers

Convert short[] into a grayscale image

I am writing a Buddhabrot fractal generator using aparapi. I got the OpenCL part of it to work, resulting in a single-dimension array that represents each pixel. I have the dimensions of the final image as final ints, and have written code to get…
Shawn Walton
  • 1,714
  • 2
  • 14
  • 23
6
votes
1 answer

Java BufferedImage saves with unwanted background color

Thanks ahead of time for the help Description: The program draws, displays, and saves an image. It works as following: the object itself extends Frame. In the constructor, the object creates a BufferedImage, and calls a method that draw onto that…
whearyou
  • 358
  • 1
  • 5
  • 18
6
votes
3 answers

How to add 20 pixels of white at the top of an existing image file?

I have an image of size w by h. In Java, I need to create an image that is size w by h+20 where the top w by 20 pixels is white, and the rest of the image is the same as the original image. Essentially I want to know how I can add 20 pixels of white…
CodeGuy
  • 28,427
  • 76
  • 200
  • 317
6
votes
3 answers

BufferedImage in Android

I've an app that takes a camera picture and saves on sdcard as jpeg. i want to distort the picture with a spherize filter. I can read the jpeg to a bitmap, but the code i have found that does the distortion distorts a bufferedimage. i understand…
turtleboy
  • 8,210
  • 27
  • 100
  • 199
6
votes
2 answers

Storing Serializable object to file with some data excluded

I have an object which allows me to store BufferedImage into my object file. In the same object I have BufferedImage variable which I use to cache the image after it's loaded first time from raw data array. Everything works fine when I'm creating…
Serhiy
  • 4,073
  • 3
  • 36
  • 66
6
votes
2 answers

Working in a BufferedImage's int[] pixels array

When working with BufferedImage using the setRGB and getRGB methods, I noticed two things: the setRGB and getRGB methods can be incredibly slow on some systems (as much as two orders of magnitude slower than modifiyng the int[] array). there are no…
SyntaxT3rr0r
  • 27,745
  • 21
  • 87
  • 120
6
votes
2 answers

How to get a BufferedImage from a Component in java?

I know how to get a BufferedImage from JComponent, but how to get a BufferedImage from a Component in java ? The emphasis here is an object of the "Component" type rather than JComponent. I tried the following method, but it return an all black…
Frank
  • 30,590
  • 58
  • 161
  • 244
6
votes
1 answer

BufferedImage color saturation

I'm writing a simple scanning application using jfreesane and Apache PDFBox. Here is the scanning code: InetAddress address = InetAddress.getByName("192.168.0.17"); SaneSession session = SaneSession.withRemoteSane(address); List devices…
Vladimir M.
  • 1,049
  • 1
  • 10
  • 24
6
votes
2 answers

BufferedImage : extract subimage with same data

I would like to extract a rectangle of a BufferedImage. Javadoc propose getSubImage(x,y,w,h) and getData(rectangle). getData is cool but I don't want only the raster. I want the subimage as a BufferedImage object but I also need a modified version…
user4492397