I am giving the same bitmap to image view and it fits well inside it , but when I set that same bitmap to GPU image view the image gets zoomed, here is how I am doing it generally

activity file

val imageFilePath =
                intent.getStringExtra(Constants.PDF_CONVERTER_IMAGES_URL_CODE_FILTERS_ACTIVITY)
if (imageFilePath != null) {
bitmap = BitmapFactory.decodeFile(imageFilePath)
 binding.gpuimageview.setImage(bitmap)}

Here is the XML code

<FrameLayout
        android:layout_width="match_parent"
        android:layout_height="0dp"
        android:layout_weight="1"
        app:layout_constraintBottom_toTopOf="@+id/filters_recycler_view">

        <jp.co.cyberagent.android.gpuimage.GPUImageView
            android:id="@+id/gpuimageview"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            app:gpuimage_show_loading="false"
            android:layout_gravity="center"
            app:gpuimage_surface_type="texture_view"
          />

    </FrameLayout>

Thanks in Advance for any kind of help

I have already tried to load it with glide, tried to set scaleType(it gets blank),tried giving bitmap directly rather then decoding it

This is when I give it to imageView before filter activity

imageView before filter activity

This is what I am getting in the Filter activity when I set it GPUImageView view only(Zoomed), but in Filter activity when I set the same source to image view it fits well

This is what I am getting in the Filter activity when I set it GPUImageView view only(Zoomed), but in Filter activity when I set the same source to image view it fits well

1

There are 1 answers

0
Khawaja Fakhar On BEST ANSWER

I got the answer , it was my bad I was setting the scale type of gpu Image, after setting the image to gpu Image View, So if you need a bitmap to fit inside a gpu image view you just need to give it scale type before setting it to the view like this

bitmap = BitmapFactory.decodeFile(imageFilePath)
gpuImageView.setScaleType(GPUImage.ScaleType.CENTER_INSIDE)
gpuImageView.setImage(bitmap)