RevitAPI: Document.ExportImage exports some .jpg files when setting ImageFileType set to PNG

Image export feature is available in RevitAPI, that is: Document.ExportImage method, a real example is:

FilteredElementCollector FEC_Views = new FilteredElementCollector(OpenDoc).OfClass(typeof(View));
StringBuilder sb = new StringBuilder();
foreach (View View in FEC_Views)
    if (View.IsTemplate) continue;
    IList<ElementId> ImageExportList = new List<ElementId>();
    var NewViewName = View.Name.ToString().Replace(".", "-");
    var BilledeExportOptions_3D_PNG = new ImageExportOptions
        ZoomType = ZoomFitType.FitToPage,
        PixelSize = 2024,
        FilePath = ParentFolder + @"" + NewViewName,
        FitDirection = FitDirectionType.Horizontal,
        HLRandWFViewsFileType = ImageFileType.PNG,
        ImageResolution = ImageResolution.DPI_600,
        ExportRange = ExportRange.SetOfViews,

    BilledeExportOptions ..

This program can export all the exportable views into .png file.

In general, there is no problem, but for some special revit files, it will export some .jpg files as well, why that happens even if we set the exporting format to .png using HLRandWFViewsFileType = ImageFileType.PNG?

Read more

Leave a Comment