EmbroidePy / pyembroidery

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

.dst (Embroidery) to .png conversion #57

Closed dnyaneshwargit closed 5 years ago

dnyaneshwargit commented 5 years ago

I have converted .dst file to png format but it showing different colors always. not showing original colors.

--------------code

import sys import pyembroidery import uuid

unique_filename = str(uuid.uuid4())

api_link = sys.argv[1]

filename = "../img/customized-images/"+unique_filename+".png"

pyembroidery.convert(api_link, filename, {"encode": False})

print(unique_filename+".png")

---------code end

tatarize commented 5 years ago

The problem is that DST files have no colors. You can set the colors manually by adding them but they don't actually exist. The dst file format has no colors in it, so pyembroidery defaults to random colors. It's not showing the "original" colors because there are no original colors.

wwderw commented 5 years ago

If the goal is to provide a realistic simulated view of embroidery with true colors, have to either use the source file from a digitizing program or have to use a stitch file that supports the color function such as Brother's PES format.

The DST file format is the universal format for embroidery machines (especially commercial) and doesn't support color functions, that's why a stitch chart (either printed out or in a digital version) is provided with the DST file so the operator knows when to use what color (or when to substitute what color where).

dnyaneshwargit commented 5 years ago

thank you @tatarize and @wwderw. This will now clear my all the confusions.

dnyaneshwargit commented 5 years ago

i'm facing while converting .dst file into .pes or any available format, the file gets converted but not opening in embroidery tools.Even i'm converting .dst to another dst but its not working. dst_file = pathDST+sys.argv[1]

output_file = pathOutput+sys.argv[2]

pyembroidery.convert(dst_file, output_file)

pattern = pyembroidery.read_dst(dst_file)

pyembroidery.write_dst(pattern, output_file)

pyembroidery.write(pattern,output_file)

i tried above pyembroidery scripts

tatarize commented 5 years ago

"Not opening in embroidery tools"? What does that mean? You can open it, it's the pattern object in the opened form. You can iterate through that all you'd like or the colors or alter it in a few different ways. Conversion is merely the result of loading the file and saving it as a different thing. Once loaded as a pattern you're free to do whatever you need to do with it.