通过Glide破坏图像质量加载图像 [英] Loading images by Glide spoil image quality

查看:323
本文介绍了通过Glide破坏图像质量加载图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我建立了一个简单的画廊.我使用Glide加载照片.在滑行加载的图像上看起来有点条纹(像素似乎可见). 我尝试加载更改后的格式RGB_565/ARGB_8888的照片,但使用了.dontTransform(),但它看起来比原始照片差.

I build simple gallery. I load my photos using Glide. It looks like on images loaded by glide is some kind of streak (pixels seems to be visible). I tried to load photo with changed Format RGB_565/ARGB_8888 and I used .dontTransform() but still it looks worse than original photo.

我用来加载的代码:

ImageView photoDetails;
photoDetails = (ImageView)findViewById(R.id.imageDetails);
Glide.with(this)
        .load(pictureFile) //path to picture
        .asBitmap()
        .format(DecodeFormat.PREFER_ARGB_8888)
        .dontTransform()
        .into(photoDetails);

推荐答案

要使用Glide加载原始图像,请使用以下代码:

To load the original image using Glide I use the code below:

  Glide.with(view.getContext())
                    .load(pictureFile)
                    .asBitmap()
                    .into(new SimpleTarget<Bitmap>(Target.SIZE_ORIGINAL,Target.SIZE_ORIGINAL) {
                        @Override
                        public void onResourceReady(Bitmap resource, GlideAnimation glideAnimation) {
                            imageView.setImageBitmap(resource);
                        }
                    });

请记住,由于设备的屏幕分辨率,浏览器中的图片在设备上可能看起来有所不同.使用此方法,您将可以使用Bitmap对象检查像素. 另外,请记住,您的ImageView必须具有widthheight且具有WRAP_CONTENT值.

Remember that the picture in browser may look different on the device due to the screen resolution of your device. Using this method you will be able to check the pixels using the Bitmap object. Also, keep in mind that your ImageView must have width and height with WRAP_CONTENT value.

这篇关于通过Glide破坏图像质量加载图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆