diff --git a/ppl2psd.py b/ppl2psd.py index 8f6dc52..612dafe 100644 --- a/ppl2psd.py +++ b/ppl2psd.py @@ -508,9 +508,12 @@ def _layer_record(top, left, bottom, right, name, opacity, visible, channels, pad = (-len(extra)) % 4 if pad: extra += b"\x00" * pad - # luni: unicode layer name + # luni: unicode layer name. Data = 4-byte CHARACTER count + utf-16-be + # chars. (Writing raw utf-16 without the count shifts the extra-data + # parse and Photoshop reads every layer's pixels as empty.) uni = name.encode("utf-16-be") - extra += b"8BIMluni" + struct.pack(">I", len(uni)) + uni + luni_data = struct.pack(">I", len(uni) // 2) + uni + extra += b"8BIMluni" + struct.pack(">I", len(luni_data)) + luni_data # standard blocks Photoshop expects (see _standard_blocks) extra += _standard_blocks(layer_id) rec += struct.pack(">I", len(extra))