Skip to content

ImageExport.PuppeteerSharpRenderer scales images by a factor of 2 #178

@pirrmann

Description

@pirrmann

Description

All exports executed with Plotly.NET.ImageExport.PuppeteerSharpRenderer scale the image dimensions by a factor of 2. This is actually hard-coded in the following line:

+ $".then(x => Plotly.toImage(x, {{ format: '{StyleParam.ImageFormat.toString format}', scale: 2, width: {width}, height: {height} }}))"

Repro steps

Any export a chart using PuppeteerSharpRenderer triggers the issue. This is true for JPEG, PNG and even SVG.
Chart.savePNG("temp", Width = 270., Height = 270.) will produce an image of size 540*540

Expected behavior

I'd expect the default scale ratio to be 1. An optional argument could be introduced, in order to export with a different scale ratio (in order to increase the resolution for instance), but I think the default should export exactly the same image as the one that could have been produced in the HTML page.

Actual behavior

The dimensions of the exported image are twice the ones that are passed in the arguments.

Known workarounds

Others parameters can be changed (such as exporting to half of the expected size), but the image does not look exactly the same, and this doesn't feel like a correct API.

Related information

Irrelevant.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions