i have an excel document in which images get added on to. Some of my images loads correctly and some of them are been rotated on it own.
this is part of my code
if (!base64Image.IsNullOrEmpty())
{
int ColumnCount = 3;
string x = base64Image.Substring(base64Image.LastIndexOf(',') + 1);
var bitmapData = Convert.FromBase64String(x);
var streamBitmap = new System.IO.MemoryStream(bitmapData);
var bitmap = new Bitmap((Bitmap)Image.FromStream(streamBitmap,true));
var image = bitmap;
ExcelPicture picture = null;
if (image != null)
{
picture = excelWorksheet.Drawings.AddPicture("Hello", image);
picture.From.Column = ColumnCount;
picture.From.Row = rowCounter+1;
picture.SetSize(150, 150);
}
}
stream = new MemoryStream(excelPackage.GetAsByteArray());
excelToSend = stream.ToArray();
stream.Close();
i tried to set no rotation on the image variable like:
var image = bitmap;
image.RotateFlip(RotateFlipType.RotateNoneFlipNone);
but nothing happens.
i did researching online and they mentioned it could be something to do with orientation tags. also tried example. But my propertyitems is always empty
this is what the bitmap variable looks like when the image is been read from the stream