I pick an image from the device and it's mirrored that's normal but I want to flip it horizontally before send it to API as to preview it after that normal not mirrored and do this on base64 string image.
-
Hi, have you solved this ? – Junior Jiang Jul 03 '19 at 07:59
-
Yes but managed to flip it when it bitmap not base64 on android and iOS the solution is in answers below – ahmed khattab Jul 03 '19 at 08:00
-
Great , saw it :) – Junior Jiang Jul 03 '19 at 08:06
3 Answers
You have not posted all the information however. In Xamarin Forms Platform you can use FFImageLoading plugin which supports the transformation you are looking for. It support:
- FlipTransformation
- RotateTransformation
Follow the link to find their implementation here: https://github.com/luberda-molinet/FFImageLoading/blob/master/samples/ImageLoading.Forms.Sample/Shared/Pages/Transformations/FlipTransformationPage.xaml

- 2,858
- 2
- 22
- 36
Your question did not explain clearly what you want to do.You can update it with more detail you want to conver what type to what type First.Whatever, I show a possible answer.
image path to base64 string:
// provide read access to the file
FileStream fs = new FileStream(media.Path, FileMode.Open,FileAccess.Read);
// Create a byte array of file stream length
byte[] ImageData = new byte[fs.Length];
//Read block of bytes from stream into the byte array
fs.Read(ImageData,0,System.Convert.ToInt32(fs.Length));
//Close the File Stream
fs.Close();
string _base64String = Convert.ToBase64String (ImageData);
base64 string to byte[]:
byte[] data = Convert.FromBase64String (FileRespone);

- 12,430
- 1
- 10
- 30
I used to flip the image as bitmap not Base64
in Android
https://acomputerengineer.wordpress.com/2016/06/07/flip-imagebitmap-horizontally-and-vertically-in-android/
in IOS:
How to flip UIImage horizontally?
UIImage sourceImage = uiImage;//[UIImage imageNamed: @"whatever.png"];
UIImage flippedImage = sourceImage.GetImageFlippedForRightToLeftLayoutDirection();
//[UIImage imageWithCGImage: sourceImage.CGImage scale: sourceImage.scale orientation: UIImageOrientationUpMirrored];

- 2,311
- 3
- 16
- 30