Example #1
0
# -*- coding: utf-8 -*-
"""
Created on Sat Oct 18 12:08:18 2014

@author: girish
"""

import PIL

from scipy.ndimage import filters
from PIL import Image

from pylab import *
import os

im = PIL.Image("banana.jpg")
plot(im)
Example #2
0
# -*- coding: utf-8 -*-
"""
Created on Tue Oct  3 17:13:57 2017

@author: cgowl_000
"""
import matplotlib as plt 
import numpy as np
import PIL  as im
r = [[1,0],[0,0]]
print(r)
g = [[0,1],[0,0]]
b = [[0,0],[1,0]]

stack = np.dstack((r,b,g))
im.Image(stack)
im.
import PIL

img = PIL.Image("1217-Steve-Jobs-Quote-Think-Different.jpg")
win = PIL.ImageWin(img.getWidth(), img.getHeight())
img.draw(win)
img.setDelay(1, 15)  # setDelay(0) turns off animation

for row in range(img.getHeight()):
    for col in range(img.getWidth()):
        p = PIL.getPixel(col, row)

        newred = 255 - p.getRed()
        newgreen = 255 - p.getGreen()
        newblue = 255 - p.getBlue()

        newpixel = PIL.Pixel(newred, newgreen, newblue)

        img.setPixel(col, row, newpixel)

img.draw(win)
win.exitonclick()
def imageToNP(imageName):
    try:
        npa=pil.Image(imageName)
        return npa
    except(Exception):
        print("error")