I have used python to create a huge set of files based on pixels in an image. They are name by their coordinates in the image. when trying to list them by name python recognises the numbers differently to the Windows ordering (which is correct). example
A:) Windows sees 1, 1.png then 1, 2.png then 1, 3.png B:)Python sees 1, 1.png then 1. 10.png then 1, 100.png
A is the list I need as I would like to then rename these images into a convention like Image0000001.png
For context, there are 200 columns and 300 rows.
to combat this, I tried ordering by date created. unfortunately, as the images were created by python there are hundreds created a second and they default to the system above,
is there a way to "see" the number before the comma and after separately so that the script runs through all the numbers in 1, xxx in order before moving onto 2, xxx
Below is the full code with what I've tried so far
# Importing Image from PIL package
from PIL import Image
# Creating image object
im = Image.open("C:\\Users\\joeco\\Desktop\\Python-test-image\\joe2.jpg")
px = im.load()
# Defining image width and height
imageSizeW, imageSizeH = im.size
# Running through each pixel coord by column then row
for i in range(1, imageSizeW):
for j in range(1, imageSizeH):
if px[i, j] == (255, 255, 255):
pass
else:
img = Image.new('RGB', (100, 100), color = (px[i, j]))
img.save(f"C:\\Users\\joeco\\Desktop\\Python-test-image\\ML\\{i}, {j}.png")