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

plotting chart points going out of image bounds some calculation error

This is my code below to plot a chart on a blank image. The problem is that getY() returns points which go out of the range of image Height It's this line: yy= mid + ((basePoint - val)*5); evaluates to: ( 150 + ((90.0f - 92.0f)*5) ); ( 150 + ((90.0f…
Sumit Kumar
  • 761
  • 1
  • 6
  • 17
0
votes
1 answer

BufferedImage setRGB: Image gets squished down to quarter size

I have a one dimensional integer array of rgb values that I need to feed BufferedImage and then use that to generate a jpeg. I have 128*128 pixels, which I'm stepping over using setrgb (I tried passing buffered image the array in one go, ran into…
0
votes
1 answer

Most efficient way to render a dynamic image

I want to show an image (in a JPanel) that must update quickly (about 30 fps). I also want to keep my CPU usage as low as possible. Each image update will consist of either: Moving a block of pixels to a new location Replacing a block of pixels…
cilki
  • 125
  • 1
  • 13
0
votes
1 answer

Write animated-gif stored in BufferedImage to java.io.File Object

I am reading a gif image from internet url. // URL of a sample animated gif, needs to be wrapped in try-catch block URL imageUrl = new Url("http://4.bp.blogspot.com/-CTUfMbxRZWg/URi_3Sp-vKI/AAAAAAAAAa4/a2n_9dUd2Hg/s1600/Kei_Run.gif"); // reads the…
rupinderjeet
  • 2,984
  • 30
  • 54
0
votes
1 answer

JAVA Color[] to BufferedImage to Color[] bleached output

I am manipulating code of a image renderer that is making output image from Color[] array and my code simply update it with additional stuff right before saving, that is when the original image is actually prepared (all pixels positions prepared to…
errerr
  • 63
  • 8
0
votes
0 answers

Color wriiten to image is not the same as when it is read again

I am writing a program to apply a color filter to an image. The color filter is described as follows : My code to achieve such a task is : /* * To change this license header, choose License Headers in Project Properties. * To change this…
Sourav Kanta
  • 2,727
  • 1
  • 18
  • 29
0
votes
1 answer

Creating a Blurred Transperent JPanel

I'm attempting to make a Subclass to JLabel, which I named BlurPanel. I want the class to act like any normal swing container, only it must as default have a transparent background i.e. (setOpaque(false)) and it must blur the background of the…
Matt
  • 1
  • 1
0
votes
1 answer

Resize to biggest possible image while mantaining the ratio

Sometimes my images are too big and I get this error: Exception in thread "main" java.lang.NegativeArraySizeException at java.awt.image.DataBufferByte.(Unknown Source) at java.awt.image.Raster.createInterleavedRaster(Unknown Source) …
Tiago Bértolo
  • 3,874
  • 3
  • 35
  • 53
0
votes
1 answer

java croped image all black

I am trying to crop an image using a java, here is my code: import java.awt.image.BufferedImage; import java.io.File; import java.io.IOException; import javax.imageio.ImageIO; public class crop { public static void main(String[] args) { …
Mathew
  • 1,116
  • 5
  • 27
  • 59
0
votes
2 answers

How to add bufferedImage from res file to JPanel

I need to display an image in a JPanel, but this image needs to be in a relative folder (my res folder) in my project path, so that my program can work on any machine, and the images are always available. The code I have for this so far is: try { …
FLOX DAW
  • 1
  • 3
0
votes
1 answer

Flickering image that running on a thread

In my "SpcaeShip" game i have a loop game that updates and drawing all of my objects. Now i want to add an array list of asteroids to the game and to draw them, but the problem is that if i drawing the array of asteroids in the loop game, the game…
0
votes
1 answer

Enable java to support different languages while converting .txt file to .bmp(image)

I am converting a .txt file to .bmp(image). That .txt file may have words of different languages as well. When I convert it using BufferedImage of java it converts the English words properly but not the other language's word, image shows the special…
Vipul
  • 49
  • 8
0
votes
2 answers

How to go on next line while reading the file and creating an .bmp image?

I am converting a .txt file to a .bmp file trough my java code. My .txt File contains multiple lines. I am reading every line and printing it on the image. ** My text file** 45 werwerwr abc abc abc xxxx ** Image(.bmp) which is getting created…
Vipul
  • 49
  • 8
0
votes
3 answers

How do I read images that are not saved in the same package as the class in which i need to use them?

For example, if I'm using this way for getting the images: InputStream imgpacman2up = Tablero.class.getResourceAsStream("pacmanup1.png"); BufferedImage pacman2upImg = ImageIO.read(imgpacman2up); pacman2arriba = new…
Rodrigo Peniche
  • 21
  • 1
  • 1
  • 7
0
votes
2 answers

Drawing new image over old image java

I need to draw a new image over old image. I first opened both images in BufferedImage and changed their white background to transparent. Then I got a Graphics2D object from the bufferedImage of old image and called drawImage method of Graphics2D…
Bijay Regmi
  • 90
  • 1
  • 15