Set layer flags bit3 (Photoshop 5.0+) so PS reads tagged blocks correctly
PS-generated PSDs always set flags bit 3 (0x08) to signal Photoshop 5.0+ format where the layer extra data contains tagged blocks. Our layers had flags=0x00, so Photoshop treated them as pre-5.0 records and failed to read the extra data / layer pixels, showing every layer as transparent (only ape_2 happened to render). Verified against the reference PSD.
This commit is contained in:
1 parent
b76a26c11c
commit
e07ef4acaa
1 file changed
+3
-1
+3
-1
@@ -472,7 +472,9 @@ def _layer_record(top, left, bottom, right, name, opacity, visible, channels) ->
|
||||
rec += b"8BIM" + b"norm"
|
||||
rec += struct.pack(">B", opacity)
|
||||
rec += struct.pack(">B", 0) # clipping
|
||||
rec += struct.pack(">B", 0 if visible else 2) # flags: bit1 = hidden
|
||||
# flags: bit3 = 1 for Photoshop 5.0+ (tells PS the extra data contains
|
||||
# tagged blocks); bit1 = hidden
|
||||
rec += struct.pack(">B", 0x08 | (0 if visible else 0x02))
|
||||
rec += struct.pack(">B", 0) # filler
|
||||
# extra data
|
||||
extra = bytearray()
|
||||
|
||||
Reference in new issue
Block a user