1

I'm making a simple image editor using javafx and am running into a problem with GIFs. Whenever I load an animated GIF, the program will not apply filters, nor will I be able to reload the image. Is there any way to just get the first frame without reading it in byte by byte and stopping after reading the first image's data?

Here's how I'm reading it in:

public static Image read(File file) {
    try (FileInputStream fileStream = new FileInputStream(file)) {
        return new Image(fileStream);
    }

The catch has been left out for brevity.

jewelsea
  • 150,031
  • 14
  • 366
  • 406
jysk131
  • 131
  • 1
  • 6
  • Also related: [ImageView: animated gif preview](http://stackoverflow.com/questions/36227990/imageview-animated-gif-preview) – jewelsea Feb 16 '17 at 18:07

1 Answers1

0

This might be of help.

Involves using an ImageReader to create a BufferedImage for each image frame. Could be easily modified to only use the first frame.

Community
  • 1
  • 1
mwstc013
  • 86
  • 3