Jump to content

'Scalable Vector Graphics' FileType Alternative Plugin (.SVG, .SVGZ)


otuncelli
 Share

Recommended Posts

This is a Paint.NET filetype plugin for loading SVG (Scalable Vector Graphics) and its compressed variant SVGZ files. SVG elements can be rendered as a flat image file or each on a separate layer.

 

The plugin is a tiny wrapper around the SVG.NET Library which does the actual SVG reading.

 

Tested on Paint.NET 4.2.16 & 4.3 Beta Build 7929.

Download links

Here are the download links for latest release:

Installer Manual Installation
SvgFileTypePlugin_setup.exe (399 KiB) SvgFileTypePlugin.zip (274 KiB)

How to install

🔴 Note: Before install make sure you don't have any other file type plugin installed handling the same file types as this plugin.

To auto install (recommended) the plugin perform the following steps:

  • Download and run SvgFileTypePlugin_setup.exe
  • Follow the steps of the setup wizard.

To manually install the plugin perform the following steps:

  • Download and extract SvgFileTypePlugin.zip
  • If you're using Paint.NET 4.3 or later:
    • If you're using Classic version of Paint.NET:
      • Create a new folder named SvgFileTypePlugin in the <Paint.NET>\FileTypes directory (default location is C:\Program Files\paint.net\FileTypes).
    • If you're using Microsoft Store version of Paint.NET:
      • Create a new folder named SvgFileTypePlugin in the <Documents>\paint.net App Files\FileTypes directory.
    • Put the extracted files in this newly created folder.
  • If you're using Paint.NET 4.2:
    • If you're using Classic version of Paint.NET:
      • Put the extracted files in the <Paint.NET>\FileTypes directory (default location is C:\Program Files\paint.net\FileTypes).
    • If you're using Microsoft Store version of Paint.NET:
      • Put the extracted files in the <Documents>\paint.net App Files\FileTypes directory.
  • Restart Paint.NET.

 

Changelog and older versions can be found here.

 

Source Code on GitHub

Edited by otuncelli
update links to always show the latest release
  • Like 2
  • Upvote 2
Link to comment
Share on other sites

Updated to v1.01.

 

Changelog:

  • Fixed some bugs that leading crash.
  • Some GUI changes.
  • Viewport x, y values were not displaying correctly.
  • Fixed duplicate import of groups when using Group import mode.
  • Auto-generated layer names are now more meaningful.
  • Added a memory warning message when importing many layers.
  • Case-insensitive comparison of values for visibility attributes (visibility & display) for svg elements.
Edited by otuncelli
fixed a typo
  • Like 1
  • Upvote 2
Link to comment
Share on other sites

  • 4 weeks later...
Quote

To install the plugin perform the following steps:

  • Put the DLL in the <Paint.NET>\FileTypes directory (default location is C:\Program Files\paint.net\FileTypes)
  • For the Windows Store version of Paint.NET, put the DLL in the <Documents>\paint.net App Files\FileTypes directory
  • Restart Paint.NET if you have it open


I have installed the plugin as described above.

But the Scalable Vector Graphics ( SVG, SVGZ )  file types are not showing up in the file type drop down menu of the ''Save As'' dialogue box.
Please let me know how to resolve the situation.

Link to comment
Share on other sites

24 minutes ago, Juggernaut- said:

But the Scalable Vector Graphics ( SVG, SVGZ )  file types are not showing up in the file type drop down menu of the ''Save As'' dialogue box.

 

The plugin only supports loading SVG files, it does not support saving them.

PdnSig.png

Plugin Pack | PSFilterPdn | Content Aware Fill | G'MICPaint Shop Pro Filetype | RAW Filetype | WebP Filetype

The small increase in performance you get coding in C++ over C# is hardly enough to offset the headache of coding in the C++ language. ~BoltBait

 

Link to comment
Share on other sites

2 hours ago, Juggernaut- said:

But the curves and lines created on different layers of Paint .NET will become non editable when saved / converted to PNG ? 

 

Yes, that's exactly right... because Paint.NET is a raster image editor and not a vector image editor.

 

If you want to save a vector image in a vector format, you should use a vector editor, like InkScape.

Click to play:
j.pngs.pngd.pnga.pngp.png
Download: BoltBait's Plugin Pack | CodeLab | and how about a Computer Dominos Game

Link to comment
Share on other sites

  • 1 month later...

Application paint.net 4.3 (α 4.300.7879.42543)

Quote

C:\Program Files\paint.net\FileTypes\SvgFileType.dll, версии 1.0.0.0

Тип: System.Web.IHttpAsyncHandler
System.TypeLoadException: Could not load type 'System.Web.IHttpAsyncHandler' from assembly 'System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'.

Before that, there was a smaller plugin of the same version (598 KB = 612864), but the update did not help.

+

Spoiler

report

answer


 

Edited by AlexDolmatov
Add link
Link to comment
Share on other sites

@otuncelli

Unable to load in beta 4.3.7881

 

C:\Program Files\paint.net\FileTypes\SvgFileType.dll, version 1.0.3.0

System.IO.FileNotFoundException: Could not load file or assembly 'Svg, Version=3.2.0.0, Culture=neutral, PublicKeyToken=12a0bac221edeae2'. The system cannot find the file specified.
File name: 'Svg, Version=3.2.0.0, Culture=neutral, PublicKeyToken=12a0bac221edeae2'

 

I checked 3 times to ensure everything was placed correctly. 
 

 

  • Thanks 1

Signature2018.png

 

Link to comment
Share on other sites

@otuncelli

File loads into Paint without error

However it does not open my test svg file

 

Exception:

System.TypeLoadException: Could not load type 'System.Windows.Forms.ContextMenu' from assembly 'System.Windows.Forms, Version=5.0.8.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.
   at System.Windows.Forms.Control.MarshaledInvoke(Control caller, Delegate method, Object[] args, Boolean synchronous)
   at System.Windows.Forms.Control.Invoke(Delegate method, Object[] args)
   at System.Windows.Forms.Control.Invoke(Delegate method)
   at OptionBasedFileTypes.SvgFileType.OnLoad(Stream input)
   at PaintDotNet.FileType.Load(Stream input) in D:\src\pdn\src\Data\FileType.cs:line 501
   at PaintDotNet.Functional.Func.Eval[T1,TRet](Func`2 f, T1 arg1) in D:\src\pdn\src\Base\Functional\Func.cs:line 158

 

Back to the drawing board :)


 

Signature2018.png

 

Link to comment
Share on other sites

Posted (edited)
58 minutes ago, AndrewDavid said:

@otuncelli

File loads into Paint without error

However it does not open my test svg file

 

Exception:

System.TypeLoadException: Could not load type 'System.Windows.Forms.ContextMenu' from assembly 'System.Windows.Forms, Version=5.0.8.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.
   at System.Windows.Forms.Control.MarshaledInvoke(Control caller, Delegate method, Object[] args, Boolean synchronous)
   at System.Windows.Forms.Control.Invoke(Delegate method, Object[] args)
   at System.Windows.Forms.Control.Invoke(Delegate method)
   at OptionBasedFileTypes.SvgFileType.OnLoad(Stream input)
   at PaintDotNet.FileType.Load(Stream input) in D:\src\pdn\src\Data\FileType.cs:line 501
   at PaintDotNet.Functional.Func.Eval[T1,TRet](Func`2 f, T1 arg1) in D:\src\pdn\src\Base\Functional\Func.cs:line 158

 

Back to the drawing board :)


 

 

You're using the other SVG import plugin. I'm getting the same error message when i try to use the other one. Seems like it hasn't been updated for a long time so i would expect it to fail on .NET 5.

 

This one doesn't use OptionBasedLibrary and it's only a single file.

Edited by otuncelli
  • Upvote 1
Link to comment
Share on other sites

  • 2 weeks later...

This is the SVG file I am importing:

image.png.0e8dcbd72ba0a7c34ff102ac7eb69576.png (2nd path is cropped out because it is long)

Should the dialog box say 

n/a, 0, n/a

for Size settings while importing this file?

image.png.7dd5862105b835769573b7c31b99b2b7.png

It is reading successfully, but I cannot edit any Viewport and ViewBox settings, and changing Canvas beyond 500 only adds transparent pixels to the side and bottom and I cannot resize the actual rendering.

I don't have the other old SVG filetype plugin installed.

 

There isn't any information on how this plugin is supposed to work, so I don't know if this is abnormal or not.

Edited by ThreadSnake
added clarification in one sentence
Link to comment
Share on other sites

Posted (edited)

Hi @ThreadSnake

 

This could be related to an issue with SVG.NET library internally used by the plugin which does the actual SVG reading.

 

Issue is here: https://github.com/svg-net/SVG/issues/837

 

I'll check this again more thoroughly. If it's something I can fix, I'll update the plugin. Viewbox and Viewport fields are just informational fields. You can't edit them.

 

Thanks for reporting.

 

As a workaround, adding "viewBox" attribute to svg definition seems to fix the problem.

 

<svg xmlns="http://www.w3.org/2000/svg" width="500" height="500" viewBox="0 0 500 500">

 

Edited by otuncelli
  • Thanks 1
Link to comment
Share on other sites

Updated to v1.04.

 

Changelog:

  • Fixed a size detection problem.
  • Added support for rendering use element when importing with layers (experimental)
  • Fixed a crash when clicking the GitHub link on Paint.NET 4.3+
  • License changed to LGPL
Edited by otuncelli
  • Like 1
  • Upvote 1
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...