LukeSmithxyz / voidrice

My dotfiles (deployed by LARBS)
GNU General Public License v3.0
4.27k stars 1.21k forks source link

lf-scope: adds SVG preview creating cache. #1360

Closed lpanebr closed 10 months ago

lpanebr commented 1 year ago

This uses inkscape (v1.3) to convert. It's quick and does not open the GUI.

matthew55 commented 11 months ago

Is there any reason to use Inkscape to accomplish this? I am able to get seemingly the same results just using convert.

image/svg+xml)
    CACHE="${XDG_CACHE_HOME:-$HOME/.cache}/lf/thumb.$(stat --printf '%n\0%i\0%F\0%s\0%W\0%Y' -- "$(readlink -f "$1")" | sha256sum | cut -d' ' -f1)"
    [ ! -f "$CACHE" ] && convert "$1" "$CACHE.jpg"
    image "$CACHE.jpg" "$2" "$3" "$4" "$5" "$1" ;;
lpanebr commented 11 months ago

convert will export using the document's page and may result in cropping: image

inkscape exports the objects: image

Of course, depending on the art exporting objects could algo give undesired results...

Since I have both and svg files download from the web usually won't have other objects laying around I chose to use inkscape.

matthew55 commented 11 months ago

Thanks for the response, I didn't realize convert could cause cropping issues.