Home Upgrade Search Memberlist Extras Hacker Tools Award Goals Help Wiki Contact

C# 

SVG 2 PNG Converter

Hi there.

A day I got an (SVG)iconpack I needed them in PNG ImageFormat but I searched a lot on internet to find a something to convert them but I got to ways, one online converters and IE Explorer so that I tried to create a tool to doing such a thing.

As I said it earlier there two are ways maybe more but what if you have a 200 images in SVG format and try to convert , it's really hard to upload them online or opening them in IE then save.

The tool supports multiple number of svg files to convert.

Credits :

SVG Library

Source :

Spoiler (Click to View)
[Image: narwinsig.gif]
Nice thanks for this converter if you have time you should make a few different modules like svg to jpg or png to jpg and that stuff.
(Jun 28, 2017 05:18 PM)CanadianBacon Wrote:  Nice thanks for this converter if you have time you should make a few different modules like svg to jpg or png to jpg and that stuff.

it converts SVG to
  • Bmp

  • Gif

  • Jpeg

  • Png

  • Tiff

  • Icon



for the other suggestion I may if I got enough time.
[Image: narwinsig.gif]
I used an app that adds himself to the context menu of Windows Explorer when clicking on SVG files to convert them and even resize them.

http://www.bricelam.net/ImageResizer/
This an Adobe Illustrator script to convert .AI & .SVG to .PNG  ✌
I used this script to convert 3400 .SVG to .PNG in a single go.
Save it as ExportDocsAsPNG24.jsx & use *.ai or *.svg to specify file type.



Code
var destFolder, sourceFolder, files, fileType, sourceDoc, targetFile, pngExportOpts;
sourceFolder = Folder.selectDialog( 'Select the folder with Illustrator files you want to convert to PNG', '~' );
if ( sourceFolder != null )

{

files = new Array();
fileType = prompt( 'Select type of Illustrator files to you want to process. Eg: *.ai', ' ' );
files = sourceFolder.getFiles( fileType );
if ( files.length > 0 )

{
destFolder = Folder.selectDialog( 'Select the folder where you want to save the converted PNG files.', '~' );
for ( i = 0; i < files.length; i++ )
{
sourceDoc = app.open(files[i]);
targetFile = getNewName();
pngExportOpts = getPNGOptions();
sourceDoc.exportFile( targetFile, ExportType.PNG24, pngExportOpts );
sourceDoc.close(SaveOptions.DONOTSAVECHANGES);

}
alert( 'Files are saved as PNG in ' + destFolder );
}

else
{
alert( 'No matching files found' );
}

}

function getNewName()
{
var ext, docName, newName, saveInFile, docName;
docName = sourceDoc.name;
ext = '.png';
newName = "";
for ( var i = 0 ; docName[i] != "." ; i++ )
{
newName += docName[i];
}
newName += ext; // full png name of the file
saveInFile = new File( destFolder + '/' + newName );
return saveInFile;

}

function getPNGOptions()

{
var pngExportOpts = new ExportOptionsPNG24();
pngExportOpts.antiAliasing = true;
pngExportOpts.artBoardClipping = false;
pngExportOpts.saveAsHTML = false;
pngExportOpts.transparency = true;
return pngExportOpts;
}


Possibly Related Threads...
Thread / Author Replies Views Last Post
[C#] by going clearJan 18, 2021 06:29 AM 2 167 Jan 18, 2021 06:29 AM
Last Post: Narwin
[C#] by Anon ScripterFeb 3, 2019 06:02 PM 10 325 Feb 3, 2019 06:02 PM
Last Post: gigajew
[Python] by CryptOLMay 9, 2018 03:03 PM 4 106 May 9, 2018 03:03 PM
Last Post: CryptOL