Skip to content

Problems with embedded image sizes #395

@Technickfreak

Description

@Technickfreak

The tool I am using to convert SVG files to JPG is encountering issues with embedded images. In the provided SVG code, the image is correctly positioned, but its size does not match the specified dimensions.

<?xml version="1.0" encoding="utf-8"?>
<svg viewBox="-120 -120 240 240" xmlns="http://www.w3.org/2000/svg">
  <circle cx="0" cy="0" r="120"/>

  <circle cx="-50" cy="-60" r="30" fill="#ff00ff"/>
  <circle cx="-50" cy= "60" r="30" fill="#00ffff"/>

  <circle cx="60" cy= "50" r="30" fill="#ffff00"/>
  <circle cx="60" cy="-50" r="30" fill="#ff0000"/>

  <g fill="none" stroke="black">
    <path stroke-width="7" stroke-linecap="round" d="M50 -50  70 -50" />
    <path stroke-width="7" stroke-linecap="round" d="M60 -40  60 -60" />

    <path stroke-width="7" stroke-linecap="round" d="M50  50  70  50" />
  </g>

  <rect x="-100" y="-25" rx="25" ry="25" width="130" height="50" style="fill:#ffffff" />


  <image x="-70" y="40" width="40" height="40" href="save-44.svg" />
  <image x="-70" y="-80" href="home-360.svg" width="40px" height="40px"/>


</svg>

Parameter

drawing = svg2rlg("Bilder\\Parameter.svg")
renderPM.drawToFile(drawing, "Bilder\\temp.png", fmt="PNG")

temp

home-360.svg:
home-360

save-44.svg:
save-44

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions