Do all the things like ++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatarSign Up
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple APILearn More
To code green dots out of existence in Python, use the following code:
image = Image.open("image.png") # Open image
pixels = image.load() # Load pixel data
for i in range(image.size): # Iterate over each pixel
for j in range(image.size):
if pixels[i,j] == (0,255,0,255): # Check if pixel is green
pixels[i,j] = (255,255,255,0) # Make pixel transparent
image.show() # Save and display modified image
#python #imageprocessing #colorcorrections
spongessuck5899273dOy that's the worst code I've ever seen. The comments really make it intolerable, though I guess the python crowd needs them to know what's happening ;P
Oktokolo12428272d@spongessuck It is tutorial code. That stuff is always too simple as it only covers the core essence. But when you see that it doesn't detect all the greens, you can ask ChatGPT another question to fix that (probably doesn't work well here but in a one-on-one session with context-persistence it does).
You keep using ChatGPT to help you code and sooner or later you actually become a code monkey or dev - depending on how suited your brain is to learn this sort of thing. For a lot of people, AI conversations will become the new uber method of learning things.