1

I am current taking in a .gif file through a file stream in an HTTP call, and I am trying to retrieve the .gif file's width and height through the ImageIO.read() function but it returns an error.

val inputStream = request.uploadedFiles.head.fileStream
val img : BufferedImage = ImageIO.read(inputStream)
val height = img.getHeight();

ERROR:

java.lang.ArrayIndexOutOfBoundsException: 4096
    at com.sun.imageio.plugins.gif.GIFImageReader.read(GIFImageReader.java:984) ~[na:1.8.0_171]
    at javax.imageio.ImageIO.read(ImageIO.java:1448) ~[na:1.8.0_171]
    at javax.imageio.ImageIO.read(ImageIO.java:1352) ~[na:1.8.0_171]
Farhan Islam
  • 609
  • 2
  • 7
  • 21

0 Answers0