Essential DocIO doesn’t have a direct API to change image format. Since System.Drawing namespace is not available in ASP.NET Core platform you need to use any one of the alternative image processing library (as mentioned in MSDN) to change the image format of the picture.
Here, the below example code used the CoreCompat helper library to change the image format:
WPicture picture = item as WPicture;
//Load the DocIO WPicture image bytes into CoreCompat Image instance.
Image image = Image.FromStream(new MemoryStream(picture.ImageBytes));
//Check image format, if format is other than png then convert the image as png format.
if (!image.RawFormat.Equals(ImageFormat.Png))
{
MemoryStream imageStream = new MemoryStream();
image.Save(imageStream, ImageFormat.Png);
//Load the png format image into DocIO WPicture instance.
picture.LoadImage(imageStream);
imageStream.Dispose();
}
//Resize the picture width and height.
picture.Width = 400;
picture.Height = 400;