0

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.

ahmed khattab
  • 2,311
  • 3
  • 16
  • 30

3 Answers3

0

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

N Subedi
  • 2,858
  • 2
  • 22
  • 36
0

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);
Junior Jiang
  • 12,430
  • 1
  • 10
  • 30
0

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];
ahmed khattab
  • 2,311
  • 3
  • 16
  • 30