Skip to content

Prevent upscaling #4649

Open
Open
@azurh

Description

@azurh

Glide Version: 4.12.0

Integration libraries: No, it's a sandbox project to isolate the issue.

Device/Android Version: Google Pixel 3XL, Android 11

Issue details / Repro steps / Use case background:
What I want sounds rather simple. I don't want images to get upscaled. I'm fine with downscaling which is an obvious thing to expect with such a library but if the image is too small, I don't want it upscaled to fit the bounds of the ImageView since it looks pixelated.

Glide load line / GlideModule (if any) / list Adapter code (if any):

Glide.with(this)
  .load(URL)
  .downsample(DownsampleStrategy.CENTER_INSIDE)
  .into(imageView)

Layout XML:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:gravity="center">

    <ImageView
        android:id="@+id/imageview"
        android:layout_width="300dp"
        android:layout_height="300dp" />

</LinearLayout>

Stack trace / LogCat:
N/A

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions