CreativeInquiry / PEmbroider

Embroidery Library for Processing
Other
458 stars 26 forks source link

layer names as metadata #95

Open stephanschulz opened 4 years ago

stephanschulz commented 4 years ago

Is it possible to embed layer names in to the metadata of the .jef file? When I create a multi color image I see the color names are inside the metadata and a bunch of None which might mean those None could hold a layer name. And maybe the machine would display that layer name too, since it does show the number behind the jef -> "$","1","#ffe505","Canary Yellow","Jef","275","None","None" Having the layer / image name would help hand picking the correct color during stitching, since I only pick colors during the stitching process and the RGB values picked in the code don't necessarily match.

"#","[VAR_NAME]","[VAR_VALUE]"
">","STITCH_COUNT:","8864"
">","THREAD_COUNT:","8"
">","NEEDLE_COUNT:","0"
">","EXTENTS_LEFT:","-441"
">","EXTENTS_TOP:","-246"
">","EXTENTS_RIGHT:","256"
">","EXTENTS_BOTTOM:","335"
">","EXTENTS_WIDTH:","697"
">","EXTENTS_HEIGHT:","581"
">","COMMAND_STITCH","8778"
">","COMMAND_JUMP","77"
">","COMMAND_END","1"
">","COMMAND_COLOR_CHANGE","8"

"#","[THREAD_NUMBER]","[HEX_COLOR]","[DESCRIPTION]","[BRAND]","[CATALOG_NUMBER]","[DETAILS]","[WEIGHT]"
"$","0","#ff0000","Red","Jef","225","None","None"
"$","1","#ffe505","Canary Yellow","Jef","275","None","None"
"$","2","#c3007e","Peony Purple","Jef","241","None","None"
"$","3","#1e77ac","Sola Blue","Jef","263","None","None"
"$","4","#0b2f84","Blue","Jef","207","None","None"
"$","5","#b15818","Hazel","Jef","254","None","None"
"$","6","#986c80","Salmon","Jef","256","None","None"
"$","7","#007772","Peacock Green","Jef","251","None","None"
"$","8","#000000","Black","Jef","002","None","None"

"#","[STITCH_INDEX]","[STITCH_TYPE]","[X]","[Y]"
"*","0","JUMP","-36","17"
"*","1","JUMP","-72","35"
"*","2","STITCH","-91","44"
"*","3","STITCH","-92","44"
"*","4","JUMP","-84","-36"
"*","5","JUMP","-76","-116"
"*","6","JUMP","-68","-196"
"*","7","STITCH","-63","-246"
LingDong- commented 4 years ago

Hi @stephanschulz

Unfortunately I don't think there's a way to write a custom name in place of the "None"s. In JEF, the list of threads is basically a list of numbers, each number is the ID of a brand of thread. So the encoding of color basically works by finding the closest color in a standard list of thread brands. For example if you used stroke(200,0,120), then it turns out "Peony Purple" (rgb(195,0,126)) is the closest color, so its ID, which is the single number, 2, gets written. I think all the other info you see in the printout are inferred from this number. From the table header it looks like the other 2 fields where "None" are used are "[DETAILS]" and "[WEIGHT]", which I'm not sure correspond to custom layer name either.

Perhaps these fields are not "None" for other colored threads in the list. Or perhaps they're reserved for future use. This link shows the full table of threads and their IDs: (There're 79 of them)

https://edutechwiki.unige.ch/en/Embroidery_format_JEF

The link also contains the full JEF spec, which also doesn't seem to show it's possible to write custom strings anywhere :P