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
6
votes
1 answer

BufferedImage, same image after conversion to byte array and back, but different after grey conversion

I need to convert BufferedImages (RGB, no artefacts) to byte arrays for sending. While unit testing I stumbled over a problem with either BufferedImage, my expectation, or my code. A BufferedImage converted to a byte array and back yields after…
pba
  • 524
  • 3
  • 13
6
votes
1 answer

How to increase the resolution of image in PDF renderer?

I want to increase the resolution of a image. I used PDFRenderer-0.9.0 jar . It is downloaded from java.net for converting PDF pages to images. I want to Convert 46_2.pdf PDF file to image . The converted 46_2.png image is small with dimensions…
UdayKiran Pulipati
  • 6,579
  • 7
  • 67
  • 92
6
votes
2 answers

Pipe series of images from java application to ffmpeg subprocess

I am looking for a way to stream series of images (jpegs) from java application into FFMpeg STDIN pipe. FFMpeg should process these images and create a video file as an output. FFMpeg is executed as sub process of java application with the following…
Marco
  • 3,337
  • 2
  • 19
  • 25
6
votes
4 answers

Fastest way to compare pixel values between two BufferedImages?

I have a BufferedImage of type TYPE_INT_BGR. I need to do a pixel-by-pixel comparison to another BufferedImage to compute the "distance" between the two images. I have something that works, but is slow. I get a pixel from the "reference" image,…
George Armhold
  • 30,824
  • 50
  • 153
  • 232
6
votes
4 answers

Save image from JPanel after draw

I'm newbie in jave, my first project is draw, and save a image from JPanel, my draw is done, but I cant save it after I draw in JPanel :(, So can you help me to fix it when I open the image after draw, It doesn't contain anything :( here my codes:…
Đăng Nguyễn
  • 122
  • 1
  • 3
  • 9
6
votes
3 answers

Java Compare one BufferedImage to Another

I need to compare two buffered images to see if they are the exact same. Simply saying if that equals that doesn't work. My current method is { Raster var1 = Img1.getData(); Raster var2 =…
RADXack
  • 1,032
  • 3
  • 11
  • 17
6
votes
2 answers

What is the difference between the ways to read an Image file in Java?

There are various ways of reading an image file in java such as BufferedImage and ImageIcon to name a few. I want to know what is the difference between these cases? Are they context dependent that in a particular case only one of them can be…
6
votes
1 answer

Copy specific part of a bufferimage into another bufferimage

I have one big buffer image. I want to create another buffer image with the data from the first one I tried making a raster with buffer.getData(new Rectangle(x,y,width,height)) And then buffer2.setData(raster) But from reason the data is translated…
adrix89
  • 490
  • 5
  • 13
6
votes
2 answers

Which Image to Use

I've read the java api, but I still do not understand the main difference between: 1) ImageIcon 2) BufferedImage 3) VolatileImage 4) Image Can someone tell me when each one is used?
Anonymous181
  • 1,863
  • 6
  • 24
  • 27
6
votes
2 answers

How to draw an image over another image?

I have a Java project that's about traffic network simulation in a random city, I've managed to figure out a way to implement this project, so I divided each intersection into a section which is basically an extended JPanel class (named…
DZkid
  • 149
  • 1
  • 3
  • 9
5
votes
4 answers

Resizing an image in swing

I have snippet of code that I am using for the purpose of resizing an image to a curtain size (I want to change the resolution to something like 200 dpi). Basically the reason I need it is because I want to display the image that the user have…
Paul Kar.
  • 1,293
  • 2
  • 21
  • 32
5
votes
3 answers

Java2D/Swing: Rendering a component with text anti aliasing to a BufferedImage

I would like to render a Java Swing component, e.g. a JButton, which I also put on a JFrame, to a BufferedImage. This works in general, but with a major drawback: Text anti aliasing, especially "LCD" anti aliasing mode, is not working when rendering…
It's Leto
  • 968
  • 4
  • 17
  • 25
5
votes
2 answers

Display image from 2D array data in java

I have some data that is loaded from the text file that corresponds to my image file. this data is now in a 2D array. I want to show this image. apparently the image show be of format bufferedimage. but mine is just simple 2D double format. Also how…
user1016048
  • 51
  • 1
  • 2
5
votes
1 answer

BufferedImage & createScreenCapture produces wrong colors

In my Java program I need to analyze a color of a pixel in given coordinates. Because of the fact that I need to do it often, first I capture a part of the screen, and then get a pixel color. I am doing this with: BufferedImage bi =…
Quest
  • 51
  • 2
5
votes
1 answer

How do I desaturate a BufferedImage in Java?

What's the simplest way to desaturate a BufferedImage?
Dycey
  • 4,767
  • 5
  • 47
  • 86