EmbroidePy / pyembroidery

pyembroidery library for reading and writing a variety of embroidery formats.
MIT License
181 stars 33 forks source link

edr palette format #81

Closed maxim-s-barabash closed 4 years ago

maxim-s-barabash commented 4 years ago

I'm not sure. but the last color in the palette is used as the background color. it’s mostly white and in the palette it’s ffffff00

tatarize commented 4 years ago

I'll check. I checked against embroidermodder's code, but I don't think I ran it against the files I ended up producing for the samples. It's quite plausible I got this wrong. Especially if there's some end white color there.

tatarize commented 4 years ago

The file examples I have seem to have as many entries are there are threads. So 16 threads seems to have 16 colors. If it including, a background color it seems like it would need 17. With DST files this would mean we'd have 16 colors if there were 15 color changes. But, that's because the first color is likely to be for the first thread before the color change. If it had background colors it would have 17 colors if 15 color changes.

I dunno. Maybe something else uses this, I seemed to only get some example files out of EmbroideryWare.

tatarize commented 4 years ago

The format is apparently: Embird Plus Color Paletter. -- I'll check embird and see what it does for .edr files.

I didn't make a point about it, but the format was largely concerning your project since it previously intended to use the format and I pitched this project as a replacement for that stuff and you had .edr and I didn't. So getting it right for you is kinda important.

I also added COL and INF. And there's dst version 'extended' that also puts some colors in the file. Or just exporting it in JSON.

tatarize commented 4 years ago

Hm. You're right. Embird very much does save the final background color as background color and it's usually white. I'll check if it's does that for the other formats too. And especially if it loads just the thread colors or if Embird requires the background color too.

tatarize commented 4 years ago

Double checked and that final color is non-essential. If it's omitted it simply doesn't tell embird what to do with the background. But, the EDR support mostly made for you, so if you want, I'd be happy to slap on a white at the end of that file type, and count the colors on the flip side and omit it where it would be correct to do so.

tatarize commented 4 years ago

I ran: python pyemb.py -i duck.pes -o d.edr d.dst

Which is my command line hook into pyembroidery. And it produced d.edr and d.dst which loaded up in embird (though without anchored background colors) with the proper thread colors.

maxim-s-barabash commented 4 years ago

I support the .edr format because it is often found with embroidery files. I installed embird 2019 and opened your samples. and the background color was the color of the last color. Looked at the samples coming with embird and concluded that the number of colors in the palette does not match the number of color blocks in the embroidery file. also the last color in the palette was white.

Also Embird 2019 is trying to find available palettes for the embroidery file: .edr, .rgb, .inf, .txt

.rgb is an alias for .edr, came across once

maxim-s-barabash commented 4 years ago

my conclusion. preserving the background color is an option behavior for Embird. overall it doesn’t matter. issue can be closed.

tatarize commented 4 years ago

PES files in their headers actually do contain a background element. There's a byte that chooses a pallette color to use as the PES background in the settings. I could support it, as a metadata element. But, it's of a dubious utility. EmbroideryWare didn't include it, and the files loaded fine.

I checked a bit and .rgb actually works like .edr except that it never tries to save the background color. You can save out both and .rgb makes no attempt to add that extra color in there.