Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a DownsampleMode properties for Forms / Native #652

Closed
YZahringer opened this issue Jul 3, 2017 · 8 comments
Closed

Add a DownsampleMode properties for Forms / Native #652

YZahringer opened this issue Jul 3, 2017 · 8 comments

Comments

@YZahringer
Copy link

Hello,

How to use InterpolationMode.None / NearestNeighbor in Xamarin Forms to have pixelized resized image? I use FFImage.DownsampleMode="None" with UWP, but I can not find any way in Xamarin XAML Forms.

I use this to enlarge a small QrCode image, that's why I need to disable "anti-aliasing". In CSS i use:

@mixin pixelated {
-ms-interpolation-mode: nearest-neighbor; // IE 7+ (non-standard property)
image-rendering: -webkit-optimize-contrast; // Safari 6, UC Browser 9.9
image-rendering: -webkit-crisp-edges; // Safari 7+
image-rendering: -moz-crisp-edges; // Firefox 3.6+
image-rendering: -o-crisp-edges; // Opera 12
image-rendering: pixelated; // Chrome 41+ and Opera 26+
}

Is there any way to do this with FFImageLoading?

@daniel-luberda
Copy link
Member

daniel-luberda commented Jul 30, 2017

Here's the current implementation, I hope it would help:

https://github.com/luberda-molinet/FFImageLoading/blob/master/source/FFImageLoading.Windows/Extensions/ImageExtensions.cs#L182-L191

Currently in Forms, it's a global configuration setting (you provide it with a custom configuration). I forgot to add a property for CachedImage instance, so I'll mark it as a feature to add.

@daniel-luberda daniel-luberda changed the title InterpolationMode None / NearestNeighbor Add a DownsampleMode properties for Forms / Native Jul 30, 2017
@JTOne123
Copy link
Contributor

What was changed in the latest release(2.2.13) with DownsampleToViewSize in forms for UWP?

Issue is: into big CachedImage loads too small sized images

but if set a height and width everything is ok

Is it something was broken or fixed?

@daniel-luberda
Copy link
Member

daniel-luberda commented Sep 21, 2017

@JTOne123 Read this: https://github.com/luberda-molinet/FFImageLoading/wiki/Xamarin.Forms-API#downsampletoviewsize-bool-default-false

I was a bit tired of explaining the same thing multiple times (people were experiencing poor performance), so I put a fixed value (which is very low) when view doesn't have a size defined (is expandable). If you experience this, it means than DownsampleToViewSize didn't work at all for that view and you should use DownsampleWidth / DownsampleHeight as described in wiki. I just released 2.2.14 which will additionally warn about this in logs. :)

@JTOne123
Copy link
Contributor

yep, definitely it is my case, thank for an answer

@daniel-luberda
Copy link
Member

2.2.14 just released. It will also log an error with explanation. 46e021b

@YZahringer
Copy link
Author

The DownsampleMode property has been added to the CachedImage instance?

@daniel-luberda
Copy link
Member

Sorry, wrong issue.

@daniel-luberda
Copy link
Member

#859

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants