I have a form where the user can select an image (via a file dialogue) of any size which is then previewed in a pictureBox sized at 150px by 150px with the sizeMode of the pictureBox set to zoom any space that is then not occupied by the image is set to be fuscia.
I have my method which converts the contained image into a base64 string - However the image string is being created from the original full size image, NOT the scaled image.
Any suggestions would be welcomed as Googling has turned up no helpful results.
My code for converting to Base64 below:
public string ImageToBase64(Image image, ImageFormat format)
{
using (MemoryStream ms = new MemoryStream())
{
// Convert Image to byte[]
image.Save(ms, format);
byte[] imageBytes = ms.ToArray();
// Convert byte[] to Base64 String
string base64String = Convert.ToBase64String(imageBytes);
// Set next button on the Navigation to be active
navControl.activateNext();
//return the String code to caller
return base64String;
}
}