bumptech / bumptech/glide

reduction quality when using placeholder

Open
#4,593 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
35k
Forks
6.2k
Avg merge
1d 11h
Merged PRs (30d)
8

Description

**Glide Version**: 4.12.0

**Integration libraries**: okhttp3 and androidsvg

**Device/Android Version**: All devices

**Issue details / Repro steps / Use case background**:
I have a 180*60 png image on server and try to show it by Glide in an imageview with 20dp height. When I set a placeholder, the quality of my png file become awful with low quality. but when I don't set placeholder result has good quality.

**Glide load line / `GlideModule` (if any) / list Adapter code (if any)**:
```java
// low quality
MyImageLoader.with(imageView)
.load(url)
.placeholder(R.drawable.ic_placeholder /*an svg*/)
.into(imageView)

// high quality
MyImageLoader.with(imageView)
.load(url)
.into(imageView)
```

**Layout XML**:
```kotlin
class MyView @JvmOverloads constructor(
context: Context,
attrs: AttributeSet? = null,
defStyle: Int = 0
) : LinearLayout(context, attrs, defStyle) {

private val img = ImageView(context).apply {
layoutParams = LayoutParams(LayoutParams.WRAP_CONTENT, 24.toPx)
}.also(::addView)

var iconUrl: String? = null
set(value) {
field = value
MyImageLoader.with(this)
.load(value)
.placeholder(R.drawable.ic_placeholder)
.into(img)
}

init {
layoutParams = LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT)
}
}
```

**Stack trace / LogCat**:
```ruby
there's nothing in logcat
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.