mirror of
https://git.minetest.land/MineClone2/MineClone2.git
synced 2024-11-24 11:53:46 +01:00
More fixes
This commit is contained in:
parent
bb29dade32
commit
1a2b9e5930
@ -65,12 +65,18 @@ def convert_standard_textures(
|
|||||||
print("WARNING: Source file does not exist: " + src_file)
|
print("WARNING: Source file does not exist: " + src_file)
|
||||||
failed_conversions = failed_conversions + 1
|
failed_conversions = failed_conversions + 1
|
||||||
continue
|
continue
|
||||||
|
|
||||||
if xs != None:
|
if xs != None:
|
||||||
# Crop and copy images
|
# Crop and copy images
|
||||||
if not dry_run:
|
if not dry_run:
|
||||||
os.system("convert " + src_file + " -crop " + xl +
|
crop_width = int(xl)
|
||||||
"x" + yl + "+" + xs + "+" + ys + " " + dst_file)
|
crop_height = int(yl)
|
||||||
|
offset_x = int(xs)
|
||||||
|
offset_y = int(ys)
|
||||||
|
with Image(filename=src_file) as img:
|
||||||
|
# Crop the image
|
||||||
|
img.crop(left=offset_x, top=offset_y, width=crop_width, height=crop_height)
|
||||||
|
# Save the result
|
||||||
|
img.save(filename=dst_file)
|
||||||
if verbose:
|
if verbose:
|
||||||
print(src_file + " → " + dst_file)
|
print(src_file + " → " + dst_file)
|
||||||
else:
|
else:
|
||||||
|
@ -202,31 +202,26 @@ def convert_armor_textures(
|
|||||||
|
|
||||||
if os.path.isfile(layer_2):
|
if os.path.isfile(layer_2):
|
||||||
leggings = adir + "/" + a[5]
|
leggings = adir + "/" + a[5]
|
||||||
os.system("convert -size " +
|
with Image(width=APXSIZE * 4, height=APXSIZE * 2, background=Color('none')) as img:
|
||||||
str(APXSIZE *
|
with Image(filename=layer_2) as layer2:
|
||||||
4) +
|
# Scale the image
|
||||||
"x" +
|
layer2.resize(APXSIZE * 4, APXSIZE * 2)
|
||||||
str(APXSIZE *
|
|
||||||
2) +
|
# Apply geometry and crop
|
||||||
" xc:none \\( " +
|
crop_width = int(APXSIZE * 2.5)
|
||||||
layer_2 +
|
crop_height = APXSIZE
|
||||||
" -scale " +
|
crop_x = 0
|
||||||
str(APXSIZE *
|
crop_y = APXSIZE
|
||||||
4) +
|
layer2.crop(left=crop_x, top=crop_y, width=crop_width, height=crop_height)
|
||||||
"x" +
|
|
||||||
str(APXSIZE *
|
# Composite the cropped image over the transparent image
|
||||||
2) +
|
img.composite(layer2, 0, APXSIZE)
|
||||||
" -geometry +0+" +
|
|
||||||
str(APXSIZE) +
|
# Apply channel operation
|
||||||
" -crop " +
|
img.fx("a > 0.0 ? 1.0 : 0.0", channel='alpha')
|
||||||
str(APXSIZE *
|
|
||||||
2.5) +
|
# Save the result
|
||||||
"x" +
|
img.save(filename=leggings)
|
||||||
str(APXSIZE) +
|
|
||||||
"+0+" +
|
|
||||||
str(APXSIZE) +
|
|
||||||
" \\) -composite -channel A -fx \"(a > 0.0) ? 1.0 : 0.0\" " +
|
|
||||||
leggings)
|
|
||||||
|
|
||||||
# Convert chest textures
|
# Convert chest textures
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user