Crop and rotate a captured picture Xamarin.Android & Xamarin.iOS

旧巷老猫 提交于 2020-01-30 08:26:31

问题


Anyone knows a library that can take a picture with an Android or iOS smartphone and then offer a view to crop or rotate this image (so, without the native preview)

I work with PCL / Xamarin.Android / Xamarin.iOS (Not Xamarin.Form)


回答1:


You can use FFImageLoading to crop and rotate your images. Try to add pinch/swipe gesture recognizer to your images, when this event fires use the rotate transformation to rotate the image:

public RotateTransformation(double degrees, bool ccw, bool resize)
{
    ...
}

and the Crop Transformation to crop images:

public CropTransformation(double zoomFactor, double xOffset, double yOffset, double cropWidthRatio, double cropHeightRatio)
{
    ...
}

More details code can be found in the sample for each platform or PCL. But this only offers you the code, you should create your own interface to complete the user's interaction.

Also you can try other libraries like:

https://github.com/stormlion227/ImageCropper.Forms https://github.com/muak/Xamarin.Plugin.ImageEdit



来源:https://stackoverflow.com/questions/50061890/crop-and-rotate-a-captured-picture-xamarin-android-xamarin-ios

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!