Skip to content

Bad conversion from SVG to PNG #371

Open
@roughnecks

Description

@roughnecks

ImageMagick version

8:6.9.11.60+dfsg-1.6+deb12u2

Operating system

Linux

Operating system, version and so on

Debian Stable (Bookworm)

Description

Hi,
if I load an svg file in a php script and convert it to png, the resulting image is broken, doesn't respect the original.

Steps to Reproduce

<?php

$svgFile = 'input.svg';
$outputPng = 'output.png';

try {

    $imagick = new Imagick();

    $imagick->setResolution(300, 300);

    $imagick->readImage($svgFile);

    $imagick->setImageFormat('png');

    $imagick = $imagick->flattenImages();

    $imagick->writeImage($outputPng);

    $imagick->clear();
    $imagick->destroy();

    echo "SVG converted to PNG successfully.\n";
} catch (Exception $e) {
    echo 'Error: ' . $e->getMessage() . "\n";
}
?>

Images

Image

Image

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