subsampling-scale-image-view icon indicating copy to clipboard operation
subsampling-scale-image-view copied to clipboard

java.io.IOException: Image failed to decode using BMP decoder

Open kaycool opened this issue 6 years ago • 0 comments

Please provide as much of the following information as possible. Please do not raise issues to ask for help developing your app.

Expected behaviour

show image exactly

Actual behaviour

buy get error for SubsamplingScaleImageView: Failed to initialise bitmap decoder java.io.IOException: Image failed to decode using BMP decoder

Steps to reproduce

        val option = BitmapFactory.Options()
        option.inJustDecodeBounds = true
        BitmapFactory.decodeFile(f.absolutePath, option)
        val width = option.outWidth.toFloat()
        val height = option.outHeight.toFloat()
        if (height > width && (width / height) < (context.widthPixels.toFloat() / context.heightPixels.toFloat())) {
            trueImage.setMinimumScaleType(SCALE_TYPE_START)
        } else {
            trueImage.setMinimumScaleType(SCALE_TYPE_CENTER_INSIDE)
        }
        trueImage.minScale = this.width.toFloat() / width
        trueImage.tag = f.absolutePath
        logd("PreImage", "setImage start")
        trueImage.setImage(ImageSource.uri(f.absolutePath))

Affected devices

all device

Affected images

https://tdata.quanziapp.com/files/skPnQb5/20190805/8b18cb47-7b4e-4ec7-bda9-a134ca197636.jpg

kaycool avatar Aug 06 '19 02:08 kaycool