Page 1 of 1

SVG support on Linux

Posted: Wed Mar 24, 2021 12:11 pm
by teresaejunior
Hi! I have created an include filter to show SVG files, and they appear in the file list, but are treated as unrecognized. I couldn't find instructions on how to properly enable SVG viewing for XnView on Linux. Is it unsupported? Thanks!

Re: SVG support on Linux

Posted: Wed Mar 24, 2021 12:29 pm
by cday
teresaejunior wrote: Wed Mar 24, 2021 12:11 pm Hi! I have created an include filter to show SVG files, and they appear in the file list, but are treated as unrecognized. I couldn't find instructions on how to properly enable SVG viewing for XnView on Linux. Is it unsupported? Thanks!
Hi! I've just downloaded an example SVG file and it opens in the viewer for me using File > Open... or a double-click... :D

I'm not immediately sure about browser configuration, what exactly do you mean when you say SVG files are not unrecognised, they're not displayed?

You have looked at all the Tools > Settings > Browser options, have you?

Re: SVG support on Linux

Posted: Wed Mar 24, 2021 7:09 pm
by teresaejunior
They appear as a blank file in the browser, and are not displayed in the previewer, after I created a filter including svg, since in the default configuration SVG is listed in the excludes filter.

EDIT: I see there is a `lib/imageformats/libqsvg.so` included.

EDIT 2: it works only in fullscreen mode, not in the browser or previewer, so maybe my filter is still wrong. But unfortunately, the displayed SVG quality is very poor.

Re: SVG support on Linux

Posted: Wed Mar 24, 2021 7:40 pm
by cday
teresaejunior wrote: Wed Mar 24, 2021 7:09 pm They appear as a blank file in the browser, and are not displayed in the previewer, after I created a filter including svg, since in the default configuration SVG is listed in the excludes filter.

EDIT: I see there is a `lib/imageformats/libqsvg.so` included.

EDIT 2: it works only in fullscreen mode, not in the browser or previewer, so maybe my filter is still wrong. But unfortunately, the displayed SVG quality is very poor.

After selecting View > View as... > Thumbnails, my downloaded SVG displays as a placeholder icon, not a thumbnail: possibly the particular SVG file doesn't contain a thumbnail if one is optional, which might also in principle be the case for yours. You might therefore look for other SVG files to test.

My downloaded SVG seems however to display correctly in the viewer/editor, if yours displays with very quality I suspect that you might possibly be seeing an embedded thumbnail if it does in fact have one??

I am attaching my SVG file, not very pretty but I couldn't find a better one that I downloaded fairly recently!

Edit: This recent thread might be of some relevance, it also contains a link to the previous SVG file: Issue with viewing SVG files.

Possibly for you more than one issue, or the same issue manifesting in two ways?

Could someone more familiar with the browser please help... :?:

file_example_SVG_30kB.svg.zip
(12.64 KiB) Downloaded 72 times

Re: SVG support on Linux

Posted: Wed Mar 24, 2021 8:22 pm
by teresaejunior
Your sample looks fine, but anything a bit more complex looks very bad. The solution would probably be finding a better library, or using something like the inkscape CLI to convert it internally to PNG: https://manpages.debian.org/buster/inks ... .1.en.html

Regarding the thumbnails, that is not the case, since SVG is just a XML file.

Re: SVG support on Linux

Posted: Wed Mar 24, 2021 8:35 pm
by cday
I wonder if the quality issue could possibly be specific to the XnView MP Linux version, are you able to test on Windows?

Otherwise, if you would like to continue the quality issue, a new thread specific to that might be the best way of attracting Pierre's attention... :wink:

Re: SVG support on Linux

Posted: Wed Mar 24, 2021 11:02 pm
by oops66
Hello to all, and Pierre.

For information, If your are into Linux you can recursively convert first the .svg to .png with a bash script (with inkscape installed) ... then open them into XnView.

Code: Select all

#!/bin/bash
mkdir "$PWD"/png
for file in $PWD/*.svg
    do
        filename=$(basename "$file")
        inkscape "$file" --export-type=png --export-filename="$PWD"/png/"${filename%}.png"
    done
exit 0

Re: SVG support on Linux

Posted: Wed Mar 24, 2021 11:50 pm
by teresaejunior
Yeah, I suggested something like that, but to be used internally by XnView, because I'm working with SVG files, and if I'm to convert them to PNG just to view them, I'd rather just open them with Inkscape (as I already do).

Re: SVG support on Linux

Posted: Wed Mar 24, 2021 11:53 pm
by oops66
teresaejunior wrote: Wed Mar 24, 2021 11:50 pm ... I'd rather just open them with Inkscape (as I already do).
That spends more time by this way to identify the right image..

Re: SVG support on Linux

Posted: Thu Mar 25, 2021 3:12 am
by teresaejunior
OK, I had a better look, and it turns out XnView quality for SVG is not that bad. The main problem I found is that it doesn't break lines in text fields, and the first file I tested happened to have text split into many lines, which XnView turned into one single line.

Leaving the line breaks issue aside for now, my main problem is that I couldn't get XnView to display any thumbnails (only a blank file is shown) or previews (nothing is shown) in the Browser. I can open SVG in "Normal" and "Fullscreen" modes just fine!