Glide: Load image have a background color in the ImageView.

Created on 31 Dec 2015  ·  3Comments  ·  Source: bumptech/glide

Hi, I use the glide to load my image in my ImageView, but there seem have a problem. On my Moto G phone, the image have a background color, but this image's background color is white. but on my Moto X phone, the image display is right.
this image url is http://img.haihu.com/011507220950be96d52f459aa3a903ef6686a402.jpg@1c_1e_250w.jpg

you can see this picture, it's MOTO G display, I had mark the problem place, this glide load this picture has a background color, but the fact is this picture isn't this color background. image url in the above

motog_flag

and this is the MOTO X display, it look like right:

motox_flag

and screen is this:

MOTO G

motoG

MOTO X

motoX

By the way, Most pictures have this problem, and this problem occurs in other Chinese phones

Our application will be released soon, can you help me solve this problem it? Very thank you.

and this is my glide config:

compile 'com.github.bumptech.glide:glide:3.6.0'
public class HaiTaoGlideModule implements GlideModule {
    @Override
    public void applyOptions(Context context, GlideBuilder glideBuilder) {
        //TODO 配置 Glide 的行为
        glideBuilder.setDiskCache(new DiskCache.Factory() {
            @Override
            public DiskCache build() {
                // Careful: the external cache directory doesn't enforce permissions
                String path = PathUtil.getImagesCachePath();
                File fileDir = new File(path);
                if (!fileDir.exists()) {
                    fileDir.mkdirs();
                }
                return DiskLruCacheWrapper.get(fileDir, 200 * 1024 * 1024); // /haitao/images/cache  200M
            }
        });
    }
    @Override
    public void registerComponents(Context context, Glide glide) {
    }
}
question

Most helpful comment

Thank you very much, I use the DiskCacheStrategy.SOURCE and DecodeFormat.PREFER_ARGB_8888 had resolve this problem.

All 3 comments

See #305 and everything linked at the bottom.

Thank you very much, I use the DiskCacheStrategy.SOURCE and DecodeFormat.PREFER_ARGB_8888 had resolve this problem.

I have the same problem with Glide 4.2.0 on LG G6 (with Nougat).
White(#ffffff) GIF background becomes strange color(#f6fbf7)

How can i solve this problem? Thank you in advance.

EDIT: I have found a workaround(with infinite retry...): use .dontTransform()

Was this page helpful?
0 / 5 - 0 ratings