I have an Image with its height, width and parameters. The objective is to create a file with pngs/jpgs into SVG. This SVG has to be portable without any additional files. When I tried with the approach mentioned in the SVGO documentation (code below), the svg takes a link reference to the Image. So when the image is deleted, svg will not have the Image in it. How do I push Image's byte[] into the SVG so that it becomes portable? I have tried the below code.
func createSvgFromImage(ImageObjectStructures []ImageObjectStructure, filename string) {
filename += ".svg"
file, err := os.Create(filename)
if err != nil {
fmt.Println("svg file creation error:", err)
}
width := int(10000) // Has to be taken from individual page size
height := int(10000) // Has to be taken from individual page size
svg := svg.New(file)
svg.Start(width, height)
for i := 0; i < len(ImageObjectStructures); i++ {
svg.Image(ImageObjectStructures[i].XPosition, ImageObjectStructures[i].YPosition, ImageObjectStructures[i].Width, ImageObjectStructures[i].Height, ImageObjectStructures[i].ImagePath, ImageObjectStructures[i].ImageCaption)
file.Write(ImageObjectStructures[i].ImageData)
}
svg.End()
}