private byte[] RotateAndScale(byte[] photo, out GeoLoc geoLoc) { using (var image = Image.Load(photo)) { try { geoLoc = GeoLoc.FromExif(image.MetaData); } catch { geoLoc = null; } image.Mutate(x => x .AutoOrient() .Resize(new ResizeOptions() { Size = new SixLabors.Primitives.Size(1024, 768), Mode = ResizeMode.Max })); var ms = new MemoryStream(); image.SaveAsJpeg(ms); // return Convert.ToBase64String(ms.ToArray()); return(ms.ToArray()); } }