add exif to png
This commit is contained in:
parent
d1040bf4f8
commit
0292ea2627
6 changed files with 8 additions and 7 deletions
|
|
@ -432,10 +432,10 @@ func _render(ctx context.Context, ms *xmain.State, plugin d2plugin.Plugin, sketc
|
|||
if err != nil {
|
||||
return svg, err
|
||||
}
|
||||
// out, err = png.AddExif(out)
|
||||
// if err != nil {
|
||||
// return svg, err
|
||||
// }
|
||||
out, err = png.AddExif(out)
|
||||
if err != nil {
|
||||
return svg, err
|
||||
}
|
||||
} else {
|
||||
if len(out) > 0 && out[len(out)-1] != '\n' {
|
||||
out = append(out, '\n')
|
||||
|
|
|
|||
|
|
@ -1780,7 +1780,7 @@ func Render(diagram *d2target.Diagram, opts *RenderOpts) ([]byte, error) {
|
|||
dimensions = fmt.Sprintf(` width="%d" height="%d"`, w, h)
|
||||
}
|
||||
|
||||
fitToScreenWrapper := fmt.Sprintf(`<svg %s d2:version="%s" preserveAspectRatio="xMinYMin meet" viewBox="0 0 %d %d"%s>`,
|
||||
fitToScreenWrapper := fmt.Sprintf(`<svg %s d2Version="%s" preserveAspectRatio="xMinYMin meet" viewBox="0 0 %d %d"%s>`,
|
||||
`xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"`,
|
||||
version.Version,
|
||||
w, h,
|
||||
|
|
|
|||
Binary file not shown.
|
Before Width: | Height: | Size: 15 KiB After Width: | Height: | Size: 15 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 72 KiB After Width: | Height: | Size: 72 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 28 KiB After Width: | Height: | Size: 28 KiB |
|
|
@ -13,6 +13,7 @@ import (
|
|||
pngstruct "github.com/dsoprea/go-png-image-structure/v2"
|
||||
"github.com/playwright-community/playwright-go"
|
||||
|
||||
"oss.terrastruct.com/d2/lib/version"
|
||||
"oss.terrastruct.com/util-go/xmain"
|
||||
)
|
||||
|
||||
|
|
@ -109,12 +110,12 @@ func AddExif(png []byte) ([]byte, error) {
|
|||
|
||||
ib := exif.NewIfdBuilder(im, ti, exifcommon.IfdStandardIfdIdentity, exifcommon.TestDefaultByteOrder)
|
||||
|
||||
err = ib.AddStandardWithName("ImageWidth", []uint32{11})
|
||||
err = ib.AddStandardWithName("Make", "D2")
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
err = ib.AddStandardWithName("ImageLength", []uint32{22})
|
||||
err = ib.AddStandardWithName("Model", version.Version)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue