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

Creating a BufferedImage using pixels int[]

I'm using a sprite sheet and have it set up to get the pixel int[] of each sprite, I'm just not sure how to use that pixel int[] to make a seperate image. my code: i=0; BufferedImage[] bi = new BufferedImage[]; for(y) { for (x) { int[]…
8bitslime
  • 164
  • 1
  • 13
4
votes
2 answers

javax.imageio.IIOException: Can't read input file

I am building a program that compresses a given image and saves it as a JPEG. This is the error message I get: Exception in thread "main" javax.imageio.IIOException: Can't read input file! at javax.imageio.ImageIO.read(Unknown Source) at…
pacman4565
  • 125
  • 1
  • 1
  • 8
4
votes
1 answer

How do I create an animated gif from an array of bufferedimages?

I have an array of buffered images and I want to create a gif with them. I also want to be able to specify the delay between the the images. Is there anything in the java api which would be able to provide this? I haven't been able to find anything
d.bech
  • 79
  • 1
  • 9
4
votes
1 answer

BufferedImage bytes have a different byte order, when running from Eclipse and the command line

I was trying to convert a BufferedImage's byte[] from 32-bit RGBA to 24-bit RGB. According to this answer the fastest way to get the byte[] from the image is: byte[] pixels = ((DataBufferByte)…
c.s.
  • 4,786
  • 18
  • 32
4
votes
1 answer

Trying to load image using ImageIO.read(class.getResource(URL)) but getResource is returning null

I've been making a 2D game with my buddy and I've been learning a lot about some basic game dev concepts through some Youtube tutorials. One of the things I was learning about is sprites (for those that don't know, 2D images to render to the screen)…
user2466959
  • 41
  • 1
  • 1
  • 2
4
votes
3 answers

NullPointerException when calling a getter

I have already done research on this question, and also tried to figure it out by myself but no luck. So I decided to ask it. Basic info: There are two classes. FBClient, and State. In FBClient, I have a static variable of it's type, fbc, a…
Franko Leon Tokalić
  • 1,457
  • 3
  • 22
  • 28
4
votes
1 answer

How should I do image animation?

I plan to have an animated character (the character's image changing multiple times to make it appear to be moving), and I would like to know the best way to do it. I am currently planning to do something like this: String fileLocation =…
user2170842
4
votes
1 answer

write multiple images to outputStream in a servlet

I am reading two images in a servlet and need to show both at the same time. Currently, only one image is shown (one that is written first). unable to write another image. I do not get any error. My servlet code goes like this : BufferedImage…
usman
  • 1,351
  • 5
  • 23
  • 47
4
votes
2 answers

What format of large background image provide in jar?

I have Java Swing application with maximized bounds for JFrame. The application is distributed as jar file up to now. Initially for background image I have used some large arbitrary image file of png-format. And I do have a code which can load and…
Nikolay Kuznetsov
  • 9,467
  • 12
  • 55
  • 101
4
votes
1 answer

Force paintAll() to draw an invisible JPanel and its components?

I'm working on printing a series of JPanels to a Printable, the basic printing interface that supplies a Graphics object that you draw what you want printed. If I have a "live" JPanel, that is in the UI somewhere, everything works great. However,…
utopianheaven
  • 1,267
  • 7
  • 18
4
votes
1 answer

JScrollPane content to image

I'm trying to save the main viewport and headers of a JScrollPane (larger than screen) to PNG image files. I created 3 classes extending JPanel (MainTablePanel, MapsHeaderPanel and ItemsHeaderPanel) and set them to the viewports. Each of them has…
4
votes
1 answer

Render to BufferedImage in Java3D

Is there a simple way of rendering to a BufferedImage in Java3D? I know you can extend Canvas3D, but it seems cumbersome if I just want to render directly.
Spoike
  • 119,724
  • 44
  • 140
  • 158
4
votes
2 answers

I get weird black areas in a BufferedImage, how can I fix this?

I am currently writing a Fractal Explorer program, and I am encountering a really weird issue with it: I am drawing the fractal on a BufferedImage, and I get random black areas in that image. Screenshots: https://i.stack.imgur.com/VOvz3.jpg The…
Lucas Werkmeister
  • 2,584
  • 1
  • 17
  • 31
4
votes
1 answer

Repaint an argb BufferedImage

In my applet I make use of different BufferedImages and use them as screen parts. Each screen part will only be repainted when the content needs to change. This is the abstract ScreenPart class: public abstract class ScreenPart extends…
Jochem Gruter
  • 2,813
  • 5
  • 21
  • 43
4
votes
1 answer

Simulate Print Screen under Windows

I know we can simulate the print screen with the following code: robot.keyPress(KeyEvent.VK_PRINTSCREEN); ..but then how to return some BufferedImage? I found on Google some method called getClipboard() but Netbeans return me some error on this…
user1638875
  • 105
  • 3
  • 10