Photoview: No method to retain zoom level when image is changed

Created on 3 Jul 2019  路  5Comments  路  Source: Baseflow/PhotoView

If we show thumbnail in ImageView and user zooms the views, then when we load the actual image in ImageView the zoom value resets. There should be a method to retain the zoom state.

Most helpful comment

Just found how to do it:

if (!resetMatrix){
        val matrix = Matrix()
        photoView.getSuppMatrix(matrix)
        photoView.setImageBitmap(filteredBitmap)
        photoView.setSuppMatrix(matrix)
}
else {
    photoView.setImageBitmap(filteredBitmap)
}

All 5 comments

My app has a image filter effect feature, after the image is applied a filter effect and set to photoview, the zoom level is reset. Need to retain zoom level.

Just found how to do it:

if (!resetMatrix){
        val matrix = Matrix()
        photoView.getSuppMatrix(matrix)
        photoView.setImageBitmap(filteredBitmap)
        photoView.setSuppMatrix(matrix)
}
else {
    photoView.setImageBitmap(filteredBitmap)
}

Thanks for sharing. I'll will it a try

It is working fine for me. Thanks

That's cool thanks for sharing

Was this page helpful?
0 / 5 - 0 ratings

Related issues

imyyq-star picture imyyq-star  路  7Comments

feresr picture feresr  路  5Comments

nithinpmolethu picture nithinpmolethu  路  11Comments

AnthonyKoueik picture AnthonyKoueik  路  9Comments

kangsLee picture kangsLee  路  6Comments