Glymur 0.12.9.post1__py3-none-any.whl → 0.13.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
glymur/lib/openjp2.py CHANGED
@@ -5,6 +5,7 @@
5
5
  import ctypes
6
6
  import queue
7
7
  import textwrap
8
+ import warnings
8
9
 
9
10
  # 3rd party library imports
10
11
  import numpy as np
@@ -1495,3 +1496,32 @@ def write_tile(codec, tile_index, data, *pargs):
1495
1496
  def set_error_message(msg):
1496
1497
  """The openjpeg error handler has recorded an error message."""
1497
1498
  ERROR_MSG_LST.put(msg)
1499
+
1500
+
1501
+ # Setup the default callback handlers. See the callback functions subsection
1502
+ # in the ctypes section of the Python documentation for a solid explanation of
1503
+ # what's going on here.
1504
+ _CMPFUNC = ctypes.CFUNCTYPE(ctypes.c_void_p, ctypes.c_char_p, ctypes.c_void_p)
1505
+
1506
+
1507
+ def _default_error_handler(msg, _):
1508
+ """Default error handler callback for libopenjp2."""
1509
+ msg = "OpenJPEG library error: {0}".format(msg.decode('utf-8').rstrip())
1510
+ set_error_message(msg)
1511
+
1512
+
1513
+ def _default_info_handler(msg, _):
1514
+ """Default info handler callback."""
1515
+ print("[INFO] {0}".format(msg.decode('utf-8').rstrip()))
1516
+
1517
+
1518
+ def _default_warning_handler(library_msg, _):
1519
+ """Default warning handler callback."""
1520
+ library_msg = library_msg.decode('utf-8').rstrip()
1521
+ msg = "OpenJPEG library warning: {0}".format(library_msg)
1522
+ warnings.warn(msg, UserWarning)
1523
+
1524
+
1525
+ _ERROR_CALLBACK = _CMPFUNC(_default_error_handler)
1526
+ _INFO_CALLBACK = _CMPFUNC(_default_info_handler)
1527
+ _WARNING_CALLBACK = _CMPFUNC(_default_warning_handler)
glymur/tiff.py CHANGED
@@ -697,9 +697,14 @@ class Tiff2Jp2k(object):
697
697
  self.tw = self.imagewidth
698
698
  self.rps = self.get_tag_value(278)
699
699
 
700
+ if self.spp == 1:
701
+ shape = (self.imageheight, self.imagewidth)
702
+ else:
703
+ shape = (self.imageheight, self.imagewidth, self.spp)
704
+
700
705
  self.jp2 = Jp2k(
701
706
  self.jp2_filename,
702
- shape=(self.imageheight, self.imagewidth, self.spp),
707
+ shape=shape,
703
708
  tilesize=self.tilesize,
704
709
  **self.jp2_kwargs
705
710
  )
glymur/version.py CHANGED
@@ -20,7 +20,7 @@ from .lib import tiff
20
20
 
21
21
  # Do not change the format of this next line! Doing so risks breaking
22
22
  # setup.py
23
- version = "0.12.9post1"
23
+ version = "0.13.0"
24
24
 
25
25
  version_tuple = parse(version).release
26
26
 
@@ -1,24 +0,0 @@
1
- glymur/__init__.py,sha256=2Ow4L_eja-L_aIGxWPTEa916-Bi_JzTUKdx-4sN0cQQ,570
2
- glymur/_iccprofile.py,sha256=_WfQsT-BqEWQzQVTtuY7tSXqPjOtwvWGW36rKxlLv1s,4148
3
- glymur/codestream.py,sha256=R9eEFFwndNpx4ixFFisfUJXi9bX5Ofp-eqGfULXOq4w,59979
4
- glymur/command_line.py,sha256=jm-6dD2jcU_G7mJAJ0U5sanfG9kRy-j0-G3eSN_Ieek,7476
5
- glymur/config.py,sha256=BDjNKkjb7oOleqSTxYpvS4uhEIo0TknVjvelJSUJKGM,4443
6
- glymur/core.py,sha256=IDkk8FESyukQTB10LHBZ4VQM36NwKE4CXCcuJ407Kzg,3638
7
- glymur/jp2box.py,sha256=FyyWoVc0Pse5A1UQWiOPoOvMhxJKleKjrBXuXzIH6BI,112477
8
- glymur/jp2k.py,sha256=9-bsIMqvpIAAiLJ2HHziWYP3iPx-9pC9Uq8IBbRt1X0,87324
9
- glymur/options.py,sha256=-JZrrDzYsLZZ9Rce6l9e_lxtSGtXoWo9j3wajyDHVi8,6386
10
- glymur/tiff.py,sha256=X8rG2NQoEI8MoXQYDZFQbTU2aG0yVSR77qA4FTiM3uI,41530
11
- glymur/version.py,sha256=SVfC9mw-20A3mAKdgksDO9H0hb1yoSsSWNOPJbGDlXs,986
12
- glymur/data/__init__.py,sha256=pU_6hn1_8aAVVdgCAIUY1B73VkLf_nSlunQuPcGgVTU,1163
13
- glymur/data/goodstuff.j2k,sha256=xKQG68KMu33gYjRUDTQvam1Cue2tdio85rNp5J-rYZE,115220
14
- glymur/data/heliov.jpx,sha256=KXnYdBZgl25jcGLu-m-QfhuP9pqUXV0Hp9HHEdJqr34,1399071
15
- glymur/data/nemo.jp2,sha256=EkRy3wgA3cwkYxweNDdD-4nHlrkPnPPyNjSKHWnYjYM,1135519
16
- glymur/lib/__init__.py,sha256=JnM9oPfcZhBDLKo7_yLS-lIRQ1wXb1N9hKKQ-G7vYVk,127
17
- glymur/lib/openjp2.py,sha256=NxpAPXAsq9TsUGP7pi_RDVF1wNrqG4JDZz22ZVOdQfw,43921
18
- glymur/lib/tiff.py,sha256=VVsNDhn8bc8OeZltu7cwbJ1Ccr2LCQ0dLy1lrNK1_0Y,51009
19
- Glymur-0.12.9.post1.dist-info/LICENSE.txt,sha256=G9pvBgkJdPTtZqQmoRyIgAydtic1ZwWtOWBea9VMW7I,1077
20
- Glymur-0.12.9.post1.dist-info/METADATA,sha256=QwV-zCP5JtRWAPu2BNQzfCBWhuUBVggIPgc_xDkuVyE,1080
21
- Glymur-0.12.9.post1.dist-info/WHEEL,sha256=oiQVh_5PnQM0E3gPdiz09WCNmwiHDMaGer_elqB3coM,92
22
- Glymur-0.12.9.post1.dist-info/entry_points.txt,sha256=inzxpDbDDfIxtdXpCncAHdAdwJfjtXt3xKvIOsuZsG8,93
23
- Glymur-0.12.9.post1.dist-info/top_level.txt,sha256=D0SvtBUoPxOs40OTRW3l-kjGFHM6VrXS8yZPK5Fx2wY,7
24
- Glymur-0.12.9.post1.dist-info/RECORD,,