Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8114336

ImageLoader doesn't report metadata for a BMP image

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P3 P3
    • fx2.0
    • fx2.0
    • javafx
    • MacOS 10.6, 64bit JDK6

      The test below loads an image using IIO. Loading finishes normally, but the listener's imageLoadMetaData method is never called.
      Put the attached bikes.bmp into /tmp directory.


      import com.sun.javafx.iio.ImageLoadListener;
      import com.sun.javafx.iio.ImageLoader;
      import com.sun.javafx.iio.ImageMetadata;
      import com.sun.javafx.iio.ImageStorage;
      import java.io.FileInputStream;
      import java.io.InputStream;
      import javafx.application.Application;
      import javafx.stage.Stage;


      public class ImageLoaderTest extends Application implements ImageLoadListener {
          
          public static void main(String[] args) {
              launch(ImageLoaderTest.class, args);
          }

          @Override public void start(Stage stage) {
              try {
                  InputStream in = new FileInputStream("/tmp/bikes.bmp");
                  ImageStorage.loadAll(in, this, 0, 0, true, false);
                  System.out.println("Image loaded");
              } catch (Exception e) {
                  e.printStackTrace();
              }
          }
              
          @Override public void imageLoadProgress(ImageLoader l, float p) {
          }
          @Override public void imageLoadWarning(ImageLoader l, String warning) {
          }
          @Override public void imageLoadMetaData(ImageLoader l, ImageMetadata metadata) {
              System.out.printf("Image size is %dx%d\n", metadata.imageWidth, metadata.imageHeight);
          }
      }

            bpb Brian Burkhalter
            peterz Peter Zhelezniakov
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported: