Skip to content

[Bug] draw SVG & [Feature] combine with Identify header #43

@tkapias

Description

@tkapias

[Bug] SVG

For me the image() function can't handle SVG files without conversion.

In vifmimg, I added an "svg" case which passes by a png conversion.

        "draw")
			FILE="$PWD/$6"
			image "$1" "$2" "$3" "$4" "$5" "$FILE"
			;;
        "svg")
			[ ! -f "$PCACHE" ] && \
				convert -background none "$6" "${PCACHE}.png"
			image "$1" "$2" "$3" "$4" "$5" "${PCACHE}.png"
			;;

In vifmrc:

" Images & SVG
filextype {*.bmp,*.jpg,*.jpeg,*.png,*.gif,*.xpm,*.ico,*.tif,*.svg},<image/*> {View in qimgv} qimgv %f,
fileviewer <image/svg\+xml> $HOME/.config/vifm/scripts/vifmimg svg %px %py %pw %ph %c %pc $HOME/.config/vifm/scripts/vifmimg clear
fileviewer <image/*> $HOME/.config/vifm/scripts/vifmimg draw %px %py %pw %ph %c %pc $HOME/.config/vifm/scripts/vifmimg clear

[Feature] Identify header for images

I wanted to combine the display of images and the output of "identify" as header.

In vifmimg, I added a new function image_margin_top() with a top margin of 2 Lines:

image_margin_top() {
		printf '{"action": "add", "identifier": "vifm-preview", "x": "%s", "y": "%s", "width": "%s", "height": "%s", "scaler": "contain", "path": "%s"}\n' "$2" "$(( $3 + 2 ))" "$4" "$(( $5 - 2 ))" "$6" > "$FIFO_UEBERZUG"
}

I modifies "draw" & "svg" cases to use this function and then call identify:

        "draw")
			FILE="$PWD/$6"
			image_margin_top "$1" "$2" "$3" "$4" "$5" "$FILE"
			identify "$FILE" | awk '{print $2,$3,$4,$5,$6,$7}'
			;;
        "svg")
			[ ! -f "$PCACHE" ] && \
				convert -background none "$6" "${PCACHE}.png"
			image_margin_top "$1" "$2" "$3" "$4" "$5" "${PCACHE}.png"
			identify "$PWD/$6" | awk '{print $2,$3,$4,$5,$6,$7}'
			;;

Example:

image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions