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
18
votes
5 answers

Save buffered image with transparent background

I'm saving the image of a signature as a .jpg picture. I use graphic2d to paint on the image every pixel of the signature (gotten with a signature tablet) and it works perfectly but I'm always gettin a white background. If I want to put the…
Igr
  • 965
  • 4
  • 13
  • 26
17
votes
2 answers

Manipulate an image without deleting its EXIF data

Using imageIO, I usually have the problem of transforming an image file, and after overwriting it, it loses all of its EXIF data. Is there any way to preserve it without first extracting it, caching it, and then resetting it?
Preslav Rachev
  • 3,983
  • 6
  • 39
  • 63
17
votes
3 answers

Converting a series of BufferedImages to a video in Java?

How would I convert an an array of BufferedImages into a video? I'm making a screen recorder. How would I compress the video afterward?
user263078
16
votes
2 answers

bufferedImage.getRGB(x, y) does not yield alpha

I've got a BufferedImage i and I'd like to get the Color from a certain pixel of that image including the alpha value. The pixel is identified using x and y coordinates. Here's what I tried: Color c = new Color(i.getRGB(x, y)); For some reason, the…
Rapti
  • 2,520
  • 3
  • 20
  • 23
15
votes
9 answers

Re-sizing an image without losing quality

I made this code to resize images with two factors. It works, but the quality of image is very bad after it is resized! Can you help me? This is the code public class ImageTest { private static final int factor1 = 3; private static final int…
Jayyrus
  • 12,961
  • 41
  • 132
  • 214
15
votes
1 answer

How to decide which BufferedImage image type to use?

Java BufferedImage class has a long list of class variables known as the image type which can be used as an argument for the BufferedImage constructor. However, Java docs did a minimal explanation what these image types are used for and how would it…
user3437460
  • 17,253
  • 15
  • 58
  • 106
15
votes
4 answers

How to save file using JFileChooser?

I have a method in my application called "Save as" which Saves the image of my application on computer my into a file. I used the JFileChooser to let the users choose their desired location for saving the file. The problem is unless user explicitly…
Lokesh Kumar
  • 682
  • 2
  • 8
  • 27
15
votes
2 answers

Convert JavaFX image To BufferedImage

I'm trying to convert an JavaFX Image(from ImageView) to an BufferedImage. I tried casting and stuff but nothing works. Can someone suggest how i should do this?
Piet Jetse
  • 388
  • 1
  • 5
  • 16
15
votes
12 answers

java.lang.IllegalArgumentException: input == null! when using ImageIO.read to load image as bufferedImage

This is a question that has been asked like 100 times on this site, but I have looked at all of them and even though they all were solved, none of the solutions worked for me. Here's what my code looks like: public Button1(Client client, String…
tyler
  • 589
  • 2
  • 5
  • 9
15
votes
4 answers

Using BufferedImage and ImageIO classes in my Android Activity

I am developing an Android App that can do Gamma correction of an image stored in phone. My activity can get the image location, but i cant use the BufferedImage class and ImageIO class in my Application. I get the following error in Eclipse IDE…
humandroid
  • 311
  • 1
  • 3
  • 12
15
votes
6 answers

Load Java Image inside package from a class in a different package

I have a Java project called MyProject. I have a few different packages (keeping names simple for the purpose of this question), as…
CodeGuy
  • 28,427
  • 76
  • 200
  • 317
15
votes
4 answers

Drawing Filled Rectangle over a BufferedImage

So I am attempting to create an application that can black-out sections of a survey that contains sensitive information. However I've run into a bit of a problem. What I want to do is draw filled black rectangles over a BufferedImage given x, y,…
John Fox
  • 171
  • 1
  • 1
  • 6
14
votes
1 answer

How can I import java.awt.image.BufferedImage in Android Studio

I need my android app to recognize BufferedImage and I am using Android Studio. I've seen that there is a way to import JRE library system in Eclipse but I am having trouble doing so in Android Studio. Any ideas? Thanks!
Lara Larsen
  • 365
  • 1
  • 2
  • 16
13
votes
1 answer

How to resize the buffered image n graphics 2d in java?

int width = 175; Graphics2D gb = (Graphics2D) g; bufferedimage = (BufferedImage) createImage(width, width); Graphics2D graphics = bufferedimage.createGraphics(); graphics.setColor(/*this.getBackground()*/Color.red); …
Sri
  • 669
  • 2
  • 13
  • 25
13
votes
3 answers

Can I tell what the file type of a BufferedImage originally was?

In my code, I have a BufferedImage that was loaded with the ImageIO class like so: BufferedImage image = ImageIO.read(new File (filePath); Later on, I want to save it to a byte array, but the ImageIO.write method requires me to pick either a GIF,…
Thunderforge
  • 19,637
  • 18
  • 83
  • 130