Skip to content

Base64 encoded images are cut off #40

Closed
@andrewjmead

Description

@andrewjmead

Hey, Simon.

First, thanks for the library. It's been quite helpful.

I'm using SwiftDraw to render a SVGs that are user uploaded. I noticed a problem with SVGs that have base64 encoded image data embedded in them. They're getting cut off no matter how I seem to configure it.

Most SVGs work just fine. A few, this one included, get clipped. Any thoughts on this?

Thanks!

Original SVG:

icon.svg.zip

Screenshot 2024-05-20

SwiftDraw rendered version

Screenshot 2024-05-20

Demo code I'm working with:

let svgURL = URL(string: "https://ps.w.org/independent-analytics/assets/icon.svg")!
let svg = SVG(fileURL: svgURL)
let desiredSize = CGSize(width: 96, height: 96)
self.image = svg?.rasterize(with: desiredSize) // I've also tried with no "with"

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