We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Converting a .wmf image to .jpg image on IImageSavingCallback


I was just wondering if I can change the type of an image from .wmf to .jpg while in call back “IImageSavingCallback”.


Hi Indumathi,

Thanks for your inquiry. I think, you can use the following code to convert an image to JPEG format inside IImageSavingCallback.ImageSaving Method:

class HtmlImageExportCallback
: IImageSavingCallback


public void ImageSaving(ImageSavingArgs args)


if (args.IsImageAvailable && args.ImageFileName.EndsWith(".wmv"))


String path = "C:\\temp\\" + args.ImageFileName.Replace(".wmv", ".jpg");

ShapeRenderer r = args.CurrentShape.GetShapeRenderer();

ImageSaveOptions options = new ImageSaveOptions(SaveFormat.Jpeg);

r.Save(path, options);

args.ImageStream = new MemoryStream();

args.KeepImageStreamOpen = false;




I hope, this helps.

Best regards,