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
4
votes
3 answers

Reading PNG pixels using PNGJ without BufferedImage

I've been struggling on trying to do the equivalent code using PNGJ. I don't want to use ImageIO.read and BufferedImage.getRGB. Instead I want to get the pixels purely using PNGJ. The code below was my ImageIO+BufferedImage version. BufferedImage…
Ezekiel Baniaga
  • 853
  • 1
  • 12
  • 26
4
votes
1 answer

How can I more quickly render my array?

I have been working on a nonogram solver in Java, and all of my algorithm works fine, but I have been struggling with the visualization a little bit. During the execution of the algorithm, I have access to two "solution-arrays". One is of type…
konewka
  • 620
  • 8
  • 21
4
votes
1 answer

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.
4
votes
2 answers

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…
I82Much
  • 26,901
  • 13
  • 88
  • 119
4
votes
1 answer

How do I read a TIFF image in Java into a BufferedImage?

I was having a problem where my image analysis program would crash whenever I used TIFF images. I found that the problem was that BufferedImage img = ImageIO.read(file) was returning null, even though the file existed. With some extra research, I…
Thomas Woltjer
  • 363
  • 1
  • 4
  • 12
4
votes
1 answer

How to change the color of BufferedImage with #000000 format?

Using BufferedImage I create an image and paint it with darkGray color: BufferedImage image = new BufferedImage(width, height, BufferedImage.TYPE_INT_ARGB_PRE); Graphics2D graphics = image.createGraphics(); Color darkGray = new Color(44, 47,…
Dylan
  • 935
  • 1
  • 11
  • 24
4
votes
1 answer

Set pixels of BufferedImage as transparent

How can I quickly and efficiently set all pixels of a BufferedImage to transparent so that I can simply redraw what sprite graphics I want for each frame? I am designing a simple game engine in java that updates a background and foreground…
aaroncarsonart
  • 1,054
  • 11
  • 27
4
votes
1 answer

Smooth BufferImage edges

Is there a way to smooth the jagged edges of a transformed (translated and rotated) BufferedImage? A zoomed in view of a test image: (Note that this is not the actual BufferedImage that will be used, only for demonstrating here). Bilinear…
H3katonkheir
  • 664
  • 1
  • 7
  • 21
4
votes
1 answer

How can I modify the map of a Java IndexColorModel?

I want to change one single color (yellow, to be somewhat specific) to another color in a BufferedImage which was loaded from a .GIF file. I should be able to do it easily enough with getRGB and setRGB, but it would much more efficient if I could…
Bruce Feist
  • 621
  • 5
  • 10
4
votes
3 answers

How to replace color with another color in BufferedImage

So I have an image file that has a volcano on it. Everything else is 0xFFFF00FF (opaque magenta). I want to replace every pixel that contains that color with 0 (transparent). So far my method looks like this: public static BufferedImage…
Jerfov2
  • 5,264
  • 5
  • 30
  • 52
4
votes
3 answers

Getting Greyscale pixel value from RGB colourspace in Java using BufferedImage

Anyone know of a simple way of converting the RGBint value returned from getRGB(i,j) into a greyscale value? I was going to simply average the RGB values by breaking them up using this; int alpha = (pixel >> 24) & 0xff; int red =…
Bolster
  • 7,460
  • 13
  • 61
  • 96
4
votes
4 answers

Will Perl be the bottleneck in this kind of image processing?

The processing I have in mind is this: there are thousands of png files each of them should be loaded, and its pixels accessed each pixel's channels will be processed in some way, and then written to a binary file I was thinking of using some sort…
Geo
  • 93,257
  • 117
  • 344
  • 520
4
votes
2 answers

Performing setRGB on BufferedImage changes pixel to black instead of color

** Important update, see below! ** I am creating a program that changes the pixels of a BufferedImage to a certain color when that pixel fulfills a set of conditions in Java. However, when I write the image to disk, the pixels that should be colored…
itsmichaelwang
  • 2,282
  • 4
  • 16
  • 25
4
votes
4 answers

how can I convert an image to grayscale without losing transparency?

I am having problems converting a colored image with some transparent pixels to grayscale. I have searched and found related questions on this website but nothing I have been able to use to solve my problem. I have defined a method "convertType" as…
user3204892
  • 41
  • 1
  • 3
4
votes
1 answer

Do certain image file types always correspond with certain BufferedImage constant types?

The BufferedImage class in Java contains a getType() method which returns an integer correlating with a BufferedImage constant type variable describing some information about how the image is encoded (you can look at the BufferedImage source to…
Thunderforge
  • 19,637
  • 18
  • 83
  • 130