Rotation for resource image not work. Image is not rotated.
SimpleDraweeView iv = ...
ImageRequest ir = ImageRequestBuilder.newBuilderWithSource(R.drawable.sample_image)
.setRotationOptions(RotationOptions.forceRotation(RotationOptions.ROTATE_90))
.build();
DraweeController controller = Fresco.newDraweeControllerBuilder()
.setOldController(iv.getController())
.setImageRequest(ir)
.build();
iv.setController(controller);
Thanks, I verified that this actually doesn't work right now.
Fresco currently only supports JPG images rotation. For other image types, it can be done by using Postprocessor:
ImageRequest ir = ImageRequestBuilder.newBuilderWithResourceId(R.drawable. sample_image)
.setPostprocessor(new BasePostprocessor() {
@Override
public CloseableReference<Bitmap> process(
Bitmap sourceBitmap, PlatformBitmapFactory bitmapFactory) {
Matrix matrix = new Matrix();
matrix.setRotate(90);
CloseableReference<Bitmap> bitmapRef = bitmapFactory.createBitmap(sourceBitmap, 0, 0, sourceBitmap.getWidth(), sourceBitmap.getHeight(), matrix, true);
try {
return CloseableReference.cloneOrNull(bitmapRef);
} finally {
CloseableReference.closeSafely(bitmapRef);
}
}
})
.build();
Hello, I also try @YkSix code in fresco 1.9.0 for any image type (jpg, png), it's code work for Marshmellow and Nougat. But, for Oreo, the image zoom in and the view looks like rotated. I want to know why in Oreo different, maybe Oreo have a new type to handle?
This issue should be fixed now, we tried to repro and it seems to work. If it is still an issue, please let us know.
Most helpful comment
Hello, I also try @YkSix code in fresco 1.9.0 for any image type (jpg, png), it's code work for Marshmellow and Nougat. But, for Oreo, the image zoom in and the view looks like rotated. I want to know why in Oreo different, maybe Oreo have a new type to handle?