main/postmarketos-splash: add --raw (!75)
This commit is contained in:
parent
e371209b29
commit
18366bb90b
2 changed files with 15 additions and 6 deletions
|
@ -1,6 +1,6 @@
|
|||
pkgname=postmarketos-splash
|
||||
pkgver=1
|
||||
pkgrel=4
|
||||
pkgver=2
|
||||
pkgrel=0
|
||||
pkgdesc="Splash screen for postmarketOS"
|
||||
url="https://gitlab.com/postmarketos"
|
||||
arch="noarch"
|
||||
|
@ -20,6 +20,6 @@ package() {
|
|||
"$pkgdir"/usr/share/fonts/ttf-pmos/pmos.ttf
|
||||
}
|
||||
|
||||
sha512sums="1bc981e21d2186dcc8bbc1cea1d8893aa4be5bace763e4df7e91c6949babcc612f12ff4426d0e592f810c7d3448dba3d603ebfce5eb2eb0fd76f6cca8e571139 make-splash.py
|
||||
sha512sums="580c96501137bbd606ee0a946ac057777a1f07e780d84e40bfb7909db09d2704d308373baea6e25fde50866918e169070c0842893732c5fd339cc1f0c329f85a make-splash.py
|
||||
cdde481bf7c68840515b839d974dd1dddfb37551a2939780e13dce11331f7d1964043de48f8902a30372e9fc9f042bd4ee133e2098694739c452a76b70e97111 config.ini
|
||||
81e5df350bf7f435ab5480f7028fc3cabf5a947fa0dff1ed219f6d9ac18a1250f5114887a9f5f270cc699af48cd77f23d14a84578ac8d2d0f3a3e90ec3211c45 pmos.ttf"
|
||||
|
|
|
@ -3,9 +3,10 @@ from PIL import Image, ImageFont, ImageDraw
|
|||
import configparser
|
||||
import os
|
||||
import sys
|
||||
import itertools
|
||||
|
||||
|
||||
def make_splash(width, height, filename, landscape=False, text="", config_file=None, center=False):
|
||||
def make_splash(width, height, filename, landscape=False, text="", config_file=None, center=False, raw=False):
|
||||
print("Creating ({}x{}) splashscreen {}".format(width, height, os.path.basename(filename)))
|
||||
|
||||
config = configparser.ConfigParser()
|
||||
|
@ -60,7 +61,14 @@ def make_splash(width, height, filename, landscape=False, text="", config_file=N
|
|||
text_top += line_height + (text_size * 0.4)
|
||||
|
||||
del draw
|
||||
im.save(filename, format='PPM')
|
||||
|
||||
if raw:
|
||||
data = list(im.getdata()) # [(R,G,B), (R,G,B)]
|
||||
flat = list(itertools.chain.from_iterable(data)) # [R, G, B, R, G, B]
|
||||
with open(filename, 'wb') as handle:
|
||||
handle.write(bytes(flat))
|
||||
else:
|
||||
im.save(filename, format='PPM')
|
||||
|
||||
|
||||
def check_font(config, section):
|
||||
|
@ -110,6 +118,7 @@ if __name__ == '__main__':
|
|||
parser.add_argument('--text', type=str, help='Additional text for the splash screen')
|
||||
parser.add_argument('--center', action='store_true', help='Center text')
|
||||
parser.add_argument('--config', type=str, help='Config file for splash screen style')
|
||||
parser.add_argument('--raw', action='store_true', help='Output raw rgb instead of ppm')
|
||||
args = parser.parse_args()
|
||||
|
||||
make_splash(args.width, args.height, args.filename, args.landscape, args.text, args.config, args.center)
|
||||
make_splash(args.width, args.height, args.filename, args.landscape, args.text, args.config, args.center, args.raw)
|
||||
|
|
Loading…
Reference in a new issue