Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

cropping image universal app c#

i want to crop an image with x and y in universal app , i have searched alot and find nothing useful my idea is i have an image and i want to crop rectangle from it based on start x , y - end x and y

i have tried this

BitmapImage img = new BitmapImage(new Uri(file.Path));
WriteableBitmap topLeft = img.Crop(0, 0, halfWidth, halfHeight);

it say BitmapImage does not contain definition for crop

another thing : how can i convert BitmapImage to WriteableBitmap in universal app ?

like image 450
Tohami Hussin Avatar asked Mar 20 '26 09:03

Tohami Hussin


1 Answers

Have you tried the BitmapEncoder/BitmapDecoder classes? Checkout the MSDN code sample.

like image 191
Abdulwahab Suleiman - MSFT Avatar answered Mar 21 '26 23:03

Abdulwahab Suleiman - MSFT



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!