Magick.NET in Azure converting SVG to PNG gives black boxes

Using Magick.NET-Q16-AnyCPU I am converting an SVG to PNG with this minimal code:

var bytes = File.ReadAllBytes("test.svg");
var magickReadSettings = new MagickReadSettings { Format = MagickFormat.Svg };
using var image = new MagickImage(bytes, magickReadSettings) { Format = MagickFormat.Png };
image.Write("test.png");

Locally that works fine, and the PNG looks correct having a text (expected):

PNG local

But when deployed to an Azure App Service, the PNG gets black boxes (actual):

enter image description here

The SVG file looks like this (minimal):

<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"[]>
<svg width="100px" height="50px" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xml="http://www.w3.org/XML/1998/namespace" version="1.1">
    <g transform="translate(10, 10)">
    <text transform="translate(50, 0)">foo</text>
  </g>
</svg>

How can that be?

Upvotes: 0

Views: 792

Answers (1)

Rob Reagan
Rob Reagan

Reputation: 7696

This is an issue related to fonts installed on App Service. There is a discussion of this issue and resolution at the bottom of the discussion here.

Upvotes: 1

Related Questions