Tchaly Posted October 25, 2023 Share Posted October 25, 2023 Hey there !  I've been looking a way to resize every tile in a tileset but didn't find any tool, so ... here is a script to do it : from PIL import Image import os tileBaseSize = int(input("Tile base size ? (ex : 48)")) tileNewSize = int(input("Tile new size ? (ex : 32)")) for x in os.listdir(): if x.endswith(".png"): # Read the image im = Image.open(x) width, height = im.size newim = Image.new(mode="RGBA", size=(width, height)) i = 0 j = 0 for w in range(0,width, tileBaseSize): for h in range(0,height,tileBaseSize): # Image size size = (tileNewSize, tileNewSize) bx = (w, h, tileBaseSize+w,tileBaseSize+h) print(bx) # Resize image out = im.resize(size,box=bx) newim.paste(out, (i*tileNewSize,j*tileNewSize)) j = j+1 j=0 i= i +1 #newim.show() # Save resized image newim.save(str(tileNewSize)+"x"+str(tileNewSize)+"_"+x) Prerequired : Python3 Pillow library  Usage : Put the script in a folder with tileset to resize, it will resize every tileset in folder and create new ones in the folder.  For instance : I put my 48x48 tilset in my "ToResizeFolder", also my script in "ToResizeFolder". I want my tileses to be 32x32 so I launch my script (on windows : python.exe .\ResizeTile.py) It prompt me wich size is my base tileset so it's 48, press enter and which size I want my tileset instead, I enter 32 then press enter. Here it is. Your file is named 32x32_thebasename.png  Well, cheers ! Tchaly Talikan, Authentic, Artheios and 3 others 6 Link to comment Share on other sites More sharing options...
Smoot Posted October 26, 2023 Share Posted October 26, 2023 I did this with a photoshop batch and I ended up with wrapping tiles not looking right because the edges were off from like artifacts or whatever upscale compression (I'm obviously not a graphics artist). Does this mess up the edges? Link to comment Share on other sites More sharing options...
Tchaly Posted October 26, 2023 Author Share Posted October 26, 2023 Hey,  I just use Pillow as resize library. The méthode I use is resizing each tile and paste it on a new image :).  I don’t really know if this answer to your question ? Is it ?  Cheers, Tchaly Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now