question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Incorrect transformation into PNG (Black overlaying Boxes in PNG)

See original GitHub issue

Description

Convert an SVG into PNG leads into an PNG with black boxes overlay on other elements.
The PNG was made with “https://inkscape.org/” where those boxes are not visible.

Example data

Source SVG:
concept

Source packed in ZIP: concept.svg.zip

Result PNG:
concept

Screenshot Chrome Browser (Version 108.0.5359.125):
image

Screenshot Edge Browser (Version 108.0.1462.76):
image

Used Versions

  • Svg.3.4.0
  • Microsoft .NET V 6.0.12
  • Win 10 Enter. / 21H2 / 19044.2251

Code snipped

private static string ConvertSvgToPng(string path)
        {
            // Create PNG Image from SVG-File
            var svgDocument = SvgDocument.Open(path);
            svgDocument.ShapeRendering = SvgShapeRendering.Auto;
            svgDocument.FillRule = SvgFillRule.Inherit;
            //svgDocument.FillOpacity = 1;

            Bitmap bmp = svgDocument.Draw();

            path = path.Replace(".svg", ".png");
            bmp.Save(path, ImageFormat.Png);
            return path;
        }

Issue Analytics

  • State:closed
  • Created 8 months ago
  • Comments:11 (1 by maintainers)

github_iconTop GitHub Comments

2reactions
RedCalicommented, Jan 13, 2023

i’m not sure what it did not read in the commits between the latest and my used version (3.4.0), i thought there was nothing done towards that case as far is i read the commits made.

It seems to me that the issue is any how fixed for the problem with the latest release.

With V3.4.4 i can not reproduce the error any more… Sorry for any inconvenience and thank you all for you’re quick reaction and help, I close the issue as i don’t need any more Help and the problem do not exist any more.

1reaction
H1Gdevcommented, Jan 11, 2023

The following error is displayed in Development tool.

Refused to apply inline style because it violates the following Content Security Policy directive: "default-src 'none'". Either the 'unsafe-inline' keyword, a hash ('sha256-2n/Bb89SPcU1jjmmeqY5KIgcpt4u+NZFBq4bNA8J+A8='), or a nonce ('nonce-...') is required to enable inline execution. Note also that 'style-src' was not explicitly set, so 'default-src' is used as a fallback.
Read more comments on GitHub >

github_iconTop Results From Across the Web

PNG image's transparency overlaps a CSS background ...
The PNG image is the sidebar, and the black part is the CSS background, the PNG's alpha seems to override the black box....
Read more >
PNG Image - Black only when in front of other objects
Where they are overlapping it has turned black again, because there are 2 transparent layers. You can imagine that using small values will ......
Read more >
How to fix black background issue with PNG files in Photoshop
I am experiencing an issue with all transparent png files copied from Chrome and pasted into Photoshop CS6. The background is black rather...
Read more >
Transforming a PNG element is causing a white box
I am brining a png file into PSE 13. After adding it to a layer, resizing, and rotating the image, I end up...
Read more >
Weird extra gray box around transparent PNG in indesign
The areas where the PNG overlaps the gray shapes there is an additional gray box, that is close in size to the PNG's...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found