We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
包含图片的svg转换成png后,生成的png没有包含图片;将xlink:href里面的图片链接换成base64的格式,生成的png也是没有包含图片;这个功能会支持吗
package resvg
import ( "context" "os" "testing" )
var svg = []byte(<?xml version="1.0" encoding="UTF-8" standalone="no" ?> <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" width="7700" height="7700" viewBox="0 0 426 426" xml:space="preserve"> <desc>Created with Fabric.js 3.6.3</desc> <defs> </defs> <rect x="0" y="0" width="100%" height="100%" fill="#65ff00"></rect> <g transform="matrix(0.006270794134768241 -0.07675173614922604 0.07675173614922604 0.006270794134768241 361.0456137833623 258.3543728388654)" > <image style="stroke: none; stroke-width: 0; stroke-dasharray: none; stroke-linecap: butt; stroke-dashoffset: 0; stroke-linejoin: miter; stroke-miterlimit: 4; fill: rgb(0,0,0); fill-rule: nonzero; opacity: 1;" xlink:href="08b37161-e079-4117-ace0-57455db235a6.png" x="-414" y="-271" width="828" height="542"></image> </g> </svg>)
<?xml version="1.0" encoding="UTF-8" standalone="no" ?> <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" width="7700" height="7700" viewBox="0 0 426 426" xml:space="preserve"> <desc>Created with Fabric.js 3.6.3</desc> <defs> </defs> <rect x="0" y="0" width="100%" height="100%" fill="#65ff00"></rect> <g transform="matrix(0.006270794134768241 -0.07675173614922604 0.07675173614922604 0.006270794134768241 361.0456137833623 258.3543728388654)" > <image style="stroke: none; stroke-width: 0; stroke-dasharray: none; stroke-linecap: butt; stroke-dashoffset: 0; stroke-linejoin: miter; stroke-miterlimit: 4; fill: rgb(0,0,0); fill-rule: nonzero; opacity: 1;" xlink:href="08b37161-e079-4117-ace0-57455db235a6.png" x="-414" y="-271" width="828" height="542"></image> </g> </svg>
func TestRender(t testing.T) { worker, err := NewDefaultWorker(context.Background()) if err != nil { t.Fatal(err) } defer worker.Close() renderer, err := worker.NewRenderer() if err != nil { t.Fatal(err) } / err = renderer.LoadFontDir("D:\fonts") if err != nil { t.Fatal(err) }*/ err = renderer.SetResourcesDir("D:\images") if err != nil { t.Fatal(err) } defer renderer.Close() b, err := renderer.RenderWithSize(svg, 4000, 4000) if err != nil { t.Fatal(err) } err = os.WriteFile("out.png", b, 0644) if err != nil { t.Fatal(err) } }
The text was updated successfully, but these errors were encountered:
#7 🐛🎨 修复内存泄漏及内嵌图片无法渲染 本地图片可以渲染了,网络链接图片仍待修复
Sorry, something went wrong.
No branches or pull requests
包含图片的svg转换成png后,生成的png没有包含图片;将xlink:href里面的图片链接换成base64的格式,生成的png也是没有包含图片;这个功能会支持吗
package resvg
import (
"context"
"os"
"testing"
)
var svg = []byte(
<?xml version="1.0" encoding="UTF-8" standalone="no" ?> <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" width="7700" height="7700" viewBox="0 0 426 426" xml:space="preserve"> <desc>Created with Fabric.js 3.6.3</desc> <defs> </defs> <rect x="0" y="0" width="100%" height="100%" fill="#65ff00"></rect> <g transform="matrix(0.006270794134768241 -0.07675173614922604 0.07675173614922604 0.006270794134768241 361.0456137833623 258.3543728388654)" > <image style="stroke: none; stroke-width: 0; stroke-dasharray: none; stroke-linecap: butt; stroke-dashoffset: 0; stroke-linejoin: miter; stroke-miterlimit: 4; fill: rgb(0,0,0); fill-rule: nonzero; opacity: 1;" xlink:href="08b37161-e079-4117-ace0-57455db235a6.png" x="-414" y="-271" width="828" height="542"></image> </g> </svg>
)func TestRender(t testing.T) {
worker, err := NewDefaultWorker(context.Background())
if err != nil {
t.Fatal(err)
}
defer worker.Close()
renderer, err := worker.NewRenderer()
if err != nil {
t.Fatal(err)
}
/ err = renderer.LoadFontDir("D:\fonts")
if err != nil {
t.Fatal(err)
}*/
err = renderer.SetResourcesDir("D:\images")
if err != nil {
t.Fatal(err)
}
defer renderer.Close()
b, err := renderer.RenderWithSize(svg, 4000, 4000)
if err != nil {
t.Fatal(err)
}
err = os.WriteFile("out.png", b, 0644)
if err != nil {
t.Fatal(err)
}
}
The text was updated successfully, but these errors were encountered: