Skip to content

Commit 9a8338b

Browse files
committed
Add a PNG conversion script
1 parent 6196bf9 commit 9a8338b

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

Diff for: png16.py

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
"""
2+
Converts images to the 4-bit PNG format required by Stage.
3+
"""
4+
5+
import sys
6+
from PIL import Image
7+
8+
9+
filename = sys.argv[1]
10+
image = Image.open(filename)
11+
image = image.convert(mode='P', dither=Image.Dither.NONE,
12+
palette=Image.Palette.ADAPTIVE, colors=16)
13+
filename = filename.rsplit('.', 1)[0] + '.png'
14+
image.save(filename, 'png', bits=4)

0 commit comments

Comments
 (0)