FFImageLoading icon indicating copy to clipboard operation
FFImageLoading copied to clipboard

Image transformation not working

Open NickeManarin opened this issue 6 years ago • 5 comments

Description

I'm trying to apply an image transformation (RoundedTransformation) but the resulting image is always square, even with a radius of 50.

Steps to Reproduce

Create a project using the templates available from Microsoft. Add the nuget to the three projects (shared, iOS, Android).

Add this line before the Forms.Init(), at least for Android:

FFImageLoading.Forms.Platform.CachedImageRenderer.Init(true);

<f:CachedImage Aspect="AspectFill" DownsampleToViewSize="True" Source="{Binding ImageSource}" BitmapOptimizations="True" CacheType="Disk">
    <f:CachedImage.Transformations>
        <t:RoundedTransformation Radius="50"/>
    </f:CachedImage.Transformations>
</f:CachedImage>

This is inside a Sharpnado's HorizontalListView and DraggableViewCell. Also there's a custom frame with rounded corners as the parent of the image.

Expected Behavior

The image corners should be rounded.

Actual Behavior

Image loads with squared corners.

Basic Information

  • Version with issue: 2.4.11.982
  • Last known good version: n/a
  • Platform: Android

Screenshots

Screenshot

NickeManarin avatar Jun 18 '19 14:06 NickeManarin

Check RoundedTransformation's WidthRatio / HeightRatio properties. Eg. specify 2:1

daniel-luberda avatar Jun 22 '19 21:06 daniel-luberda

I'm sorry for taking so long to reply. I noticed that when using the Aspect="AspectFill", the image wont have its corner radius set.

Only when using the Aspect="AspectFit" that the corner radius will be respected.

I'm not sure if I'm doing something wrong. Would you mind taking a look at this sample project? https://github.com/NickeManarin/Xamarin.Demos2 (Click on the button Test and later in Continue)

Currently is set to Aspect="AspectFit", but if changed to Aspect="AspectFill".

Also I noticed that when using AspectFit, the image looks kind of cropped, even if there's no crop transformation applied to. I'm not sure if it's an issue with the CrossMedia captured image, the CachedImage element or anything else.

NickeManarin avatar Jul 19 '19 20:07 NickeManarin

Hi, did you managed to take a look at the project?

NickeManarin avatar Aug 09 '19 14:08 NickeManarin

Check RoundedTransformation's WidthRatio / HeightRatio properties. Eg. specify 2:1

Why we have to set those values? We just want to make rounded image :) P.S. I've faced same issue - image transformation doesn't working :(

VictorKochetkov avatar Feb 14 '21 13:02 VictorKochetkov