Skip to content

A Pro Motion NG plug-in to neatly convert images to SVG, without loosing the Pixel Art look and feel.

License

Notifications You must be signed in to change notification settings

cosmigo/pmotion2svg

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

pmotion2svg

license MIT 00b5da  release 1.1  pmotion2svg  PureBasic 5  Pro%20Motion%20NG 7.2

Blinky

A Pro Motion NG plug-in to neatly convert images to SVG, without loosing the Pixel Art look and feel.

Created in PureBasic by Tristano Ajmone, released under MIT License.



About

This plug-in will extend Pro Motion NG’s functionality to support exporting images to the SVG format in a manner that preserves their Pixel Art look and feel.

Features

At export time, the user is presented with and options dialog where he/she can choose:

  • Scale Factor — how many SVG pixels will be used to represent each original pixel when drawing it as a filled square.

  • Padding — the amount of SVG pixels used as padding around the generated image.

  • Draw Pixels Grid — if checked, the generated image will display a 1px grid (black) between the original pixels and around the image.

  • Preserve Transparency — if an indexed image has a transparency color defined, you can choose whether to preserve its transparency or paint its original color as an SVG rectangle representing the image background.

SVG Optimization

When converting Pixel Art to SVG, pmotion2svg will draw consecutive pixels of the same color as a single rectangle, thus reducing the size of the generated SVG. Furthermore, it will generate the SVG by scanning the raster image both horizontally and vertically, and will then use the version which takes less memory. This optimization technique was borrowed from Eric Meyer’s px2svg tool.

Nonetheless, you’re strongly advised to further optimize the generated SVG images with a dedicated optimizer like SVGO:

  • SVGO — command-line SVG Optimizer (Node.js).

  • SVGOMG — SVGO web interface (no installation required).

Processing the SVG images generated with this plugin with an SVGO-based optimizer can reduce considerably their size (usually, a size gain between 40% and 80%).

💡

The pmotion2svg options dialog contains a menu with links to these SVG optimizers, so you can easily access the SVGOMG online tool to optimize your generated SVGs directly in your browser.

Installing

Download the latest precompiled binary package from the releases page, unpack its contents and copy the pmotion2svg.dll file to the plugins/ folder of Pro Motion’s installation folder.

Depending on your Windows OS bitness, the plugins directory path will be located either at:

Windows 64-bit →

%PROGRAMFILES(X86)%\cosmigo\Pro Motion NG\plugins\

Windows 32-bit →

%PROGRAMFILES%\cosmigo\Pro Motion NG\plugins\

Future editions of Pro Motion NG might change the location of the plugins/ folder to the User’s AppData/ directory tree — a feature which has been planned for quite a while. In that case, just copy the plug-in DLL to the new plugins/ folder path, as indicated in the Using Plugins section of Pro Motion NG’s Documentation.

System Requirements

This plug-in was tested under Windows 10 x64 using Pro Motion NG version 7.2.7, but should work also with older versions of Pro Motion that support plug-ins via the File I/O interface.

If you need support for using this plug-in with older version of Pro Motion, please ask for help on the Cosmigo Forum.

If you need to report a pmotion2svg bug or propose a new feature, just open an Issue.

License

MIT License

Copyright (c) 2021 Tristano Ajmone

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.