facebook/fresco

HEIF image Rotation issue

Offen

#2.406 geöffnet am 23.09.2019

 (3 Kommentare) (0 Reaktionen) (0 zugewiesene Personen)Java (3.750 Forks)batch import
enhancementhelp wanted

Repository-Metriken

Stars
 (17.072 Sterne)
PR-Merge-Metriken
 (Keine gemergten PRs in 30 T)

Beschreibung

Description

I have some problems when display heif format image,The image rotation is wrong. I find some code with the issue ,the method parseMetaData of EncodedImage class ,when it handle "HEIF" ImageFormat value,it jump fetch Orientation infomation,but the file‘s fileExtension is jpg and the format is Heif 。

`

public void parseMetaData() {

final ImageFormat imageFormat = ImageFormatChecker.getImageFormat_WrapIOException(
    getInputStream());

mImageFormat = imageFormat;

// BitmapUtil.decodeDimensions has a bug where it will return 100x100 for some WebPs even though
// those are not its actual dimensions
final Pair<Integer, Integer> dimensions;

if (DefaultImageFormats.isWebpFormat(imageFormat)) {

  dimensions = readWebPImageSize();

} else {
  dimensions = readImageSize();
}
if (imageFormat == DefaultImageFormats.JPEG && mRotationAngle == UNKNOWN_ROTATION_ANGLE) {
  // Load the JPEG rotation angle only if we have the dimensions
  if (dimensions != null) {
    mExifOrientation = JfifUtil.getOrientation(getInputStream());
    mRotationAngle = JfifUtil.getAutoRotateAngleFromOrientation(mExifOrientation);
  }
} else {
  mRotationAngle = 0;
}

}

`

Solution

Additional Information

  • Fresco version: 1.10.0
  • Platform version: android 8.0

Contributor Guide