Minor tweaks.
This commit is contained in:
parent
7d816ffb21
commit
c65ae274a9
4 changed files with 20 additions and 28 deletions
|
|
@ -7,8 +7,8 @@ Most users won't need to read this! You've been warned...
|
||||||
Glymur Configuration
|
Glymur Configuration
|
||||||
''''''''''''''''''''''
|
''''''''''''''''''''''
|
||||||
|
|
||||||
The default glymur installation process relies upon OpenJPEG version
|
The default glymur installation process relies upon OpenJPEG
|
||||||
1.X being properly installed on your system. If you have version 1.5 you can
|
being properly installed on your system. If you have version 1.5 you can
|
||||||
both read and write JPEG 2000 files, but you may wish to install version 2.0
|
both read and write JPEG 2000 files, but you may wish to install version 2.0
|
||||||
or the 2.0+ version from OpenJPEG's development trunk for better performance.
|
or the 2.0+ version from OpenJPEG's development trunk for better performance.
|
||||||
If you do that, you should compile it as a shared library (named *openjp2*
|
If you do that, you should compile it as a shared library (named *openjp2*
|
||||||
|
|
@ -35,7 +35,7 @@ i.e. ::
|
||||||
|
|
||||||
This assumes, of course, that you've installed OpenJPEG into
|
This assumes, of course, that you've installed OpenJPEG into
|
||||||
/opt/openjp2-svn on a linux system. The location of the configuration file
|
/opt/openjp2-svn on a linux system. The location of the configuration file
|
||||||
is platform-dependent (of course). If you use either linux or mac, the path
|
can vary as well (of course). If you use either linux or mac, the path
|
||||||
to the configuration file would normally be ::
|
to the configuration file would normally be ::
|
||||||
|
|
||||||
$HOME/.config/glymur/glymurrc
|
$HOME/.config/glymur/glymurrc
|
||||||
|
|
@ -71,7 +71,8 @@ packages/RPMs/ports/whatever without going through pip.
|
||||||
Mac OS X
|
Mac OS X
|
||||||
--------
|
--------
|
||||||
All the necessary packages are available to use glymur with Python 2.6, 2.7,
|
All the necessary packages are available to use glymur with Python 2.6, 2.7,
|
||||||
and 3.3 via MacPorts. You should install the following set of ports:
|
and 3.3 via MacPorts. For python 3.3, you should install the following set of
|
||||||
|
ports:
|
||||||
|
|
||||||
* python33
|
* python33
|
||||||
* py33-numpy
|
* py33-numpy
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@ How do I...?
|
||||||
------------
|
------------
|
||||||
|
|
||||||
|
|
||||||
read the lowest resolution thumbnail?
|
... read the lowest resolution thumbnail?
|
||||||
=====================================
|
=====================================
|
||||||
Printing the Jp2k object should reveal the number of resolutions (look in the
|
Printing the Jp2k object should reveal the number of resolutions (look in the
|
||||||
COD segment section), but you can take a shortcut by supplying -1 as the
|
COD segment section), but you can take a shortcut by supplying -1 as the
|
||||||
|
|
@ -14,7 +14,7 @@ resolution level. ::
|
||||||
>>> j = glymur.Jp2k(file)
|
>>> j = glymur.Jp2k(file)
|
||||||
>>> thumbnail = j.read(rlevel=-1)
|
>>> thumbnail = j.read(rlevel=-1)
|
||||||
|
|
||||||
display metadata?
|
... display metadata?
|
||||||
=================
|
=================
|
||||||
There are two ways. From the unix command line, the script *jp2dump* is
|
There are two ways. From the unix command line, the script *jp2dump* is
|
||||||
available. ::
|
available. ::
|
||||||
|
|
@ -34,7 +34,7 @@ codestream box, only the main header is printed. It is possible to print
|
||||||
|
|
||||||
>>> print(j.get_codestream())
|
>>> print(j.get_codestream())
|
||||||
|
|
||||||
add XML metadata?
|
... add XML metadata?
|
||||||
=================
|
=================
|
||||||
You can append any number of XML boxes to a JP2 file (not to a raw codestream).
|
You can append any number of XML boxes to a JP2 file (not to a raw codestream).
|
||||||
Consider the following XML file `data.xml` : ::
|
Consider the following XML file `data.xml` : ::
|
||||||
|
|
@ -66,7 +66,7 @@ The **append** method can add an XML box as shown below::
|
||||||
>>> jp2.append(xmlbox)
|
>>> jp2.append(xmlbox)
|
||||||
>>> print(jp2)
|
>>> print(jp2)
|
||||||
|
|
||||||
add metadata in a more general fashion?
|
... add metadata in a more general fashion?
|
||||||
=======================================
|
=======================================
|
||||||
An existing raw codestream (or JP2 file) can be wrapped (re-wrapped) in a
|
An existing raw codestream (or JP2 file) can be wrapped (re-wrapped) in a
|
||||||
user-defined set of JP2 boxes. To get just a minimal JP2 jacket on the
|
user-defined set of JP2 boxes. To get just a minimal JP2 jacket on the
|
||||||
|
|
@ -157,18 +157,18 @@ to add metadata, you should keep in mind that **wrap** produces a new JP2 file,
|
||||||
while **append** modifies an existing file and is currently limited to XML
|
while **append** modifies an existing file and is currently limited to XML
|
||||||
boxes.
|
boxes.
|
||||||
|
|
||||||
create an image with an alpha layer?
|
... create an image with an alpha layer?
|
||||||
====================================
|
====================================
|
||||||
|
|
||||||
OpenJPEG can create JP2 files with more than 3 components (requires
|
OpenJPEG can create JP2 files with more than 3 components (requires
|
||||||
the development version), but by default, any extra components are
|
the development version of OpenJPEG), but by default, any extra components are
|
||||||
not described as such. In order to do so, we need to rewrap such
|
not described as such. In order to do so, we need to rewrap such
|
||||||
an image in a set of boxes that includes a channel definition box.
|
an image in a set of boxes that includes a channel definition box.
|
||||||
|
|
||||||
This example is based on SciPy example code found at
|
This example is based on SciPy example code found at
|
||||||
http://scipy-lectures.github.io/advanced/image_processing/#basic-manipulations .
|
http://scipy-lectures.github.io/advanced/image_processing/#basic-manipulations .
|
||||||
Instead of a circular mask, however, we'll make it an ellipse since the source
|
Instead of a circular mask we'll make it an ellipse since the source
|
||||||
image isn't square.
|
image isn't square. ::
|
||||||
|
|
||||||
>>> import numpy as np
|
>>> import numpy as np
|
||||||
>>> import glymur
|
>>> import glymur
|
||||||
|
|
|
||||||
|
|
@ -4,9 +4,8 @@ Glymur: a Python interface for JPEG 2000
|
||||||
|
|
||||||
**Glymur** is an interface to the OpenJPEG library
|
**Glymur** is an interface to the OpenJPEG library
|
||||||
which allows one to read and write JPEG 2000 files from within Python.
|
which allows one to read and write JPEG 2000 files from within Python.
|
||||||
Glymur supports both reading and writing of JPEG 2000 images. Writing
|
Glymur supports both reading and writing of JPEG 2000 images, but writing
|
||||||
JPEG 2000 images is currently limited to images that can fit in memory,
|
JPEG 2000 images is currently limited to images that can fit in memory
|
||||||
however.
|
|
||||||
|
|
||||||
Of particular focus is retrieval of metadata. Reading Exif UUIDs is supported,
|
Of particular focus is retrieval of metadata. Reading Exif UUIDs is supported,
|
||||||
as is reading XMP UUIDs as the XMP data packet is just XML. There is
|
as is reading XMP UUIDs as the XMP data packet is just XML. There is
|
||||||
|
|
@ -24,11 +23,10 @@ only supported with the 1.5 or better, however, and the trunk/development
|
||||||
version is strongly recommended. For more information about OpenJPEG,
|
version is strongly recommended. For more information about OpenJPEG,
|
||||||
please consult http://www.openjpeg.org.
|
please consult http://www.openjpeg.org.
|
||||||
|
|
||||||
If you use MacPorts on the mac or if you have a sufficiently recent
|
If you use MacPorts or if you have a sufficiently recent version of
|
||||||
version of Linux, your package manager should already provide you
|
Linux, your package manager should already provide you with a version of
|
||||||
with a version of OpenJPEG 1.X with which glymur can already use
|
OpenJPEG 1.X which glymur can already use. If your platform is windows,
|
||||||
for read-only purposes. If your platform is windows, I suggest
|
I suggest using the windows installers provided to you by the OpenJPEG
|
||||||
using the windows installers provided to you by the OpenJPEG
|
|
||||||
folks at https://code.google.com/p/openjpeg/downloads/list .
|
folks at https://code.google.com/p/openjpeg/downloads/list .
|
||||||
|
|
||||||
Glymur Installation
|
Glymur Installation
|
||||||
|
|
@ -47,13 +45,5 @@ line, so you should adjust your **$PATH**
|
||||||
to take advantage of it. For example, if you install with pip's
|
to take advantage of it. For example, if you install with pip's
|
||||||
`--user` option on linux ::
|
`--user` option on linux ::
|
||||||
|
|
||||||
$ export PYTHONPATH=$HOME/.local/lib/python3.3/site-packages
|
|
||||||
$ export PATH=$HOME/.local/bin:$PATH
|
$ export PATH=$HOME/.local/bin:$PATH
|
||||||
|
|
||||||
You can run the tests from within python as follows::
|
|
||||||
|
|
||||||
>>> import glymur
|
|
||||||
>>> glymur.runtests()
|
|
||||||
|
|
||||||
Many tests are currently skipped, but the The important thing is whether or
|
|
||||||
not any tests fail.
|
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,7 @@
|
||||||
#
|
#
|
||||||
# License: MIT
|
# License: MIT
|
||||||
|
|
||||||
|
import pdb; pdb.set_trace()
|
||||||
import sys
|
import sys
|
||||||
import numpy as np
|
import numpy as np
|
||||||
from distutils.version import LooseVersion
|
from distutils.version import LooseVersion
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue