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

How to create BufferedImage from bitmap data

After going through many similar looking questions I had no way but put my own question here. I need to display an image on swing application. The source of image is bitmap data which is retrieved from MS SQL server. I have tried the following…
Harihar Das
  • 484
  • 3
  • 11
0
votes
1 answer

Read with ImageIO non-applet

Okay, so I have all of my classes inside of a few packages: Game/src/package1/Class.class and I want to get into a file in: Game/res/Terrain.png How would I do this? public Screen(Game game){ this.game=game; try { URL url = new…
0
votes
0 answers

Error "java.lang.IllegalArgumentException: im == null!" while converting byte array into Image file?

I want to convert byte array into Image file . This is the portion of my code BufferedImage image = user_space(getImage(image_path(path,name,"jpg"))); System.out.println("Image:"+image); //Image : BufferedImage@12d263f:…
gaurav kumar
  • 171
  • 2
  • 6
  • 15
0
votes
2 answers

Java using an image inside a .jar file

I know questions like this have been asked before, but I have looked and tried a lot of the answers and none of them work. I am trying to use an image inside a .jar file. The image is stored in the directory /world/maps/map1.jpg. …
0
votes
1 answer

ImageIO error HTML not displaying images taken from iPhone in web view

In my app i am taking images and saving in documents directory. when displaying in tableView, images are displaying fine but while loading in web view with same images with locally created HTML from xml and xslt it is showing following error…
SreeHarsha
  • 496
  • 4
  • 19
0
votes
2 answers

Cropping an uploaded image with Java

I am reading a image file in a servlet from an http request. I want to crop it as a square and write it to file. I can achieve that with the following code but i am using a temporary file to write the original image first. How can I do that without…
Nuri Tasdemir
  • 9,720
  • 3
  • 42
  • 67
0
votes
1 answer

JFileChooser saving image isn't adding the file type

My program allows you to save an image that has been made. I only have to save it as a png. I currently have: ... File file = fc.getSelectedFile(); try{ ImageIO.write(result.getImage(),"png",file);} ... It saves the image and I am able to open it…
MarvelFan
  • 11
  • 1
0
votes
1 answer

ImageIO.read preventing paintComponent from executing?

I am trying to a sprite image from a sprite mesh using BufferedImage and ImageIO. There is a separate class which handles the loading and storing of sprite images; this is where the problem seems to be. I load the sprite mesh into a BuffereImage…
0
votes
0 answers

sending an image over ServerSocket

I am attempting to send an image over Socket in Java however I get a NullPointerException. Here is the code for server: package sendImage; import java.net.*; import javax.imageio.*; import javax.swing.*; import…
An SO User
  • 24,612
  • 35
  • 133
  • 221
0
votes
1 answer

ArrayIndexOutOfBoundsException when using ImageIO.write to save an image

I am trying to build a mapreduce code to read and write an image, but I am getting ArrayIndexOutOfBoundsException when using ImageIO.write to save the image, although, I am not making any changes to the image. Here is the code : import…
0
votes
3 answers

Image.IO cant read input file - Java

Hey i am currently trying to read the byte contents of an image into a byte array in java but cant seem to open the image from file. The console is throwing this exception: Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException This…
user1851487
  • 547
  • 5
  • 13
  • 28
0
votes
0 answers

iText makes color image appears black and white

I am using Graphics2D itext feature and draw image with g2.drawImage(x, y, null). If i load this image using ImageIO.read() image looks black and white in generated PDF. But Toolkit.getDefaultToolkit().createImage() works fine. Here is the…
AvrDragon
  • 7,139
  • 4
  • 27
  • 42
0
votes
1 answer

Using buffered image converting using compression

Attempting to read in a buffered bmp image and then convert with compression to jpeg. Something is wrong with the buffered image line. Thank you, any help is appreciated. public void jpegconvert(String Fname, String Crate) { BufferedImage image =…
user1088595
  • 151
  • 2
  • 16
0
votes
1 answer

Is it possible to add multiple Font style at the same time at some string text?

I am trying to draw a string into an image.is it possible to add multiple Font style at the same text(bold and italic).? my code is: Graphics g = image.getGraphics(); Font font = new Font("Arial", Font.ITALIC, 16); …
0
votes
1 answer

Java - ImageIO throws IllegalArgumentException

Hello Java Developers, So I have recently encountered this problem. Here's and SSCCE: public class SampleClass extends JPanel{ private Image img; private final String IMG_DIRECTORY = ("/res/BG.png"); public SampleClass(){ …