I have image, token with samsung camera and placed on sd-card. File EXIF rotation is ORIENTATION_ROTATE_90 (6). If I add ResizeOptions to ImageRequestBuilder, the image looks compressed by vertical.
Here is the sample file
https://www.dropbox.com/s/fsixt3lfbw6zqiv/Exif270.jpg?dl=0
Place it to sd-card root
And here is code
public class MainActivity extends AppCompatActivity {
private static String[] PERMISSIONS_STORAGE = {
Manifest.permission.READ_EXTERNAL_STORAGE,
Manifest.permission.WRITE_EXTERNAL_STORAGE
};
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Fresco.initialize(this);
verifyStoragePermissions(this);
SimpleDraweeView simpleDraweeView = new SimpleDraweeView(this);
simpleDraweeView.setLayoutParams(new ViewGroup.LayoutParams(
ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));
File file = new File("/storage/emulated/0/Exif270.jpg");
ImageRequestBuilder imageRequestBuilder = ImageRequestBuilder.newBuilderWithSource(
Uri.fromFile(file)).setResizeOptions(ResizeOptions.forDimensions(100, 300));
PipelineDraweeControllerBuilder controllerBuilder = Fresco.newDraweeControllerBuilder()
.setImageRequest(imageRequestBuilder.build());
simpleDraweeView.setController(controllerBuilder.build());
setContentView(simpleDraweeView);
}
public static void verifyStoragePermissions(Activity activity) {
int permission = ActivityCompat.checkSelfPermission(activity, Manifest.permission.WRITE_EXTERNAL_STORAGE);
if (permission != PackageManager.PERMISSION_GRANTED) {
ActivityCompat.requestPermissions(activity, PERMISSIONS_STORAGE, 1);
}
}
}
Screenshot of result

Without resizing everything works fine
Thanks for the bug report. We'll take a look!
Hi I will like to contribute but unfortunately I was not able to reproduce the error.
Hello, I investigated issue a bit and have some new details.
The problem is in exif thumbnail of the photo. Fresco uses exif thumbnail if resize options below 512x512 (LocalExifThumbnailProduser)
This produser uses getThumbnail() method of ExifIterface to get image bytes directly from exif thumbnail.
For my particular case this thumbnail is compressed and has wrong dimentions, so
exif thumbnail width = 512
exif thumbnail height = 384
and at the same time
exifInterface.getAttribute(ExifInterface.TAG_IMAGE_WIDTH) = 1920
exifInterface.getAttribute(ExifInterface.TAG_IMAGE_HEIGHT) = 1080
As you can see thumbnail is not valid for this case.
I think it is vendor camera problem, but still, maybe is't good approach to compare aspect of the thumbnail and real image size in LocalExifThumbnailProducer.canProvideImageForSize and return false here if aspects are not same in some approximation?
@dmitrychistyakov I have been noticing the same issue. I did some data gathering and it seems like it is rather widespread. Most Samsung devices and a great amount of chinese brands are having these problems (Xiaomi, Huawei, etc ).
The issue still present on version 1.12.0
If ResizeOption is defined, no matter of the value, images taken with camera are shown with wrong orientation.
If ResizeOption is defined, no matter of the value, images taken with camera are shown with wrong orientation. its torturous。
I have the same problem.
When resize, the auto rotation is not work.
This issue should be fixed. If it is still an issue, please let us know.
Most helpful comment
Hello, I investigated issue a bit and have some new details.
The problem is in exif thumbnail of the photo. Fresco uses exif thumbnail if resize options below 512x512 (LocalExifThumbnailProduser)
This produser uses getThumbnail() method of ExifIterface to get image bytes directly from exif thumbnail.
For my particular case this thumbnail is compressed and has wrong dimentions, so
exif thumbnail width = 512
exif thumbnail height = 384
and at the same time
exifInterface.getAttribute(ExifInterface.TAG_IMAGE_WIDTH) = 1920
exifInterface.getAttribute(ExifInterface.TAG_IMAGE_HEIGHT) = 1080
As you can see thumbnail is not valid for this case.
I think it is vendor camera problem, but still, maybe is't good approach to compare aspect of the thumbnail and real image size in LocalExifThumbnailProducer.canProvideImageForSize and return false here if aspects are not same in some approximation?