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
25
votes
3 answers

Download an image from a URL?

I am trying to use HTTP::get to download an image of a Google chart from a URL I created. This was my first attempt: failures_url = [title, type, data, size, colors, labels].join("&") require…
Hunter McMillen
  • 59,865
  • 24
  • 119
  • 170
24
votes
1 answer

Creating animated GIF with ImageIO?

Has anybody managed to convince ImageIO to write an animated GIF, and in particular setting the correct metadata? My first attempt is roughly as follows (where b1 and b2 are BufferedImages): ImageTypeSpecifier spec = new…
Neil Coffey
  • 21,615
  • 7
  • 62
  • 83
22
votes
7 answers

Convert each animated GIF frame to a separate BufferedImage

I want to be able to take an animated GIF as input, count the frames (and perhaps other metadata), and convert each to a BufferedImage. How can I do this?
Marty
  • 2,104
  • 2
  • 23
  • 42
22
votes
6 answers

What is the most memory-efficient way of downscaling images on iOS?

In background thread, my application needs to read images from disk, downscale them to the size of screen (1024x768 or 2048x1536) and save them back to disk. Original images are mostly from the Camera Roll but some of them may have larger sizes…
Dan Abramov
  • 264,556
  • 84
  • 409
  • 511
20
votes
3 answers

Is there a 100% Java alternative to ImageIO for reading JPEG files?

We are using Java2D to resize photos uploaded to our website, but we run into an issue (a seemingly old one, cf.: http://forums.sun.com/thread.jspa?threadID=5425569) - a few particular JPEGs raise a CMMException when we try to ImageIO.read() an…
chesterbr
  • 2,940
  • 3
  • 29
  • 26
19
votes
3 answers

JAI and ImageIO for 64 bit Windows

i searched JAI and ImageIO library for 64 bit windows, but i didn't find any version of these. Last 64 bit win vesion request on Java Bug tracking system 6-7 years ago. I think, jai's developers will not release any version for win64. :( My question…
Furkan
  • 451
  • 1
  • 5
  • 14
18
votes
3 answers

Convert Data-URL to BufferedImage

I have a Data-URL from an image file and have to pass it through to another function. Along this path from Data-URL to the BufferedImage it needs to be a byteArray. my approach was the following: String dataUrl; byte[] imageData =…
Daniel
  • 293
  • 1
  • 6
  • 15
18
votes
1 answer

IllegalArgumentException: Numbers of source Raster bands and source color space components do not match For a color image Exception

The above answer that someone has suggest, converts my colored image to a black and white one. So it's not appropriate for my question. File file = new File("path"); BufferedImage bufferedImage = ImageIO.read( file ); here is the code and…
Shanaka Kuruwita
  • 689
  • 2
  • 6
  • 19
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
2 answers

ImageIO dirty memory is not automatically cleared by iOS

I am creating an application which is a kind of gallery - it shows different media content as a fullscreen viewer. Allocations instrument shows that Live Bytes parameter doesn't grow higher than 40 Mb when using application. Meanwhile the app is…
ZAN
  • 561
  • 1
  • 4
  • 16
17
votes
3 answers

ImageIO.read( ) always rotates my uploaded picture

I want to create a web application that allow users to upload their image to the server. When they click send, their image will be uploaded to the server (multipart). Before saving, I want to make some operation with the image, so I decided to use…
kp_ping
  • 495
  • 5
  • 14
17
votes
4 answers

How to get favicon.ico from a website using Java?

So I'm making an application to store shortcuts to all the user's favorite applications, acting kind of like a hub. I can have support for actual files and I have a .lnk parser for shortcuts. I thought it would be pretty good for the application to…
mattbdean
  • 2,532
  • 5
  • 26
  • 58
17
votes
3 answers

ImageIO.read illegal argument exception - raster bands/colour space components?

Apologies for the somewhat vague title, I can't work out what the keywords are here. The setup's quite simple, I'm opening an image with ImageIO.read(new File(filename)); This works for most files, however for one I get an IllegalArgumentException…
mtrc
  • 1,317
  • 3
  • 16
  • 39
15
votes
4 answers

How to detect corrupted images (PNG, JPG) in Java

I need to detect if the image file is corrupted in Java. I'm working only with PNG, JPG images. Is this possible to do with Sanselan? Or can it be done with ImageIO? I've tried using ImageIO.read seems like it works. But I'm not sure if it can…
Byambatsogt
  • 324
  • 1
  • 2
  • 7
15
votes
4 answers

Pure Java alternative to JAI ImageIO for detecting CMYK images

first I'd like to explain the situation/requirements that lead to the question: In our web application we can't support CMYK images (JPEG) since IE 8 and below can't display them. Thus we need to detect when someone wants to upload such an image and…
Thomas
  • 87,414
  • 12
  • 119
  • 157
1
2
3
72 73