Skip to content

Instantly share code, notes, and snippets.

@BilHim
Created February 17, 2021 21:03
Show Gist options
  • Save BilHim/b94bc9ac0da35353612cc04f05498536 to your computer and use it in GitHub Desktop.
Save BilHim/b94bc9ac0da35353612cc04f05498536 to your computer and use it in GitHub Desktop.
for x in range(width):
for y in range(height):
r, g, b = image.getpixel((x, y))
r_ = 255 * (r/255)**gamma
g_ = 255 * (g/255)**gamma
b_ = 255 * (b/255)**gamma
new_pixel = (int(r_), int(g_), int(b_))
new_image.putpixel((x, y), new_pixel)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment