Ask coding questions

← Back to all posts
flipping image
stuartmilde (1)


I am wondering how I may flip an image upside down. So far I have uploaded my image and have had success with changing RGB values, but have not been able to flip the image upside down. Does anyone have any suggestions?

Cheers, Stuart

FloCal35 (502)

You could take a screen shot and use a photo editor to flip it then download it and put it on whatever

Geocube101 (624)

What language
You could iterate over every pixel in the image (a rather slow process) and move each pixel keeping its x position and changing its y position
It would be better to scan the pixel, change its position, and then paste that pixel onto a new image as to not mess up the original

stuartmilde (1)

I am using python with pygame here in
Are you able to share the code used to change pixel position.
Thus far I am capable in recreating the image using the nested loop
: for x in range(width)
for y in range(height)
pixel = img[x]