Iconsmoothing: Subtile metrics (🦆 Edition) (#8307)

This commit is contained in:
20kdc
2022-06-05 07:35:04 +01:00
committed by GitHub
parent a439e4bb9a
commit 3d346b3477
3 changed files with 71 additions and 33 deletions

View File

@@ -26,7 +26,10 @@ import sys
import iconsmooth_lib
if len(sys.argv) != 5:
raise Exception("iconsmooth.py <TEST.png> <TILESIZE> <" + iconsmooth_lib.all_conv + "> <OUTPREFIX>")
print("iconsmooth.py in.png METRICS <" + iconsmooth_lib.all_conv + "> OUTPREFIX")
print("OUTPREFIX is something like, say, " + iconsmooth_lib.explain_prefix)
print(iconsmooth_lib.explain_mm)
raise Exception("see printed help")
# Input detail configuration
input_name = sys.argv[1]
@@ -35,20 +38,7 @@ conversion_mode = sys.argv[3]
out_prefix = sys.argv[4]
# Metric configuration
tile_w = int(metric_mode)
tile_h = int(metric_mode)
subtile_w = tile_w // 2
subtile_h = tile_h // 2
# Infer remainder from subtile
# This is for uneven geometries
#
# SUB |
# ----+----
# | REM
#
remtile_w = tile_w - subtile_w
remtile_h = tile_h - subtile_h
tile_w, tile_h, subtile_w, subtile_h, remtile_w, remtile_h = iconsmooth_lib.parse_metric_mode(metric_mode)
# Output state configuration
out_states = iconsmooth_lib.conversion_modes[conversion_mode].states
@@ -67,14 +57,14 @@ for i in range(48):
tile.paste(src_img, (tx * -tile_w, ty * -tile_h))
# now split that up
# note that THIS is where the weird ordering gets put into place
tile_a = PIL.Image.new("RGBA", (remtile_w, remtile_w))
tile_a.paste(tile, (-subtile_w, -subtile_h))
tile_a = PIL.Image.new("RGBA", (remtile_w, remtile_h))
tile_a.paste(tile, (-subtile_w, -subtile_h))
tile_b = PIL.Image.new("RGBA", (subtile_w, subtile_h))
tile_b.paste(tile, (0, 0))
tile_b.paste(tile, ( 0, 0))
tile_c = PIL.Image.new("RGBA", (remtile_w, subtile_h))
tile_c.paste(tile, (-subtile_w, 0))
tile_d = PIL.Image.new("RGBA", (subtile_w, remtile_w))
tile_d.paste(tile, (0, -subtile_h))
tile_c.paste(tile, (-subtile_w, 0))
tile_d = PIL.Image.new("RGBA", (subtile_w, remtile_h))
tile_d.paste(tile, ( 0, -subtile_h))
tiles.append([tile_a, tile_b, tile_c, tile_d])
state_size = (tile_w * 2, tile_h * 2)