Questions tagged [javax.imageio]

The Java Image I/O API (the javax.imageio package) contains the basic classes and interfaces for reading/writing BufferedImages and RenderedImages from/to image files and streams.

The Java Image I/O API (the javax.imageio package) contains the basic classes and interfaces for reading/writing BufferedImages and RenderedImages from/to image files and streams.

Many common image I/O operations may be performed using the static methods of the ImageIO class.

The package contains classes describing the contents of image files, including metadata and thumbnails (IIOImage); for controlling the image reading process (ImageReader, ImageReadParam, and ImageTypeSpecifier) and image writing process (ImageWriter and ImageWriteParam); for performing transcoding between formats (ImageTranscoder), and for reporting errors (IIOException).

All implementations of javax.imageio provide the following standard image format plug-ins: JPEG, PNG, BMP, WBMP and GIF.

The javax.imageio package has been available since Java (J2SE) 1.4.

1092 questions
-1
votes
1 answer

Java ImageIO, convert Image to File

So I'm trying to take an BufferedImage and convert it into a type File, but ImageIO.write will only let me write the image to a file... I've looked at the source code and can't seem to find a way to convert an Image to a File, that isn't writing it…
visc
  • 4,794
  • 6
  • 32
  • 58
-1
votes
1 answer

ImageIO write save a black image

I used BufferedImage bi= new BufferedImage(320,240,BufferedImage.TYPE_BYTE_GRAY); ImageIO.write(bi, "png", outputfile); to save an image but save a black image. I can not understand what is the problem.
Ioanna
  • 95
  • 6
  • 14
-1
votes
1 answer

Trouble reading BufferedImage

I'm having an odd problem. I have a game of sorts where an image bounces around the screen in 'darkness' (black Rect) and the mouse cursor represents a flashlight shining through the dark (subtracts an oval). Now I have one .png image and one .wav…
-1
votes
1 answer

Java ImageIO - same image to a specific path

Im implementing a screenshot function and currently it just saves to the project file but it would be nice if it saved to a specific file or location such as the desktop. Currently: try { imageId = random.nextInt(9999); …
Bevilacqua
  • 465
  • 3
  • 8
  • 19
-1
votes
2 answers

The picture in Jlabel (with ImageIO)

Could you tell me how can I download image from Url (ex: from "http://www.google.ru/intl/en_com/images/logo_plain.png") to JLabel but without saving it on HDD? Could you give me an easy example? All I need is to put the image from the URL to JLabel…
Vlad Pavlov
  • 25
  • 2
  • 5
-1
votes
1 answer

Out of memory error Java heap space - with ImageIO

I'm using ImageIO.read(InputStream is) in loop for making BufferedImages from Remote Server (HttpConnection and InputStream) but, It happens out of memory java heap space everytime. I don't know why this happens. This is my jvm parameter…
-2
votes
4 answers

Opening an image

I am an idiot. Why can't I read any files? import java.awt.Image; import java.io.File; import java.io.IOException; import javax.imageio.ImageIO; public class mainClass { public static void main(String[] args) { try { …
wokparty
  • 1
  • 1
  • 1
  • 2
-2
votes
1 answer

Unreachable catch block for IIOException. This exception is never thrown from try statement and javax.imageio.IIOException: Can't read input file

Code that triggers "Unreachable catch block for IIOException. This exception is never thrown from try statement" int width = 0, height = 0; BufferedImage img = null; try { try { img =…
GR_ Gamer
  • 7
  • 1
  • 1
-2
votes
1 answer

The method read(File) in the type ImageIO is not applicable for the arguments (String)

So when I replace the urlImage to an actual image path e.g. "BufferedImage image = ImageIO.read("F:/Java/data/photo.jpg") on the first line of the code it return the following error "The method read(File) in the type ImageIO is not applicable for…
-2
votes
1 answer

What will be the value of int a = bufferedImageSource.getRGB(x,y)?

I am a bit confused exactly what value will be stored in the variable a. Please can someone explain me with an example Thanks in advance.
Omkar
  • 45
  • 7
-2
votes
1 answer

How do I get Base64 string of BMP formatted image

I am trying to convert any image format to a BMP format and then returning back the base64 String of the converted BMP byte. However when I am returning the BMP image base64 string, it is coming blank. I even tried printing it on console but still…
-2
votes
1 answer

How to fix ArrayIndexOutOfBoundsException in Java?

I get an ArrayIndexOutOfBoundsException, but only when the getSubImage() function is there. This is to loop through and get sprites.I've tried it without getsubimage and i've tried using different for loops though nothing has helped. This is not the…
Danny C
  • 1
  • 4
-2
votes
1 answer

How to keep compressing a image with ImageWriter in JAVA?

I need to compress every image that is larger than 500 kbytes. So, i'm trying to create a code that will test every compression quality until i get <= 500 kb, then i'll have the best quality with the lowest length. My biggest problem here is that…
-2
votes
1 answer

ImageIO.read() works in Eclipse runtime but not as runnable jar file

I've got a problem with loading images implemented in a jar file. Here's my file tree: -graphics -ImageFiles -animation -image.jpg -mathspace -META-INF Now I wanna load this image: …
Ya3Be
  • 1
-2
votes
1 answer

Java Reading/Loading an Image

I have a project based on Spring Web model-view-controller (MVC) framework. The version of the Spring Web model-view-controller (MVC) framework is 3.2.8. I am reading an image public static void main(String[] args) { BufferedImage img = null; …
1 2 3
72
73