OK, I hacked a pathway for the thumbnail endpoint (ui/thumbnail/ref) to send the svg file data directly without attempting to resize it:
https://github.com/perkeep/perkeep/pull/1695/files?diff=unified&w=1 This allows SVGs to be used as image thumbnails for permanodes, without having to parse them as images using the golang `image` package. Would love to get feedback on this PR! On Monday, May 19, 2025 at 12:22:20 PM UTC-4 Quinn wrote: > definitely, I'm just trying to slot it in to the existing workflow for how > image previews are handled, with minimal changes. The js code is harder to > understand than the go code, for me at least. I'm happy to try that > approach instead, if it seems like a more merge-able contribution. > > On Monday, May 19, 2025 at 11:39:12 AM UTC-4 ivucica wrote: > >> Why rasterize SVGs? Unless an SVG is overly complex, it’s easier to just >> pass it in src attribute as-is, and just override width and height as >> needed, no? >> >> On 19 May 2025, at 14:02, Quinn <[email protected]> wrote: >> >> Hi, i have a PR that adds webp support: >> >> >> >> https://github.com/perkeep/perkeep/pull/1695 >> >> When working on this i found i have some cover images (used in >> camliContentImage) >> that are actually SVGs, so it would be nice for me if there was a way to >> treat SVGs as if they were regular images within perkeep. this isn't nearly >> as well supported as webp of course, i found this library which uses the go >> image system: >> >> https://github.com/gen2brain/svg/blob/main/decode.go >> >> This adds a lot of code in dependencies. Instead of this, I was thinking >> I could also add something that checks if you have a "convert" command >> available and shells out to that, otherwise just fails silently. So just >> works like it currently does, or will rasterize the image if you have >> imagemagick commands in your PATH. >> >> I'd like to do something here, would be nice to be able to preview SVGs >> the same way I can with other images. >> >> Quinn >> >> -- >> You received this message because you are subscribed to the Google Groups >> "Perkeep" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to [email protected]. >> To view this discussion visit >> https://groups.google.com/d/msgid/perkeep/136ef0b9-8935-40d5-8896-3a8ff5a7f669n%40googlegroups.com >> >> <https://groups.google.com/d/msgid/perkeep/136ef0b9-8935-40d5-8896-3a8ff5a7f669n%40googlegroups.com?utm_medium=email&utm_source=footer> >> . >> >> -- You received this message because you are subscribed to the Google Groups "Perkeep" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion visit https://groups.google.com/d/msgid/perkeep/f90747d4-7c25-4871-89db-24a013c5587dn%40googlegroups.com.
