Layers missing when converting corel draw file to jpg or png

We are evaluating Aspose.Imaging for our corel draw files noticed that one of our test files have missing layers when converted to jpg or png. It also altered some of the layout of the text. Hope you could help me if this is a issue or missing code that i need.

Original file
image.png (44.3 KB)

Jpg
image.jpg (131.2 KB)

Png
image.jpg (128.7 KB)

Here is my code

private bool CreatePreviews(CreatePreviewMediaActionBase action)
{
    const int DpiResolution = 72;
    const string CdrFormat = "CDR";

    // Only process CDR files
    if (!action.EngineFormat.Equals(CdrFormat, StringComparison.OrdinalIgnoreCase))
    {
        throw new MediaEngineException("File not supported.", false);
    }

    var stopwatch = Stopwatch.StartNew();

    try
    {
        using var inputStream = File.OpenRead(action.Path);
        long fileSizeBytes = inputStream.Length;

        using var image = Image.Load(inputStream);
        // Cast to CdrImage to access pages
        CdrImage cdrImage = image as CdrImage;
        if (cdrImage == null)
        {
            throw new MediaEngineException("Failed to load CDR image.", false);
        }

        // Get pages array - for single page CDR, Pages will contain one page
        Image[] pages = cdrImage.Pages;
        int pageCount = pages.Length;
        int pageNumber = 1;

        // Generate a preview for each page
        foreach (Image page in pages)
        {
            // Calculate preview size
            int previewWidth;
            int previewHeight;
            action.CalculateImageSize(Convert.ToInt32(page.Width), Convert.ToInt32(page.Height), DpiResolution, out previewWidth, out previewHeight);

            // Get output path based on format
            string previewPath = App.GetTemporaryFile(action.PreviewFormat.ToString());

            // Configure rasterization options with white background
            VectorRasterizationOptions rasterizationOptions = new CdrRasterizationOptions
            {
                PageWidth = previewWidth,
                PageHeight = previewHeight
            };

            // Save based on the requested format
            switch (action.PreviewFormat)
            {
                case ImageFormat.Jpg:
                    var jpegOptions = new JpegOptions
                    {
                        Quality = 75,
                        VectorRasterizationOptions = rasterizationOptions
                    };
                    page.Save(previewPath, jpegOptions);
                    break;

                case ImageFormat.Png:
                    var pngOptions = new PngOptions
                    {
                        ColorType = Aspose.Imaging.FileFormats.Png.PngColorType.TruecolorWithAlpha,
                        PngCompressionLevel = PngCompressionLevel.ZipLevel9,
                        FilterType = Aspose.Imaging.FileFormats.Png.PngFilterType.None,
                        Progressive = true,
                        VectorRasterizationOptions = rasterizationOptions
                    };
                    page.Save(previewPath, pngOptions);
                    break;

                case ImageFormat.WebP:
                    var webpOptions = new WebPOptions
                    {
                        Lossless = true,
                        VectorRasterizationOptions = rasterizationOptions
                    };
                    page.Save(previewPath, webpOptions);
                    break;

                default:
                    throw ErrorHelper.CreateGraphicEngineFileFormatNotSupportedForThumbnailAndPreview(App, EngineId);
            }

            // Add preview with page number (1-based)
            action.Previews.Add(new Preview(previewPath, pageNumber, previewWidth, previewHeight));
            pageNumber++;
        }

        stopwatch.Stop();

        var additionalInfo = new Dictionary<string, string>
            {
                {"Function","AsposeImagingMediaEngine.CreatePreviews" },
                {"Duration", stopwatch.ElapsedMilliseconds.ToString()},
                {"FileSizeBytes", fileSizeBytes.ToString()},
                {"PageCount", pageCount.ToString()},
                {"OutputFormat", action.PreviewFormat.ToString()}
            };

        App.WriteTrace("AsposeImagingMediaEngine", TraceSeverity.Information, additionalInfo);

        return true;
    }
    catch (ImageLoadException ex)
    {
        stopwatch.Stop();
        App.Log(LogSeverity.Error, "AsposeImagingMediaEngine.CreatePreviews: CDR files are not supported or corrupted", ex);
        throw new MediaEngineException("CDR files are not supported or corrupted.", ex, false);
    }
    catch (Exception ex)
    {
        stopwatch.Stop();
        App.Log(LogSeverity.Error, "AsposeImagingMediaEngine.CreatePreviews: An error occurred during the create preview process", ex);
        throw new MediaEngineException("An error occurred during the create preview process.", ex, false);
    }

}

I’ve also attached the files for your reference
testFiles.zip (2.5 MB)

Could you also let me know the expected output if the CDR contains a transparent background and converted to png. Does it support transparent or the image will just have a white background with red border?

@3stan

Summary
When a Corel DRAW (CDR) file is rasterized with Aspose.Imaging, some layers or text may not appear exactly as in the original. The SDK rasterizes the page onto a bitmap, and any features that are not fully supported (certain layer types, effects, or missing fonts) can be omitted or rendered differently. By default the rasterizer uses an opaque background, so a transparent background in the CDR will be rendered as a solid colour unless you explicitly change the background handling.

Why it happens

  • Partial CDR support – Aspose.Imaging does not implement every CDR feature. Objects that rely on unsupported effects, hidden layers, or special blend modes may be dropped during rasterization.
  • Background handling – If no background colour is specified, the rasterizer fills the canvas with white (or the default colour). Consequently a transparent background in the source CDR will not be preserved in the output image.
  • Font availability – When the fonts used in the CDR are not installed on the machine, the library substitutes them, which can change the appearance and positioning of text.
  • Version differences – Earlier releases of the library had more limitations with CDR files; newer releases contain improvements, but some edge‑cases may still exist.

What to do next

  1. Use the latest Aspose.Imaging version – Upgrade to the most recent release and re‑run the conversion. Many CDR‑related issues have been addressed in recent updates.
  2. Check background settings – If you need a transparent PNG, configure the rasterization options (if the API provides a background‑colour property) to use a transparent colour before saving as PNG.
  3. Verify layer visibility – Inspect the CdrImage object for layer information (e.g., cdrImage.Layers) and ensure that required layers are marked visible before rasterizing.
  4. Make required fonts available – Install any custom fonts used in the CDR on the conversion machine, or embed the fonts in the CDR file beforehand to avoid substitution.
  5. Provide a minimal reproducible sample – If the problem persists, create a small CDR file that demonstrates the missing layers or text, and include details such as the Aspose.Imaging version, OS, and runtime. This will help the support team determine whether the behaviour is a limitation or a bug.

Following these steps should help you obtain PNG output with the desired background handling and identify why certain layers are omitted.

Note: The above guidance is based on general Aspose.Imaging behaviour. For precise API names and property support, refer to the official Aspose.Imaging documentation for the version you are using.

:warning: I could not fully verify this explanation against the retrieved sources. Please double-check the behaviour in your environment and confirm the exact SDK/version.

@3stan hi.

This looks like a complex issue.

  1. Looks like the library does not have access to the fonts and a result Sans is used instead of Serif. What OS do you use?

  2. Missing layers. If I understand correctly, we are talking here about shark’s teeth and nose. Looks like it’s on our side. We’ll research it.

  3. Background color. To achieve the transparent background you can use

VectorRasterizationOptions rasterizationOptions = new CdrRasterizationOptions
{
    BackgroundColor = Color.Transparent,
};

I simplified a bit your code while testing and recieved these two results with the following code:

using var inputStream = File.OpenRead(inputPath);
using var image = (CdrImage)Image.Load(inputStream);
int pageNumber = 1;

foreach (Image page in image.Pages)
{
    VectorRasterizationOptions rasterizationOptions = new CdrRasterizationOptions
    {
        BackgroundColor = Color.Transparent,
        PageWidth = Convert.ToInt32(page.Width),
        PageHeight = Convert.ToInt32(page.Height)
    };

    var pngOptions = new PngOptions
    {
       
        ColorType = Aspose.Imaging.FileFormats.Png.PngColorType.TruecolorWithAlpha,
        PngCompressionLevel = PngCompressionLevel.ZipLevel9,
        FilterType = Aspose.Imaging.FileFormats.Png.PngFilterType.None,
        Progressive = true,
        VectorRasterizationOptions = rasterizationOptions
    };
    page.Save(previewPath + pageNumber + ".png", pngOptions);

    pageNumber++;
}

result.png (26.2 KB)
result1.png (29.0 KB)

As you can see the layers issue is reproduced with default VectorRasterizationOptions, and can be avoided with transparency. However, I don’t have fonts issue on the PC with Windows 11.