Open maxim-s-barabash opened 5 years ago
pyembroidery author here. If you're already running python why not toss in a requirement of pyembroidery? EmbroidePy/pyembroidery is MIT licensed and will let you import and export everything it needs. You could included it whole cloth into your project if you want.
And what do you mean by test suite for PES? Like specific tests to see if that PES is correct? It's actually kinda a tall order. You can often read and write broken PES files without much trouble. The real gold standard is whether a brother sewing machine can actually sew it. But, the point of pyembroidery is to be a drop in Embroidery IO library. If something's missing from pyembroidery making it harder to just utilize I'd be happy to correct such things. I mean I wrote most of the data in the links you cited there. Not only the edutech wiki stuff, and pyembroidery, but also funnily enough the last update on libpes is the integration of some of my work on PES.
@tatarize we cannot set pyembroidery as a dependency because there is no pyembroidery package in Ubuntu or other distros. Embedding pyembroidery inside the project is not a right way because we don't support this code. Embroidery file formats support is not a primary subject of sK1 application. It's just a personal initiative of @maxim-s-barabash So it would be great to get some sample files for testing our PES import filter.
It's MIT licensed, there's no demand that you need to support the code. Take it and plug it into your code anyway you want. I tried to make it really readable so you can see it doesn't do anything squirrelly. Inkstitch likewise just includes it as a fork without any outside updating, it's a fine way to do that. It's 250k and basically lets you open and write all the formats I could get my hands on (except .csd since it has encryption it runs afoul of DMCA).
That said, I'll cook up some sample outputs for various formats. I'd guess some free licensed patterned shapes with some non-color changed trimmed elements, saved out from most of the highly popular embroidery programs would scratch that itch.
Should be here: https://github.com/EmbroidePy/samples
Might need some fancier ones like with motifs clogging up the header information. But, has a lot of the brother export files with various versions. Though again, just fork pyembroidery and use it directly. Would have you up and running no time and works for way more formats.
@maxim-s-barabash what do you think about pyembroidery bundling?
@tatarize, big job. Thanks for the samples. I have no experience in machine embroidery, and any comments are very valuable to me. sk1 team has a 'sword' tool for analyze files. But for its use requires the implementation of the uc2 model. We can try to hack the .csd format together.
@sk1project, We discussed the use of pyembroidery, we must try.
@maxim-s-barabash so, we need splitting supported file formats on separate hubs: vector, raster, palettes, embroidery. UC2 will be really "universal" :)
I'm mostly done producing the samples. I think I have Wilcom left.
Reading PES isn't actually that hard, it gives you the PEC block offset at the beginning and you just jump there and read the stitch content. It's backwards compatible no matter the version since the old machine hardware isn't going to change, and the new software can't make incompatible stuff. Brother just shoves a bunch of software specific stuff in between the seek offset and the PEC block, so they can add a bunch of stuff like rectangles and circles in custom blocks that the hardware will never need to see. At version 4 they started adding some metadata in there for threads, etc. That matters for visualizing it since the magic palette stops being used at that point.
I have a lot of experience with machine embroidery files now. And pyembroidery is about as good as I can do. I strongly contributed to 5/6 of your links there, and this is the solution I highly recommend. I also get some feedback from inkstitch with real users who sew the designs out, which is the gold standard as far these files go. You can end up reading and writing seemingly flawless files that no machine will ever sew.
--
Embroidery file formats are a total crapshow. Everybody has their own, they are all proprietary and there's basically no documentation anywhere. Or there was, I actually wrote a bunch of it myself. Most machines can run DST files but that encoding scheme is literally for punch tape. The reason all the command codes end with 0b11 is that if you put that tape in upside-down it means STOP, which is better than running gibberish. There's a bunch of basically identical formats with different names like .TAP is really just .DST without the DataStitch header. Other formats like DSB have the same DataStitch header as DST but with Barudan stitch data. Some formats have overt stop commands that are different than color changes, assuming they came about after multineedle machines became common. Some formats have an overt TRIM command since they have a trimmer. Other use the number of command codes in a sequence to assume a TRIM. Like DST regularly includes dummy jump stitches like (+2,+2), (-4,-4), (+2, +2) to pad the jump sequence such that it forces a trim. Since DST is a kind of de facto standard, and plenty of machines with trimming regularly use them. U01 has needle set commands, rather than color changes which matters if you double-back to the same needle or need to in a design, but like DST doesn't save any colors. Although there is a sort of extended header DST that actually does store some color information. Etc, Etc, Etc.
My point this whole industry of things are a poorly constructed clusterfoxtrot. My underlying motivation was to make this stuff accessible to computer science minded people. So I documented the formats (hence the edutech wiki information) and wrote pyembroidery to try make it so that people don't actually need to learn the formats because, again, they are horrible.
--
I already have the .csd format done. Josh (from Embroidermodder) has a fine decoder (https://github.com/Embroidermodder/libembroidery/blob/master/format-csd.c). It's simply omitted because defeating any encryption scheme violates the DMCA. There's literally no reason to encrypt an embroidery other than to protect your copyrighted content. I'm pretty sure ART and EMB are encrypted and I'm sure PEN (very rare, Brother/Disney format) is. Though there's plenty of other obscure formats out there and I didn't write up all the writers. Heck I should probably add an EDR reader and writer.
--
I'm pretty sure my APIs should be really easy to integrate into anything. If anything is even a bit confusing raise an issue ( https://github.com/EmbroidePy/pyembroidery ). If all else fails, it's all pretty well written and I made an effort to try to document what it was doing inside the code too. The readers don't need any preprocessing either so those can basically be used without the rest of the code. Which was kinda the point there.
estoy haciendo un proyecto con formato (*.dst) si alguien de la comunidad me podria ayudar.
all code dedicated to this format is available here. If he helps you I will be glad.
I wrote up some documentation when I was making pyembroidery (which you should use if your project is just converting embroidery to vector stuff).
import:
export:
notes
Tajima DST file cannot store the color palette, this palette must be saved into a separate file. So, we added a support for a file with the .EDR extension. If you have the SQUIRREL.DST file and save the color palette, it will be stored in the SQUIRREL.EDR
Spec file