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.

SVG to GIF export broken since version 7.14.5

See original GitHub issue

Description

I have tried all versions released since 7.14.5 and all result in half-rendering and CPU hogging.

Steps to Reproduce

Run the code below using this example SVG and notice how the text at the bottom is not rendered correctly in any version above 7.14.5.

7.14.5 rendering result: view 7.15.0+ rendering result: view

CPU issues are harder to replicate; I published this code to an Azure Web App and everything works fine for the first N conversions, At a certain point the CPU gets blocked and all requests time out. I ran a dump analysis, results are here for download.

namespace ImageConverter
{
    public class Converter
    {
        private const int RequiredWidth = 1600;
        private const int MinDpi = 300;

        public static byte[] SvgToGif(Stream svgFileStream)
        {
            using (var svgToGif = new MagickImage())
            {
                // read SVG stream
                svgToGif.Read(svgFileStream, new MagickReadSettings
                {
                    Font = "arial.ttf",
                    Format = MagickFormat.Msvg
                });

                svgToGif.Density = new Density(MinDpi);
                svgToGif.Trim();
                svgToGif.RePage();

                if (svgToGif.Width != RequiredWidth)
                {
                    var resizePercentage = 100 / ((double)svgToGif.Width / RequiredWidth);
                    svgToGif.Resize(new Percentage(resizePercentage));
                }

                // convert new specs to GIF
                svgToGif.Format = MagickFormat.Gif;
                return svgToGif.ToByteArray();
            }
        }
    }
}

System Configuration

  • Magick.NET version: > 7.14.5
  • Environment (Operating system, version and so on): win-x86 / win-x64

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
dlemstracommented, May 17, 2020

A new release that includes a fix for your issue has been published (17.0.0.1). Can you test if you are still experiencing the CPU issue with that new release?

0reactions
deniouscommented, May 19, 2020

Deployed the latest version on Monday, been running good!

Read more comments on GitHub >

github_iconTop Results From Across the Web

The Complete Guide to Converting SVG to GIF with Ease
To convert SVG to GIF, you need to use an SVG to GIF converter or a GIF ... Download the converted file after...
Read more >
Image degradation with resize · Issue #18 · dlemstra/Magick.NET
This appears to be a bug in the OpenCL resize code. I will publish a new release this weekend. ... SVG to GIF...
Read more >
SVG export broken...can I transfer to another program?
I want to export my work to SVG but now realise that CSP can't export the colours and creates glitches with the linework...
Read more >
Convert SVG Animation to GIF - YouTube
In this short video Chris shows his process of capturing SVG animations and converting them to GIFs using GreenSock for the animation, ...
Read more >
SVG export is broken in Illustrator 2018 - how can...
I have sucessfully edited and exported SVG files with these versions previously. However, now these versions show the same bugs, it looks like ......
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