Visio Guy

Visio Discussions => Shapes & Templates => Topic started by: Dmitry on February 09, 2009, 01:38:54 PM

Title: Batch Converter (PNG to VSS)
Post by: Dmitry on February 09, 2009, 01:38:54 PM
Hi,
I'm looking for batch conversion utility to create single vss file from many graphics files (e.g png). Has anyone can recommend such software?
Thanx.
Title: Re: Batch Converter (PNG to VSS)
Post by: Dmitry on February 11, 2009, 05:54:33 PM
Haven't found anything, so ... have done it - if anyone is interested, download the attached file and feel free to use.
You'll be able:
- convert hundreds of graphics files into single Visio stencil file;
- create connection points (as many as you want).
Unzip & install, note it requires Visio 2003 or 2007 and NET Framework 3.5.
Title: Re: Batch Converter (PNG to VSS)
Post by: Dmitry on February 18, 2009, 07:46:13 AM
After reading this: Create Clean & Tidy Visio Shapes Using Images With Transparent Backgrounds (http://www.visguy.com/2009/02/17/clean-and-tidy-shapes-with-png-images/), I've made improved version, now with automatic cropping and making transparent backgrounds. Still the same requirements.
Title: Re: Batch Converter (PNG to VSS)
Post by: Visio Guy on February 18, 2009, 09:27:17 AM
Wow, thanks Dmitry, very impressive!
Title: Re: Batch Converter (PNG to VSS)
Post by: Dmitry on March 04, 2009, 05:48:34 PM
Even better one, with improvements: more connection points, better transparency etc...
Title: Re: Batch Converter (PNG to VSS)
Post by: y0gurt on July 02, 2009, 09:16:32 AM
OK Dmitry, This Rocks! Thanks!
Title: Re: Batch Converter (PNG to VSS)
Post by: nikos_ps on July 25, 2010, 02:47:28 AM
Dimitri you rock!!!!!!

thanks very much for the app...  :)
Title: Re: Batch Converter (PNG to VSS)
Post by: JuneTheSecond on July 26, 2010, 02:15:12 AM
Cool and wonderful!
I was wasting time with various tools to remove background!
Now it is almost automatic!
Thank you, Dimitri!
Title: Re: Batch Converter (PNG to VSS)
Post by: ged325 on November 18, 2010, 11:37:32 AM
Any chance of this being done the other way as well?  Need to go from VSS to PNG.
Title: Re: Batch Converter (PNG to VSS)
Post by: Paul Herber on November 18, 2010, 04:37:31 PM
This can be done quite easily in VBA.

Code: [Select]
with empty page
for each shape in stencil {
  drop shape on page
  select all
  save as <shape.name>.png
  delete shape
}
Title: Re: Batch Converter (PNG to VSS)
Post by: ged325 on November 18, 2010, 10:43:11 PM
After some research I ended up using the interop in .Net, thanks for the reply.
Title: Re: Batch Converter (PNG to VSS)
Post by: Dmitry on August 12, 2011, 07:58:56 PM
If someone still uses it: here is the new version with improved transparency: http://dmitry-ivanov.tumblr.com/post/8844246276/batch-converter-for-visio (http://dmitry-ivanov.tumblr.com/post/8844246276/batch-converter-for-visio).
Please, let me know if it works well with Visio 2010.
Title: Re: Batch Converter (PNG to VSS)
Post by: Dmitry on August 30, 2011, 10:13:12 AM
It's been moved to my blog: http://dmitryivanov.net (http://dmitryivanov.net).
Title: Re: Batch Converter (PNG to VSS)
Post by: sunflower on December 13, 2011, 05:34:44 AM
Hi,

Is there any means by which we can convert the imgaes to vdx file ????? i.e an *.jpg file to *.vdx file where we can have all the processes that are there in image mapped to vdx.

Title: Re: Batch Converter (PNG to VSS)
Post by: aledlund on December 13, 2011, 10:03:55 AM
once your stencil has been made (.vss), save as .VSX (which is the xml version of a stencil).
al
Title: Dimitry! Are you still here?
Post by: markem on October 28, 2018, 12:04:07 AM
Hey! I hope you read this. I have been using your PNG2VSS program for a while. It is utterly fantastic. My problem is - I have thousands of files to load in to VSS files. So your program helps - but I need to be able to run it at the command level. I.E.: c:>png2vss <Directory to convert>.

Is this possible? Hopefully you will see and respond to this post.  Thanks if you do in advance!

By the way - if you have the source code still and do not want to work on this - let me have the source code and I'll work on it myself and give you back the code. :-)
Title: Re: Batch Converter (PNG to VSS)
Post by: Dmitry on October 28, 2018, 05:10:42 AM
What you're asking for is already implemented. Look into manual, section 3.8.
The latest version is 5.4:
https://drive.google.com/file/d/1tR34z64zveZLo_nPxhL9wbdLJSiPPcmO/view?usp=sharing (https://drive.google.com/file/d/1tR34z64zveZLo_nPxhL9wbdLJSiPPcmO/view?usp=sharing)
Title: Re: Batch Converter (PNG to VSS)
Post by: markem on October 29, 2018, 10:04:41 AM
First - a BIG THANK YOU to Dimitry! :-)

I had version 5.0 - this is version 5.4. Thanks again!

Now my findings:

There are problems with png2vss. These are not major problems or anything like that - more of a "Gotcha!" kind of problems with it. I'm posting these here to maybe help someone else who comes along after I am gone.

1. Directory structure. Under Windows 98se - Microsoft switched how a pathname could be separated. It used to be it had to be a backslash (\). Starting under Windows 98se Microsoft made it so you could use the blackslash or a forwards slash (/). I was trying to write a batch script and tying "/" is a lot easier than "\". Further, I was using PHP to write the script. So since PHP thinks a "\" means the next character is escaped (like a new line is "\n") - it stands to reason to use the "/". Anyway, IF YOU USE IT then png2vss will not work correctly. For some reason VB seems to think it is some kind of shortcut to some other location. In my case it sent the output to "C:/Windows/System32" directory. To be truthful - I have no idea why it really does this but it has to be something in VB.

2. There are two options "/F" and "/O". "/F" is for the files to read and insert into the library you are creating and "/O" is for the output. The output one has more problems. If you just run the program and then click to set the output file - the program will - if you leave it off - add a ".vss" to the name of the file. Batch life is different. Batch life YOU have to put the ".vss" onto the file. Otherwise - you wind up with an unknown file type. This isn't a biggie - just remember to always put the ".vss" onto the output file name and you will be ok.

3. The "/S" option. This option tells png2vss to run automatically. I would have thought it always would - but then that's just me. Now - here is the problem though. The program will not automatically close once it is through. You see - there is a check box for that. So BEFORE you start a batch job - bring up png2vss and check the "Close When Done" checkbox.

4. Batch files don't really work. What I mean is - I have about 2,000 image files that I wrote a PHP script to break up into chunks of 36 images each. (Yeah - lot of files there!) This program wrote out a batch script called t.bat. Imagine my surprise when I run t.bat and it runs the first command, finishes, and then .....dies. Yes. Kicked it right out of the batch script. So I'm like "Ok - I'll try it again". Dies. Take out that first command and run it again. Dies. I am not certain why it does this - it just does. My solution was to instead issue a separate SYSTEM command in PHP and send the command to it. It then dies, returns to the PHP script, which then continues to the next file. Again - no idea why it does this. Probably something to do with VB doing some kind of clearing of everything when it exits.

5. More options. Yes! Lots more options would be great! Here is a partial list:

5.1 "/C". Close When Done
5.2 "/US" Update Stencil
5.3 "/OS" Open Stencil
5.4 "/ST" Show Tooltips
and many more.... Basically, it would be nice to be able to do any of the options the program has from the command line.

So overall - this is an absolutely fantastic program! Just keep these things in mind when using them and I am really hoping Dimitry, if nothing else, puts in the extra options. Especially the "/C" option.

That's it! Have fun!