Skip to content

Instantly share code, notes, and snippets.

@bubbobne
Created December 18, 2017 15:27
Show Gist options
  • Save bubbobne/91d51c89751d18f82e2e95545f600abe to your computer and use it in GitHub Desktop.
Save bubbobne/91d51c89751d18f82e2e95545f600abe to your computer and use it in GitHub Desktop.
from PIL import Image
import csv
immagine = Image.open(my_tiff_FILE)
pixels = list(map(lambda i: i*2,list(immagine.getdata())))
width, height = immagine.size
pixels = [pixels[i * width:(i + 1) * width] for i in range(height)]
print(pixels[0])
with open("/home/daniele/Downloads/myImg2.csv", "w") as f:
writer = csv.writer(f)
writer.writerows(pixels)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment