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

ImageIO.read() throws IllegalArgumentException

I'm using ImageIO api to read byte array (using ByteArrayInputStream) to get back a BufferredImage. It works most of the time but fails for certain images. After doing extensive research - I found it's related to color conversion. But I'm not sure…
jsf
  • 2,851
  • 9
  • 30
  • 33
0
votes
1 answer

Memory leak when the same BufferedImage object is loading multiple images

I'm trying to make a tool that takes jpeg images (4 images) from a folder and merge them into one big image. for (int i = desde; i < hasta + 1; i++) { for (int j = 0; j < 4; j++) { foto = ImageIO.read(new…
vdrg
  • 369
  • 1
  • 3
  • 9
0
votes
1 answer

ImageIO.read expression that worked fine suddenly stopped doing so

I am currently trying to load a spritesheet for a small game I am working on. The issue is that piece of code here: private void load(){ try { BufferedImage image = ImageIO.read(Sprite.class.getResource(path)); int w =…
0
votes
1 answer

how to get resolution (PPI) of an image

Possible Duplicate: How to define DPi for a new JPG image? Is there a way to get a resolution (pixels per inch) of an image in Java? Either with Native APIs or third party libraries. I don't just want the height and width of an image but actually…
Omnipresent
  • 29,434
  • 47
  • 142
  • 186
0
votes
2 answers

ImageIO issues in Java

The issue I'm having is I cannot see any of the pictures I'm referencing with the ImageIO class on my Applet Viewer in JAVA. I was following a tutorial online and have yet to hear back from the author - there were similar questions on his page he…
0
votes
1 answer

Java's ImageIO.read() return nulls

So I try to create an image from a byte array, but I can't figure out why the ImageIO.read() method returns a null pointer without any exception. @Override public int setParam(byte[] buffer) { mFlag = buffer[0]; //TODO mX =…
Gyome
  • 1,333
  • 2
  • 15
  • 23
0
votes
2 answers

How to convert PNG to jpeg in grails/java

I have a png file and tried to convert it to jpeg. But the resulting image has wrong colors with very big areas of pink. This is my code: BufferedImage image = null BufferedImage imageRGB = null image = ImageIO.read(new…
Michael
  • 32,527
  • 49
  • 210
  • 370
0
votes
1 answer

ImageIO linker error?

Trying to ready metadata (e.g kCGImagePropertyExifBodySerialNumber or kCGImagePropertyExifLensModel) from images using ImageIO framework. Unfortunately during the compilation linker has a trouble: Undefined symbols for architecture…
maseth
  • 841
  • 1
  • 11
  • 19
0
votes
1 answer

Put text on animated GIF and save it as a new GIF

I'm looking for a function that could process animated gif image to write text on top of it. The working solution is probably provided by Gif4j lib, but I'm looking for open-source solution or advice how to implement it on my own. How can I put…
Andrey Mormysh
  • 809
  • 5
  • 12
0
votes
1 answer

How to parse XMP in java when not valid XML?

I am extracting metadata from PNG images using javax.imageio. This works fine. But the getAsTree method to get to the actual metadata returns XML that is invalid. So I don't know how to parse this XML in order to get certain metadata: run: Format…
Anders
  • 12,556
  • 24
  • 104
  • 151
0
votes
3 answers

Import java.awt.xxxxx and javax.imageio.imageIO?

I have been working on a program in which I use codes from this API (musicg) : http://code.google.com/p/musicg/ However, I still have one part of my code which causes me trouble (GraphicRender.java). In the import part, it happens that some lines…
Phalanx
  • 1,217
  • 6
  • 25
  • 36
0
votes
1 answer

Check if a file is readable as a BufferedImage

Is there a way to check a File is readable as a BufferedImage without doing the try with ImageIO.read(File) ? I could eventually extract the mime type of the file, but is there a list of defaultly supported mime types for BufferedImage or something…
Sebastien Lorber
  • 89,644
  • 67
  • 288
  • 419
0
votes
0 answers

Read keywords in xmp from png with Java

I am trying to get keywords added to a PNG image file in Photoshop using Java. I tried this method using the imageio in Java: http://johnbokma.com/java/obtaining-image-metadata.html However, all I get is the following: Format name:…
Anders
  • 12,556
  • 24
  • 104
  • 151
0
votes
1 answer

text file to image conversion

I have a string, which i am converting it into bytes[] and then i code it to bring back to image but the problem is that it is not creating it back to the image BufferedReader reader2 = new BufferedReader(new…
Xara
  • 8,748
  • 16
  • 52
  • 82
0
votes
2 answers

Using URL or File (in ImageIO.read)

I made an application that uses several images. I have 2 ways to run my app: - press run in idea - make a fat jar file and run it from console java -jar app.jar If I want to run it from Idea I have to use: BufferedImage backgroundImage =…
Pavel
  • 4,912
  • 7
  • 49
  • 69