Fixed write example so as to not rely on matplotlib.
This commit is contained in:
parent
86e024b081
commit
9a77cfac97
2 changed files with 6 additions and 8 deletions
|
|
@ -0,0 +1 @@
|
||||||
|
May 27, 2013 - Changed write example to not rely on matplotlib.
|
||||||
|
|
@ -194,16 +194,13 @@ class Jp2k(Jp2kBox):
|
||||||
|
|
||||||
Examples
|
Examples
|
||||||
--------
|
--------
|
||||||
>>> import numpy as np
|
>>> import glymur
|
||||||
>>> import matplotlib as mpl
|
>>> import pkg_resources as pkg
|
||||||
>>> import matplotlib.pyplot as plt
|
>>> jfile = pkg.resource_filename(glymur.__name__, "data/nemo.jp2")
|
||||||
>>> import os
|
>>> jp2 = glymur.Jp2k(jfile)
|
||||||
>>> file = os.path.join(mpl.get_data_path(), 'sample_data', 'lena.png')
|
>>> data = jp2.read(reduce=3)
|
||||||
>>> data = plt.imread(file)
|
|
||||||
>>> data = data * 255
|
|
||||||
>>> from tempfile import NamedTemporaryFile
|
>>> from tempfile import NamedTemporaryFile
|
||||||
>>> tfile = NamedTemporaryFile(suffix='.jp2', delete=False)
|
>>> tfile = NamedTemporaryFile(suffix='.jp2', delete=False)
|
||||||
>>> from glymur import Jp2k
|
|
||||||
>>> j = Jp2k(tfile.name, mode='wb')
|
>>> j = Jp2k(tfile.name, mode='wb')
|
||||||
>>> j.write(data.astype(np.uint8))
|
>>> j.write(data.astype(np.uint8))
|
||||||
"""
|
"""
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue