SDWebImageSVGCoder icon indicating copy to clipboard operation
SDWebImageSVGCoder copied to clipboard

Decoded SVG is not a vector on macOS

Open ladvoc opened this issue 9 months ago • 0 comments

After decoding an SVG to an NSImage on macOS 14.4.1, the sd_isVector property returns false:

func testDecodeSVG() throws {
    let url = Bundle(for: AppTests.self).url(forResource: "flag", withExtension: "svg")!
    let svgData = try! Data(contentsOf: url)
        
    let image = SDImageSVGCoder.shared.decodedImage(with: svgData, options: [:])!
    XCTAssertTrue(image.sd_isVector) // false
    print(image.representations)
}

However, printing the NSImage's representations reveals it does contain an NSSVGImageRep:

[_NSSVGImageRep 0x600002e7caf0 Size={1235, 650} ColorSpace=Generic RGB colorspace BPS=0 Pixels=0x0 Alpha=NO AppearanceName=(null)]

ladvoc avatar May 18 '24 18:05 ladvoc