Is there any C# code for cross-platform that would be similar to this:
Bitmap resized = Bitmap.createScaledBitmap(yourBitmap, newWidth, newHeight, true);
Or do I need to write separate code for iOS and Android?
I had a similar need and ended up writing platform specific code to accomplish the resize as there is no generic cross platform way to get thumbnails that I could find.
To make use of the code I implement it for each platform using a single shared interface and then use an IoC container to 'inject' the implementation appropriate for the platform my code is running against, that way my cross platform shared code just calls my ImageService.SaveThumbnail() method and the appropriate platform code is used to save a thumbnail (in my case).
Hope that helps
Thanks, Gareth. That's what I figured I might have to do but wanted to be sure before I wrote unneeded code.
@Tourist (nice name b.t.w. ), @Gazp and at all other readers of this thread:
In my app, I have to resize images (before sending it via json-webservice to store it on a SQL-server).
Therefore, I have found a basic-solution and changed / enhanced some code, so that it now works like need it.
You find it here:
Hope this helps
That looks great Fredy. I won't be able to give it a try at this time but it looks promising.
I like, that you like it...
As I wrote, the base-solution is not from me (I only have enhanced it and changed some code).
A big plus for me is, that it's easy and "clean" to integrate and you don't have to add some more platform-code...
Xamarin Inc., as a wholly-owned Microsoft subsidiary acting as a separate legal entity, adheres to the Microsoft Privacy Statement: Privacy & cookies