Wednesday, January 13, 2010

Embroidery.. gaah

So for Christmas, Tove got this embroidery machine from Santa Claus. Since then, she's busily been filling the kids clothes with names, re-doing their Tae-Kwon-Do uniforms etc etc.

And why do I care? It turns out that all those embroidery machines can be extended with new patterns, and most of them - including the one Tove has - seem to use this special and pretty much undocumented "PES" format that was designed by Brother. So Tove has been buying embroidery patterns, but actually seeing them on the computer and transferring them to the sewing machine is a big pain.

So the above beautiful png file is what I did today. It's the result of me doing a thumbnailer for those PES files (and yes, "PES" stands for "PESky", I'm convinced), so that Tove can see the designs in her file manager as she moves them around.

I can read them (largely thanks to converting a php script written by Robert Heel - which in turn seems to be based on a GPL C# project from - into C code) and then drawing them and writing the result out as a png out with cairo. Sadly, it seems that the embroidery machine itself sometimes has a rather harder time. When uploading the designs to the machine, a number of them just say "Data Error", which is very annoying.

I wonder what those embroidery machine firmware people were thinking. No diagnostics, no nothing. If a design is too large for the hoop of the machine, the machine accepts it (no "Data Error"), but doesn't actually show or use the design - it just silently ignores it.

Whee. Undocumented formats, bad firmware, lack of sane error messages. And did I mention crazy interfaces? The embroidery machine itself shows up as a USB storage device when you connect it, except it for some reason takes about half a minute to calm down enough to be mounted. And forget about the embroidery card reader/writer - that one needs some magic USB driver too.

But hey, if somebody else is fighting with PES files, here's a pointer to 'pesconvert', my git source tree for that silly thumbnailer that created the above png. You'll need pnglib-devel and cairo-devel to compile it, but it's small and simple. And in case you wonder about the source PES file, it's Jan_heartsdelight.pes, a demonstration PES image from brother.