Thanks for sharing the bear's binary file. I've tried to reproduce the export and visualization of PEC data.
However, I've experimented with the start offset as 0x2F327 something seems missing:
See attached bear_0x2F327.png.
With a different (earlier) start offset, I can see more of the bear: bear_0x2F023.png -- however, this may go too far into memory regions that are not PEC yet.
Unfortunately, I could not find neither PES nor PEC headers (based on
https://edutechwiki.unige.ch/en/Embroidery_format_PES and
https://edutechwiki.unige.ch/en/Embroidery_format_PEC).
Two code snippets; the first using Linux command line tool `dd` to extract the binary snippet out of the whole file (which goes by putty.txt here) as a new .pec file, the second one is a Python script importing the .pec file and storing the stitch data as PNG image file:
#/bin/bash
binary_name="bear"
start_offset=0x2F023 # 0x2F327 # Starting byte offset
end_offset=0x321E7 # Ending byte offset
skip=$((start_offset)) # Number of bytes to skip
count=$((end_offset - start_offset + 1)) # Number of bytes to copy
dd if=${binary_name}.bin of=${binary_name}.pec bs=1 skip=$skip count=$count
import pyembroidery
import os
file_name="bear"
pec_file_name=file_name+".pec"
file_size=os.stat(pec_file_name).st_size
print(f"PEC file size: {file_size} bytes")
pattern = pyembroidery.read_pec(pec_file_name)
print(f"number of stitches: {len(pattern.stitches)}")
print(f"number of items in threadlist: {len(pattern.threadlist)}")
pyembroidery.write(pattern, file_name+".png")
Other things I could not get working: the Vikant card emulator (another Python script)... or rather I could not get it working with the "Ultimate Explorer for Brother" (Serial port version). Even though I created virtual COM ports with com0com, only the Python side connected... and Vikant's Ultimate Explorer didn't want to open or even find the COM port. So this approach currently won't work for me to write own card binaries from PES files.
Edit: Bear beared out, see bears_preview.png -- however, seems to be some kind of mirrored.