简体   繁体   English

Xamarin Forms,如何裁剪\\调整图像大小,从 ImageSource 获取字节 []?

[英]Xamarin Forms, how to crop\resize Image, get byte[] from ImageSource?

I can't find a way to implement a profile pic saving, can somebody help me with example?我找不到实现个人资料图片保存的方法,有人可以帮我举个例子吗? I'm capturing an image using MediaPicker (from Xamarin Labs), and then don't know how to crop it or resize to smaller mb size, tried Xamarin Resizer, but can't crop image if it is in wrong format.我正在使用 MediaPicker(来自 Xamarin Labs)捕获图像,然后不知道如何裁剪它或将其调整为更小的 mb 大小,尝试了 Xamarin Resizer,但如果格式错误,则无法裁剪图像。

Can somebody help me with that?有人可以帮我吗? May be there is component that I'm missing?可能有我遗漏的组件?

Take a look at this answer , showing you how you can approach the issue of resizing.看看这个答案,向您展示如何解决调整大小的问题。

The essence is you can create a Xamarin Forms service and corresponding code that uses native functionality to crop.本质是您可以创建一个 Xamarin Forms 服务和使用本机功能进行裁剪的相应代码。 Native code performs much better - memory requirements, performance etc.本机代码的性能要好得多 - 内存要求、性能等。

For the exact cropping code you can search SO for iOS and Android native solutions and transform them to Xamarin code对于确切的裁剪代码,您可以搜索iOSAndroid本机解决方案的 SO 并将它们转换为 Xamarin 代码

Try asceticcropper试试苦行僧

Customizable, predefined masks, works on ios and android可定制的预定义掩码,适用于 ios 和 android

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM