Martin Osieka

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

30 posts in this topic

 

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

Summary

Imports SVG files (and the compressed variant SVGZ) and renders them to Paint.NET bitmap layers.
This plugin does not require an external renderer like Inkscape.
The SVG specification is a living standard, do not expect that this plugin supports all features.
(Some do not make sense in an image editor like interactivity or animation elements).

Using the plugin you can open the downloaded files in any resolution you like w/o loss of quality.

Author

Martin Osieka

Download

Find the latest version of the plugin ImSVG.FileType v0.18 (23.3.2014) here.

Installation

Follow the instructions carefully

  • Copy the two files OptionBasedLibrary vX.X.dll/.dlc to the Paint.NET\ folder (NOT to Paint.NET\FileTypes\ !!!)
  • Copy the two files ImSVG.Open.FileType.dll/.dlc to the Paint.NET\FileTypes\ folder
  • Remove other plugins supporting the same file type (.svg) from Paint.NET\FileTypes\ folder (to avoid possible conflicts) I.e. 'SVGImport.dll' plugin.
  • Remove older ImSVG*.* files.
  • Do not remove older versions of the OptionBasedLibrary if they are required from other plugins.

To verify the installation you should restart Paint.NET and check that in the filetype popup of the open file selector dialog is an entry starting with SVG.

Compatibility

Paint.NET 3.5.11 and 4.0.5

Supported languages

The language used in the plugin depends on the language setting of Paint.NET and the support of this language by the plugin. The fallback is the first supported language of the plugin. Languages are defined in the .dlc files. This plugin supports the following languages in the moment:

  • English
  • Deutsch

Dialog options

ImSVG.Open.FileType.Dialog.jpg

 

  • Size settings given in SVG file (readonly)
    Some SVG files provide hints about the canvas to create by the application.
    • Viewport is the size to use on the canvas. Width and height may show a unit or a percentage.
    • Viewbox is the range of coordinates used in the SVG file. The viewbox will be stretched to the viewport respecting aspect ratio (or not).
  • Size selection by user
    • Resolution: The DPI value is used to setup the document and to calculate coordinates and lengths in the SVG file. If the viewport has values with units then changing the dpi value will change the canvas pixel size. This allows you to get a better quality of the rendered SVG graphic.
    • Canvas: The pixel size used for the document.
    • Keep Aspect Ratio: Keeps the ratio between canvas width and canvas height
  • Options
    • Background: Typically the background of an SVG file is transparent. This option allows you to select your own background. If the 'Layers' option is not set to 'flat' then the background will be placed in a seperate layer.
    • Layers: If this option is not set to 'flat' then a new layer will be generated for each top-level element in the svg file. If you created the file with Inkscape it will show you the inkscape layer structure.
      Be warned: Depending on the file the not 'flat' option will generate a lot of layers. This may slow down the application.
    • File folder: Paint.NET does not provide the file path to the plugin (just a data stream). If an SVG file uses relative references to other files (like bitmap images) then this option allows you to specify the SVG file folder.
  • File Infos (read only) (only visible if they are defined in the SVG file)
    • Title: The 'title' element of the svg file.
    • Description: The 'desc' element of the svg file.

Known issues

  • Paint.NET does not provide a load dialog template to filetype plugins. So to allow ImSVG to show a dialog it delegates its dialog (derived from PdnBaseForm) to the thread of the main window. This works fine but not perfect. So you will not get an error beep if you are clicking to the main window while the ImSVG dialog is open.
  • If you are cancelling the option dialog you will get an unspecified error. But this just means that Paint.NET has no idea about cancelling the open operation. Paint.NET 4.0 shows in the "Error details" that the user cancelled the action.
  • Paint.NET 3.5.11: If you try to 'Save' (not 'Save As') a loaded svg then Paint.NET will not fallback to 'Save As' automatically. The 'Save' dialog opens and shows an error. This is fixed in Paint.NET 4.0.

To Do list

  • Add support for filter element (Minimum Gaussean blur).
  • Improve text support (Font handling, text areas and text on path)
  • Better support for SpreadMethod attribute used for gradients.

Examples

Here are two examples of SVG files from Wikipedia.de 'Smiley'

http://upload.wikimedia.org/wikipedia/commons/d/d5/Face-angel.svg

http://upload.wikimedia.org/wikipedia/commons/7/70/Face-devil-grin.svg

Remark: For some reason the image tag of the thread editor does not allow the .svg extension.

Therefore here are the .png versions

48px-Face-angel.svg.png    48px-Face-devil-grin.svg.png

History

  • 0.18 (23.3.2014)
    - Dll name changed from ImSVG.FileType.dll to ImSVG.Open.FileType.dll
    - Changed the handling of the resolution and canvas options.
    - Updated to OptionBasedLibraray 0.6
  • 0.10 (15.10.2013)
    - Patches to support Paint.NET 4.0
  • 0.9 (14.10.2013)
    - First public release

 

3

Share this post


Link to post
Share on other sites

I have never used SVG files before but mostly because I don't know enough about them. Now I have some research to do :D Thank you :D

0

Share this post


Link to post
Share on other sites

I have never used SVG files before but mostly because I don't know enough about them. Now I have some research to do :D Thank you :D

 

This is just a small part of the path tools which may allow you (hopefully) to edit vectors in Paint.NET. We like to support you the artists :-)

1

Share this post


Link to post
Share on other sites

Update 0.18 (23.3.2014)
- Dll name changed from ImSVG.FileType.dll to ImSVG.Open.FileType.dll
- Changed the handling of the resolution and canvas options.
- Updated to OptionBasedLibraray 0.6
 

0

Share this post


Link to post
Share on other sites

Thanks for the notification of the change in DLL name. Flagged for Aprils revision of the Plugin Index.

0

Share this post


Link to post
Share on other sites

Sorry I am a newbie here & a bit lost. I followed your instructions & put things where you said to put them. I reopened Paint.net & can't find it anywhere.

0

Share this post


Link to post
Share on other sites

It's a file type plugin Traci.  That means it adds the ability to load (+ sometimes Save) new file formats. 

 

Once loaded, this plugin gives you the option to load an SVG file - you'll find this option listed in the Load File dialog.  There is a drop-down list in the dialog which contains all the file extensions you can load.  SVG should be among them if this plugin is installed correctly.

0

Share this post


Link to post
Share on other sites

Hi. I keep getting this error message when I try to open my .SVG file. Can you tell me whats wrong?

 

 

System.ArgumentOutOfRangeException: Specified argument was out of the range of valid values.

 
Parameter name: <defaultValueX>=112252 our of range [1 32767]
 
   at OptionControls.OptionTypeVectorEditBox`1..ctor(Enum optId, OptionContext optContext, TValue defaultValueX, TValue minValueX, TValue maxValueX, TValue defaultValueY, TValue minValueY, TValue maxValueY)
 
   at OptionControls.OptionInt32VectorEditBox..ctor(Enum optId, OptionContext optContext, Int32 defaultValueX, Int32 minValueX, Int32 maxValueX, Int32 defaultValueY, Int32 minValueY, Int32 maxValueY)
 
   at OptionBasedFileTypes.SvgFileType.OnLoad(Stream input)
 
   at PaintDotNet.FileType.Load(Stream input) in d:\src\pdn\paintdotnet\src\Data\FileType.cs:line 476
 
   at PaintDotNet.Functional.Func.Eval[T1,TRet](Func`2 f, T1 arg1) in d:\src\pdn\paintdotnet\src\Base\Functional\Func.cs:line 158

 

Thanks

0

Share this post


Link to post
Share on other sites

It looks like that basic dimensions of the svg are too larger to be handled with the plugin. Could you open the .svg file with a text editor and post the beginning with the <svg > xml tag?

0

Share this post


Link to post
Share on other sites

Hello,

I am getting the same error message as mentioned above and cannot open svg files. Thank you for any help.

painter84

0

Share this post


Link to post
Share on other sites

It looks like that basic dimensions of the svg are too larger to be handled with the plugin. Could you open the .svg file with a text editor and post the beginning with the <svg > xml tag?

 

Same request. No info => no chance to fix or provide better error messages.

0

Share this post


Link to post
Share on other sites

Do you mean this:

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->

<svg
   xmlns:dc="http://purl.org/dc/elements/1.1/"
   xmlns:cc="http://creativecommons.org/ns#"
   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
   xmlns:svg="http://www.w3.org/2000/svg"
   xmlns="http://www.w3.org/2000/svg"
   xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
   xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
   version="1.1"
   width="221.14319"
   height="45.950214"
   id="svg9957"
   inkscape:version="0.91 r13725"
   sodipodi:docname="tape-1.svg">

0

Share this post


Link to post
Share on other sites

This fragment (with a closing </svg>) loads fine for me (Paint.Net 4.0.5, ImSVG.Open.FileType v0.18).

Means the dialog which shows these values does not crash.

So if possible add the crashing .svg here (you have to zip it before) or provide a link.

0

Share this post


Link to post
Share on other sites

Zip up and attach the svg file here so the author can debug.

Just be sure it is family friendly, ok? ;)

0

Share this post


Link to post
Share on other sites

I'm getting the following error when I try to open an SVG file:

 

Because the error is just at the beginning of the file it maybe enough to open the .svg file with an text editor and copy paste the first lines here.

0

Share this post


Link to post
Share on other sites

The SVG plugin is for opening SVG files only, not saving them.

0

Share this post


Link to post
Share on other sites

The "Plugins - For Publishing Only" section is only for publishing plugins.

 

Moved this to Troubleshooting section.

0

Share this post


Link to post
Share on other sites

To keep the discussion of this plugin in one place I've merged the separate thread (previous three posts) into this one.

0

Share this post


Link to post
Share on other sites

I have the same error:

System.ArgumentOutOfRangeException: Specified argument was out of range of valid values.
Parameter name: <defaultValueX>=675455 our of range[1 32767]....

I don't know how to upload an SVG file to this forum but here is the picture:

 

data:image/svg+xml;base64,PHN2ZyB2aWV3Qm94PSIwIDAgMTU1IDE1NSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48dGl0bGU+SW1wb3J0ZWQgTGF5ZXJzPC90aXRsZT48cGF0aCBkPSJNODkuNDYgMmw4LjEyNyAxMy42NzcgMTQuNjE4LTYuMjg3IDMuNTA1IDE1LjUyIDE1Ljg0Mi0xLjQ2Mi0xLjQ2MiAxNS44NDMgMTUuNTIgMy41MDctNi4yODcgMTQuNjE1TDE1MyA2NS41NDIgMTQyLjUwNSA3Ny41IDE1MyA4OS40NTdsLTEzLjY3NyA4LjEzIDYuMjg3IDE0LjYxNS0xNS41MiAzLjUwNiAxLjQ2MiAxNS44NDItMTUuODQyLTEuNDYzLTMuNTA1IDE1LjUyLTE0LjYxOC02LjI4N0w4OS40NiAxNTMgNzcuNSAxNDIuNTA1IDY1LjU0IDE1M2wtOC4xMjctMTMuNjc3LTE0LjYxOCA2LjI4Ny0zLjUwNS0xNS41Mi0xNS44NDMgMS40NjIgMS40NjMtMTUuODQzLTE1LjUyLTMuNTA3IDYuMjg1LTE0LjYxNUwyIDg5LjQ1OGwxMC40OTQtMTEuOTZMMiA2NS41NDNsMTMuNjc1LTguMTNMOS4zOSA0Mi43OTdsMTUuNTItMy41MDYtMS40NjMtMTUuODQyIDE1Ljg0MyAxLjQ2TDQyLjc5NSA5LjM5bDE0LjYxOCA2LjI4N0w2NS41NCAyIDc3LjUgMTIuNDk1IDg5LjQ2IDJ6IiBzdHJva2U9IiM4MTVGODYiIHN0cm9rZS13aWR0aD0iMiIgZmlsbD0ibm9uZSIgZmlsbC1ydWxlPSJldmVub2RkIi8+PC9zdmc+

0

Share this post


Link to post
Share on other sites

I'm trying to open SVG files from examples (first post of this thread) with paint.net 4.0.5 and ImSVG.Open.FileType 0.18.00 (everything is installed correctly and PDF filetype plugin from Martin Osieka works great). I'm getting this error:

System.FormatException: Input string was not in a correct format.
   at System.Number.ParseSingle(String value, NumberStyles options, NumberFormatInfo numfmt)
   at ControlExtensions.ImSvg.Meal.EatNumber(Single& number)
   at ControlExtensions.ImSvg.AttributeOpacityInheritE(XmlNode elementNode, List`1 ancestors, String attributeName, Single defaultValue)
   at ControlExtensions.ImSvg.ElementNode(Graphics g, XmlNode elementNode, Int32 depth)
   at ControlExtensions.ImSvg.ElementG(Graphics g, XmlNode elementNode, Int32 depth)
   at ControlExtensions.ImSvg.ElementNode(Graphics g, XmlNode elementNode, Int32 depth)
   at ControlExtensions.ImSvg.ElementSvg(Graphics g, XmlNode svgElementNode, Int32 depth)
   at OptionBasedFileTypes.SvgFileType.OnLoad(Stream input)
   at PaintDotNet.FileType.Load(Stream input) in d:\src\pdn\paintdotnet\src\Data\FileType.cs:line 477
   at PaintDotNet.Functional.Func.Eval[T1,TRet](Func`2 f, T1 arg1) in d:\src\pdn\paintdotnet\src\Base\Functional\Func.cs:line 158

Please help!

0

Share this post


Link to post
Share on other sites

I'm trying to open SVG files from examples (first post of this thread) with paint.net 4.0.5 and ImSVG.Open.FileType 0.18.00 (everything is installed correctly and PDF filetype plugin from Martin Osieka works great). I'm getting this error:

1) Update to the most recent version of paint.net

2) Ensure you have downloaded the .svg file correctly, and your browser hasn't injected rubbish into the file. ie: open the file in a text editor to ensure it's valid svg markup.

0

Share this post


Link to post
Share on other sites

I just tried the plugin with a quite large (2.35 MB) SVG file output by Inkscape, and it worked great. Now that I understand better how to convert raster images to vector images with Inkscape, this may prove to be quite useful.

0

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now