Comments (7)
And on Android I think this code can be changed from:
bitmap = await Task.Run(() => BitmapFactory.DecodeStream(sourceStream, noPadding, opts));
To
bitmap = await BitmapFactory.DecodeStreamAsync(sourceStream, noPadding, opts);
from splat.
@dylanvdmerwe Basically, the resize is a JPEG loader optimization that is present on certain platforms and not others; i.e. we never load the full uncompressed bitmap, then attempt to scale it down - because it's not present on iOS, we don't want to load a full size, blow available memory, then return you a scaled one. I do agree that this is a bit misleading API though
from splat.
I see what you mean. But the best we can do is wrap it in an autorelease pool for now? Rather than just ignore it.
using (var ns = new NSAutoreleasePool())
{
var data = NSData.FromStream(sourceStream);
var sourceImage = UIImage.LoadFromData(data);
UIGraphics.BeginImageContext(new SizeF(desiredWidth.Value, desiredHeight.Value));
sourceImage.Draw(new RectangleF(0, 0, desiredWidth.Value, desiredHeight.Value));
var resultImage = UIGraphics.GetImageFromCurrentImageContext();
UIGraphics.EndImageContext();
return resultImage;
}
from splat.
I'm not suuuuuper excited about that, any other ideas?
from splat.
I've done quite a bit of reading today about this and on iOS I do not see anything similar to the Win Phone or Android methods. But at least using a manual auto release pool the memory is quickly recovered. This is very similar to how you shrink images you've taken on the iPhone camera (high res) before sending them via the web.
But do check the change I suggested for Android above.
from splat.
But do check the change I suggested for Android above.
👍 on that, I think that must be a new method they added
from splat.
The android loader doesn't resize the image either, it is passing the desiredWidth and desiredHeight variables to the outHeight and outWidth parameters of the opts bag, these capture the size of the image, not modify.
from splat.
Related Issues (20)
- [BUG] Splat.Microsoft.Extensions.DependencyInjection causes System.InvalidOperationException: Call from invalid thread HOT 16
- [Bug]: Router randomly stops showing views on navigation HOT 9
- WPF, .net 8.0 and Splat latest version: IBitmap.ToNative, FromNative, SplatColor.ToNativeBrush and SplatColor.FromNativeColor not found by compiler. HOT 3
- Change the DI Microsoft to use KeyedServiceProvider insted of ContractDictionary HOT 1
- Dependency Dashboard
- Action Required: Fix Renovate Configuration HOT 1
- Housekeeping: Change MS MicrosoftDependencyResolver to require IKeyedServiceProvider in ctor HOT 2
- [BUG] Splat.Microsoft.Extensions.DependencyInjection never disposes the service locator HOT 1
- [BUG] Project targeting net5.0 won't build with Splat.Drawing installed HOT 3
- PlatformModeDetector.InDesignMode() not working in WPF designer for nested UserControls
- Drop net 5 support HOT 2
- How to Use Splat.DI.SourceGenerator HOT 7
- Update Splat.Autofac README HOT 2
- [BUG] DryIoc resolves Views upon registration HOT 8
- [BUG] Getting dependency from DryIoC container creates dependency object twice HOT 8
- [BUG] RegisterPlatformBitmapLoader doesnt register with framework net6.0-windows HOT 1
- [BUG] Registered Func cant be resolved
- [BUG] System.MissingFieldException HOT 3
- Default Test and Run mode HOT 8
- Optimise DefaultPlatformModeDetector on csproj sdk platforms
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from splat.