Friday, January 20, 2017

Converting embroidery pes file to png

My wife is a quilter and uses embroidery quite frequently. You know that saying "I am a quilter and my house is in pieces!"? Well it is true. I believe she spends the national GNP on material she never uses. Anyway, she has over 22,000 little files with the extension ".pes". These turn out to be embroidery patterns than can be copied to her fancy sewing machine to embroider the image that is contained therein. And I must confess it looks pretty cool.

Embroider an "Image" did I say? Yes, but it is not a format that is recognized by hardly anything. Imagemagick, which is the omniscient image converter says that it knows what a .pes file is when you say "convert -list format" but it lies :). Try the following:

convert 20394.pes 20394.png

and .... wait for it... no... keep waiting ... and...

convert: memory allocation failed `20394.pes' @ error/pes.c/ReadPESImage/615.
convert: no images defined `20394.png' @ error/convert.c/ConvertImageCommand/3210.

Boom! So much for my Imagemagick worship. That god has no embroidery magick. :(

So, what is a fellow to do when the wife looks at him with disappointed eyes that say, "I thought you could do anything on the computer?" You search Google and pray that there is someone out there that has been here before and has come up with a solution. 

Bingo, after a frightening number of dead ends, I find a program called "pesconvert" written by Linus Torvalds in 2010, which feels like a million years ago. Wait... who?!? It appears that the master Kernel writer, coder to the tens of millions must have had a similar experience. I can hear it now at his house... "Honey, your stupid Linux operating system will not work with my wonderful sewing machine. Please can I have a Windows laptop?". Warms my heart! :)

So I went to the site and it is, of course, source code. Linus would never distribute an executable. And, oddly enough, I understand that. It is still inconvenient. So, I have the compiled version that am making available to anyone that is interested. You can find it here:


If you find the compiled version useful, please leave me comment to let me know. If you find the program useful, you may want to Linus know, he is the real genius here.