Render text working.
This commit is contained in:
1 parent
87f18d0e13
commit
1af2b8f47b
19 files changed
+340
-157
No files matched your search
@@ -72,7 +72,24 @@ def processAlphaImage(asset):
|
||||
assetPath = asset['path']
|
||||
print(f"Processing alpha image: {assetPath}")
|
||||
|
||||
data = bytearray()
|
||||
data.extend(b"DAI") # Dusk Alpha Image
|
||||
image = Image.open(assetPath).convert("RGBA")
|
||||
data.extend(image.width.to_bytes(4, 'little')) # Width
|
||||
data.extend(image.height.to_bytes(4, 'little')) # Height
|
||||
for pixel in list(image.getdata()):
|
||||
# Only write alpha channel
|
||||
data.append(pixel[3].to_bytes(1, 'little')[0]) # Pixel alpha
|
||||
|
||||
relative = getAssetRelativePath(assetPath)
|
||||
fileNameWithoutExt = os.path.splitext(os.path.basename(assetPath))[0]
|
||||
outputFileRelative = os.path.join(os.path.dirname(relative), f"{fileNameWithoutExt}.dai")
|
||||
outputFilePath = os.path.join(args.output_assets, outputFileRelative)
|
||||
os.makedirs(os.path.dirname(outputFilePath), exist_ok=True)
|
||||
with open(outputFilePath, "wb") as f:
|
||||
f.write(data)
|
||||
|
||||
outImage = {
|
||||
"files": []
|
||||
"files": [ outputFilePath ]
|
||||
}
|
||||
return outImage
|
||||
Reference in new issue
Block a user