Skip to content

Commit

Permalink
TO SQUASH
Browse files Browse the repository at this point in the history
  • Loading branch information
luispedro committed Nov 13, 2014
1 parent d6d14ce commit 95aa02e
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 0 deletions.
31 changes: 31 additions & 0 deletions mahotas/io/pil.py
@@ -0,0 +1,31 @@
import numpy as np
from PIL import Image

def imread(filename):
'''Read an image into a ndarray from a file.
This function depends on PIL (or Pillow) being installed.
Parameters
----------
filename : str
filename
'''
array = Image.open(filename)
return np.array(array)

def imsave(filename, array):
'''
Writes `array` into file `filename`
This function depends on PIL (or Pillow) being installed.
Parameters
----------
filename : str
path on file system
array : ndarray-like
'''
im = Image.fromarray(array)
im.save(filename)

1 change: 1 addition & 0 deletions tests-requirements.txt
@@ -1,3 +1,4 @@
scipy
imread
nose
pillow

0 comments on commit 95aa02e

Please sign in to comment.