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
2 answers

Stripping Alpha Channel from Images

I want to strip the alpha channel (transparent background) from PNGs, and then write them as JPEG images. More correctly, I'd like to make the transparent pixels white. I've tried two techniques, both of which fail in different ways: Approach…
Rob
  • 5,512
  • 10
  • 41
  • 45
6
votes
1 answer

Blur an image using java.util.concurrent, however, the resulting image is entirely black

I'm new to Java and is trying to learn the concept of high level concurrency. I saw this code at Java Tutorial Oracle. However, when I run the code, the IDE output an image that is entire black. Why is this happening? And also, how is the compute()…
Thor
  • 9,638
  • 15
  • 62
  • 137
6
votes
1 answer

JavaFX: Fastest way to write pixels to PixelWriter

I'm looking for the fastest way to write pixels on javafx.scene.image.Image. Writing to BufferedImage's backing array is much faster. At least on the test image I made it took only ~20ms for BufferedImage, WritableImage on the other hand took…
Ezekiel Baniaga
  • 853
  • 1
  • 12
  • 26
6
votes
1 answer

Convert JPG to PNG with background transparency

While Converting from JPG to PNG background transparency Image , I don't want a dotted border at converted image My Original Image (JPG) My Converted Image (PNG) My source code is import java.awt.Color; import java.awt.Graphics2D; import…
Panchotiya Vipul
  • 1,226
  • 5
  • 17
  • 42
6
votes
1 answer

Dynamically resize a bufferedimage in java

I tried resizing the buffered image using AffineTransform as well as Scalr.resize Here are my codes for both of them. using Scalr.resize: BufferedImage buff = robot.createScreenCapture(new Rectangle(bufx,bufy,bufwidth,bufheight)); // x-coord,…
6
votes
1 answer

JavaCV - Why IplImage.createFrom(image) doesn't exist anymore?

I'm working with JavaCV at the moment, to try some simple blob detection. I'm using maven and got JavaCV 0.11 (more specific org.bytedeco.javacv) from their repositories. Everything compiles without errors and works fine, but the method to create an…
user3262883
  • 119
  • 7
6
votes
2 answers

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

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…
Huinan
  • 116
  • 1
  • 4
6
votes
2 answers

Converting BufferedImage to ByteBuffer

I'm trying to convert a Buffered image into a ByteBuffer but i get this exception java.awt.image.DataBufferInt cannot be cast to java.awt.image.DataBufferByte can someone please help me out and suggest a good method of conversion. Source: public…
Sumal Perera
  • 297
  • 1
  • 3
  • 6
6
votes
4 answers

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…
finnw
  • 47,861
  • 24
  • 143
  • 221
6
votes
1 answer

Java BufferedImage memory consumption

Our application generates images. The memory consumed by BufferedImage generates an out of memory exception: java.lang.OutOfMemoryError: Java heap space This happens with the following line: BufferedImage result = new BufferedImage(2540, 2028,…
Tom
  • 1,375
  • 3
  • 24
  • 45
6
votes
2 answers

What are tiles and how are they created in the BufferedImage

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:…
Eddy Freeman
  • 89
  • 1
  • 1
  • 2
6
votes
2 answers

Pink/Reddish tint while resizing jpeg images using java thumbnailator or imgscalr

I am trying to convert an image (url below) using two libraries (thumbnailator and imgscalr. My code works on most of the images except a few which after conversion have a pink/reddish tint. I am trying to understand the cause and would welcome any…
rohtakdev
  • 956
  • 1
  • 13
  • 16
6
votes
2 answers

How to make gradient border of an image using java?

How can I make an image border as gradient. I googled a lot, but didn't find correct suggestion. Any one can help me... Any suggestion please...
6
votes
1 answer

Java colour detection

Im looking to implement a feature in Java which reads an image and is able to detect where there are shades of red, blue, green, yellow, etc. as part of a satellite image analysis program. So for example in a standard satellite image, blue would be…
user2517280
  • 221
  • 1
  • 5
  • 14
6
votes
2 answers

Android alternative to java.awt (BufferedImage and Raster)

for my final year project I am developing an android app that can capture the image of a leaf and identify what type of tree it came from. I have a nearly completed PC version (developed in java) and i am starting the process of porting it to…
John
  • 77
  • 1
  • 5