Skip to content

Commit cf88264

Browse files
committed
Allows AutoImport to resize textures
1 parent 13170b2 commit cf88264

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

AutoImport.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -155,18 +155,18 @@ def autoImport(self):
155155
position = element["uv"]
156156

157157
if canOpenImage(file):
158-
isSized = isImage16x16(file)
158+
textureToReplace = Image.open(file)
159+
isSized = isImageSize(textureToReplace, element["tileSize"], element["tileSize"])
159160
if not (not isSized and not allowResize):
160161
# Show new texture in preview frame
161-
portviewImage = Image.open(file)
162-
portviewRes = portviewImage.resize((256, 256), Image.Resampling.NEAREST)
162+
portviewRes = textureToReplace.resize((256, 256), Image.Resampling.NEAREST)
163163
root.previewFrame.portview.configure(dark_image=portviewRes)
164164

165165
# Replace texture
166166
print("Opening new texture and replacing...")
167-
textureToReplace = Image.open(file)
167+
168168
if not isSized:
169-
textureToReplace = textureToReplace.resize((16, 16), Image.Resampling.LANCZOS)
169+
textureToReplace = textureToReplace.resize((element["tileSize"], element["tileSize"]), Image.Resampling.LANCZOS)
170170
atlas.addElement(position, textureToReplace)
171171

172172
if not os.path.exists(f"{outputDir}/{textureDestDir}"):

0 commit comments

Comments
 (0)