some art/font improvements + auto scaling

This commit is contained in:
Lephenixnoir 2023-08-19 17:33:00 +02:00
parent 196cbb97ae
commit b196419d5c
Signed by: Lephenixnoir
GPG Key ID: 1BBA026E13FC0495
11 changed files with 30 additions and 34 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.0 KiB

After

Width:  |  Height:  |  Size: 7.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.9 KiB

After

Width:  |  Height:  |  Size: 7.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 650 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 683 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.2 KiB

After

Width:  |  Height:  |  Size: 6.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 117 B

After

Width:  |  Height:  |  Size: 5.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 17 KiB

After

Width:  |  Height:  |  Size: 17 KiB

View File

@ -1,44 +1,18 @@
demo_player.png:
type: bopti-image
name: demo_player_img
*.png:
custom-type: custom-image
name_regex: (.*)\.png \1_img
profile: p8
scale: 2
demo_PNJ.png:
type: bopti-image
name: demo_PNJ_img
profile: p8
player_face.png:
type: bopti-image
name: player_face_img
profile: p8
SignAction.png:
type: bopti-image
name: SignAction_img
profile: p8
INFO_Icon.png:
type: bopti-image
name: INFO_Icon_img
profile: p8
NPC_Icon.png:
type: bopti-image
name: NPC_Icon_img
profile: p8
SGN_Icon.png:
type: bopti-image
name: SGN_Icon_img
profile: p8
demo_PNG.png:
scale: 1
font.png:
name: fontRPG
type: font
custom-type: font
charset: print
grid.size: 10x10
grid.padding: 2
grid.border: 0
proportional: true
height: 10
height: 10

Binary file not shown.

Before

Width:  |  Height:  |  Size: 246 B

After

Width:  |  Height:  |  Size: 5.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 19 KiB

After

Width:  |  Height:  |  Size: 19 KiB

View File

@ -1,4 +1,5 @@
from random import randint
from PIL import Image
import fxconv
import json
import pathlib
@ -13,6 +14,12 @@ def convert(input, output, params, target):
elif params["custom-type"] == "world":
convert_world(input, output, params, target)
return 0
elif params["custom-type"] == "custom-image":
convert_custom_image(input, output, params, target)
return 0
elif params["custom-type"] == "font":
convert_font(input, output, params, target)
return 0
else:
return 1
@ -307,3 +314,18 @@ def get_extra_map_data(input, output, params, target, xmin, ymin, xmax, ymax):
break
return nbExtraData, structData
def convert_custom_image(input, output, params, target):
scale = int(params.get("scale", 1))
# Upscale image before converting
im = Image.open(input)
im = im.resize((im.width * scale, im.height * scale),
resample=Image.NEAREST)
o = fxconv.convert_image_cg(im, params)
fxconv.elf(o, output, "_" + params["name"], **target)
def convert_font(input, output, params, target):
o = fxconv.convert_topti(input, params)
fxconv.elf(o, output, "_" + params["name"], **target)