Closed AndersMad closed 7 years ago
@AndersMad I have not tried this, but I think this is the way to control it:
SKPaint paint = ...;
paint.FilterQuality = SKFilterQuality.High;
Gets or sets the filter quality of the current paint. This affects the quality (and performance) of drawing scaled images. https://developer.xamarin.com/api/property/SkiaSharp.SKPaint.FilterQuality/
Let me know what happens - and you can try the other values and see if that is faster/better.
Sorry, forgot that in my comment! Yes I had and no - it does not help: If set to low quality it is just terrible and high is blurred..
It's probably in the root Skia so i will post other place - but now people are aware: If doing scaling don't use SKImage
- "keep on" using SKBitmap
.
For others coming from System.Drawing: Using SKBitmapResizeMethod.Lanczos3
seems to be almost the same as InterpolationMode.HighQualityBicubic
etc. - except the end result (Skia that is) gives a much smaller file size with twice the speed - even though tiny details actually looks better (tested with jpeg q@75).. So thanks for this excellent .NET wrapper! :)
Closing this as it is not an issue. Thanks for posting your findings, it is always appreciated.
There is definitely something wrong with SKImage
. As @AndersMad discovered, SKImage
resizes very blurry. Whereas SKBitmap
resizes fine.
There are several posts online stating that SKBitmap
is being done away with/becoming obsolete, and to use SKImage
instead. However, this issue is a showstopper. @mattleibow
@dsyno Could you open a new issue with images showing the difference? And maybe the code you used to get there?
I will investigate and see what Google has to say if there is a problem.
Thanks @mattleibow. New issue created #520
This still seems to be a problem, with images far worse than pictures.
@mattleibow asks "What is the recommended way to resize bitmaps" here https://groups.google.com/d/msg/skia-discuss/r-2svp3dK_8/2MRh6HKyEQAJ
The response is to use Image and not Bitmap as Bitmap is on a route to obsolete. Thats a big FYI i spose. But when i tried using image vs. bitmap:
Bitmap: Using e.g.
bmp.Resize(bmpDest, SKBitmapResizeMethod.Lanczos3)
the result is very nice and beats System.Drawing in quality and size (and twice as fast).Image: BUT when resizing an image using surface/canvas/paint and even with
paint.IsAntialias = false
andpaint.FilterQuality = SKFilterQuality.High
set - the result is pretty bad in blurriness - its smudgy:canvas.DrawImage(img, r1, r2, paint);
This might likely be a root Skia problem (or me overlooking something?) - but when considering that Chrome uses Skia for its canvas elements - the forum responses here is to make sure that anti-alias is turned off - so maybe there is a missing property for this? Or maybe its just the Skia lack of being able to set the resize method using image draw.
Anyone else bumped into this?