Jump to content

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


Recommended Posts

Moderators Note:

There is an alternative plugin available by @otuncelli that supports Layers.

https://forums.getpaint.net/topic/117086-scalable-vector-graphics-filetype-alternative-plugin-svg-svgz/

 

 

 

 

 

'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 >>ImSVG.FileType v0.18 (23.3.2014)

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

http://www.comsquare.ch/files/downloads/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

http://upload.wikimedia.org/wikipedia/commons/thumb/d/d5/Face-angel.svg/48px-Face-angel.svg.png    http://upload.wikimedia.org/wikipedia/commons/thumb/7/70/Face-devil-grin.svg/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

 

Edited by toe_head2001
Updated moderator note
  • Like 1
  • Upvote 3
Link to post
Share on other sites
  • 5 months later...

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

Link to post
Share on other sites
  • 2 weeks later...

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.

Link to post
Share on other sites
  • 11 months later...

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

Link to post
Share on other sites
  • 2 months later...

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.

midora%20signature.gif
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">

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.

midora%20signature.gif
Link to post
Share on other sites
  • 1 month later...
  • 5 months later...

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

Link to post
Share on other sites
  • 1 month later...

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+

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!

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.

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.

Link to post
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.

×
×
  • Create New...