Class ExifInterfaceImageHeaderParser

  • All Implemented Interfaces:
    ImageHeaderParser

    @RequiresApi(27)
    public final class ExifInterfaceImageHeaderParser
    extends java.lang.Object
    implements ImageHeaderParser
    Uses ExifInterface to parse orientation data.

    ExifInterface supports the HEIF format on OMR1+. Glide's DefaultImageHeaderParser doesn't currently support HEIF. In the future we should reconcile these two classes, but for now this is a simple way to ensure that HEIF files are oriented correctly on platforms where they're supported.

    • Constructor Detail

      • ExifInterfaceImageHeaderParser

        public ExifInterfaceImageHeaderParser()
    • Method Detail

      • getOrientation

        public int getOrientation​(@NonNull
                                  java.io.InputStream is,
                                  @NonNull
                                  ArrayPool byteArrayPool)
                           throws java.io.IOException
        Description copied from interface: ImageHeaderParser
        Parse the orientation from the image header. If it doesn't handle this image type (or this is not an image) it will return a default value rather than throwing an exception.
        Specified by:
        getOrientation in interface ImageHeaderParser
        Returns:
        The exif orientation if present or -1 if the header couldn't be parsed or doesn't contain an orientation
        Throws:
        java.io.IOException
      • getOrientation

        public int getOrientation​(@NonNull
                                  java.nio.ByteBuffer byteBuffer,
                                  @NonNull
                                  ArrayPool byteArrayPool)
                           throws java.io.IOException
        Specified by:
        getOrientation in interface ImageHeaderParser
        Throws:
        java.io.IOException