[F] SVG for smaller images

This commit is contained in:
2025-10-26 23:57:22 +08:00
parent b91de1de56
commit dbc686debf
@@ -36,9 +36,9 @@ suspend fun genSvg(template: String, imagePath: String): Pair<String, ExifResult
.replace("245mm  F6.3  1/500s  ISO-100", exif.shutterInfo)
.replace("a12ym", exif.urlName)
.replace("""<image id="_Image1" width="6192px" height="4128px" xlink:href="data:image/jpeg;base64,.*?"/>""".toRegex(),
"""<image id=\"_Image1\" width=\"${exif.w}px\" height=\"${exif.h}px\" xlink:href=\"data:image/jpeg;base64,${Base64.getEncoder().encodeToString(imageData)}\"/>""")
"""<image id="_Image1" width="6192px" height="4128px" preserveAspectRatio="xMidYMid slice" xlink:href="data:image/jpeg;base64,${Base64.getEncoder().encodeToString(imageData)}"/>""")
.replace("""<image id="_Image3" width="100px" height="100px" xlink:href="data:image/png;base64,.*?"/>""".toRegex(),
"""<image id=\"_Image3\" width=\"100px\" height=\"100px\" xlink:href=\"data:image/png;base64,${Base64.getEncoder().encodeToString(stream.toByteArray())}\"/>""")
"""<image id="_Image3" width="100px" height="100px" xlink:href="data:image/png;base64,${Base64.getEncoder().encodeToString(stream.toByteArray())}"/>""")
return svg to exif
}