SVG support via rsvg-convert.exe

Ideas for improvements and requests for new features in XnView Classic

Moderators: XnTriq, xnview

Post Reply
captaincavern
Posts: 37
Joined: Fri Dec 13, 2013 6:31 am

SVG support via rsvg-convert.exe

Post by captaincavern » Thu Jun 04, 2015 10:27 am

As , besides being shareware, the CADImage plugin is quite bad at decoding SVG properly if at all (those I make anyway) I would suggest supporting SVG, in the vein of BPG support via bpgdec.exe, with rsvg-convert.exe instead. It's fast, decode everything I throw at it correctly and is is available compiled for win32 with recent source here:

https://sourceforge.net/projects/tumagc ... z/download

Command line is: input.svg -o output.png

If having a console flashing at each new file is a concern, then I guess that simply changing the subsystem flag in the PE header from console to GUI would eliminate this issue. I did that with the bundled bpgdec.exe and I don't have consoles flashing anymore when viewing bpg files in XnView.

Thanks.

User avatar
oops66
XnThusiast
Posts: 1999
Joined: Tue Jul 17, 2007 1:17 am
Location: France

Re: SVG support via rsvg-convert.exe

Post by oops66 » Thu Jun 04, 2015 10:39 am

captaincavern wrote:... the CADImage plugin is quite bad at decoding SVG properly ...
+1
XnViewMP 0.82 Linux X64 - Ubuntu 16.04 LTS - X64

User avatar
omniplex
Posts: 127
Joined: Thu Feb 10, 2011 1:52 pm
Location: Hamburg
Contact:

Re: SVG support via rsvg-convert.exe

Post by omniplex » Fri Jun 05, 2015 10:54 pm

That's a nice tool, I often used it to convert odd SVGs (identified as invalid by the W3C validator) to good enough valid SVGs for the purposes of Wikimedia commons. For some background info see enwiki.

But I don't get why you want to start a conversion from SVG to PNG within XnView. :?

User avatar
omniplex
Posts: 127
Joined: Thu Feb 10, 2011 1:52 pm
Location: Hamburg
Contact:

Re: SVG support via rsvg-convert.exe

Post by omniplex » Mon Jan 11, 2016 8:28 pm

captaincavern wrote:If having a console flashing at each new file is a concern, then I guess that simply changing the subsystem flag in the PE header from console to GUI would eliminate this issue. I did that with the bundled bpgdec.exe and I don't have consoles flashing anymore when viewing bpg files in XnView.

Thanks.
Bump, great idea, the BPGdec.exe console window open/close is slightly annoying in folders with many BPG images. And of course librsvg-convert.exe is still good (2.40.9, I haven't tested the new 2.40.12 yet.)

Back to BPG: XnView 2.34 still had BPG 0.9.5. The newest version as of today is 0.9.6, just copying BPGdec.exe + libjpg-62.dll + libpng16-16.dll + zlib1.dll to the XnView/plugins folder is enough to "install" it as far as XnView is concerned. The old libpng15-15.dll can go to the bin. JFTR, both libpng used by BPG are obsolete, and so far I failed to create a BPG with an "RGB is GBR" colour profile from a PNG with this feature. Presumably it was no XnView issue, BPGview.exe also didn't display the expected colours.

About the stupid byte wanting to be fixed to get rid of the console window open/close: Some obscure tool known as editbin.exe can do this, and after about an hour with even more obscure downloads I managed to locate it in C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin. Where it still failed, because it's just a wrapper for some link.exe, but not the Open Watcom idea of link.exe :idea: After running vcvars32 in the VC/bin folder editbin.exe in the same folder was finally ready for action:

Code: Select all

editbin /SUBSYSTEM:Windows "c:\Program Files (x86)\XnView\PlugIns\bpgdec.exe"
A comparison with the original 0.9.6 bpgdec.exe reported two modified bytes: At offset D8 old B4 new B3, at offset DC old 03 new 02. At least the latter matches what stackoverflow predicted. Test with XnView 2.35: WFM. :D

captaincavern
Posts: 37
Joined: Fri Dec 13, 2013 6:31 am

Re: SVG support via rsvg-convert.exe

Post by captaincavern » Thu Jan 14, 2016 12:37 pm

Sorry, I should have mentioned there is an easy to use GUI tool to change the subsystem flag in executable headers. That's NW PE Builder: http://www.woodmann.com/collaborative/t ... PE_Builder. The subsystem value needs to be changed from 3 to 2.

It's nice you've discovered another way however.

captaincavern
Posts: 37
Joined: Fri Dec 13, 2013 6:31 am

Re: SVG support via rsvg-convert.exe

Post by captaincavern » Thu Jan 14, 2016 12:45 pm

omniplex wrote:But I don't get why you want to start a conversion from SVG to PNG within XnView. :?
Well this tool only ouputs png data if I am not mistaken so I thought XnView could direct it to render a png to a temp folder and then read the png from there but perhaps it can output to stdout (not sure) which would avoid writing a temp file to disk.

Anyway it doesn't seem there is any interest in implementing that either way. ;).

User avatar
omniplex
Posts: 127
Joined: Thu Feb 10, 2011 1:52 pm
Location: Hamburg
Contact:

Re: SVG support via rsvg-convert.exe

Post by omniplex » Sat Apr 02, 2016 5:56 am

captaincavern wrote:it doesn't seem there is any interest in implementing that either way. ;).
New version (not yet tested) 2.40.13.

But BPG is still at 0.9.6, with an allegedly obsolete libpng, and no known example with an ICC color profile working for me. FFMpeg 3.0 still doesn't support BPG at all, now I wonder if it's still alive. :?:

captaincavern
Posts: 37
Joined: Fri Dec 13, 2013 6:31 am

Re: SVG support via rsvg-convert.exe

Post by captaincavern » Wed Apr 13, 2016 7:15 am

All here for example: http://ftp5.gwdg.de/pub/opensuse/reposi ... 12/noarch/

Fetch the librsvg packages (and the many packages it depends on).

captaincavern
Posts: 37
Joined: Fri Dec 13, 2013 6:31 am

Re: SVG support via rsvg-convert.exe

Post by captaincavern » Mon May 02, 2016 9:56 pm

captaincavern wrote:Anyway it doesn't seem there is any interest in implementing that either way. ;).
Looks like I was too pessimistic. :wink:

Thanks Pierre for adding this to new XnView build. :D

Hanswurst
Posts: 5
Joined: Sun Jun 19, 2016 7:29 pm

Re: SVG support via rsvg-convert.exe

Post by Hanswurst » Sun Jun 19, 2016 7:38 pm

Hi!
Once again for the dummies please...
I put the rsvg-convert.exe into the XnView Plugins folder and what do I have to do now?
XnView didn't recoginize it (it's not a dll...), but it needs to be connected somehow to automatically convert the svgs.
Thanks,
Hanswurst

User avatar
xnview
Author of XnView
Posts: 30094
Joined: Mon Oct 13, 2003 7:31 am
Location: France
Contact:

Re: SVG support via rsvg-convert.exe

Post by xnview » Mon Jun 20, 2016 8:14 am

Hanswurst wrote:Hi!
Once again for the dummies please...
I put the rsvg-convert.exe into the XnView Plugins folder and what do I have to do now?
XnView didn't recoginize it (it's not a dll...), but it needs to be connected somehow to automatically convert the svgs.
XnView recognizes it automatically. Could you send me a svg that you are trying to load?
Pierre.

Hanswurst
Posts: 5
Joined: Sun Jun 19, 2016 7:29 pm

Re: SVG support via rsvg-convert.exe

Post by Hanswurst » Mon Jun 20, 2016 8:39 am

It happened with any svg.

But now it works: Tools --> Options --> General --> Display all image file types, Program restart
Strange option... should be active by default? Nevermind.
It still does not appear in the plugins or addons list.

Yes, a command prompt flashes for a fraction of a second but that's just a cosmetic point and I'm happy the way it works now!
thanks :D

Post Reply