[Git][debian-gis-team/glymur][master] 4 commits: New upstream version 0.10.0
Antonio Valentino (@antonio.valentino)
gitlab at salsa.debian.org
Sat Jun 18 07:40:24 BST 2022
Antonio Valentino pushed to branch master at Debian GIS Project / glymur
Commits:
cabe8d4b by Antonio Valentino at 2022-06-18T06:23:52+00:00
New upstream version 0.10.0
- - - - -
5a83be25 by Antonio Valentino at 2022-06-18T06:24:12+00:00
Update upstream source from tag 'upstream/0.10.0'
Update to upstream version '0.10.0'
with Debian dir 2f93502460f4ef8b6cd6028d1e166c6ba72794ed
- - - - -
9d79ea3e by Antonio Valentino at 2022-06-18T06:24:49+00:00
New upstream release
- - - - -
b1fa9e30 by Antonio Valentino at 2022-06-18T06:27:52+00:00
Set distribution to unstable
- - - - -
14 changed files:
- CHANGES.txt
- debian/changelog
- docs/source/conf.py
- + docs/source/whatsnew/0.10.0.rst
- docs/source/whatsnew/index.rst
- glymur/_tiff.py
- glymur/jp2box.py
- glymur/jp2k.py
- glymur/lib/openjp2.py
- glymur/version.py
- setup.cfg
- + tests/data/issue549.dat
- tests/test_jp2box_uuid.py
- tests/test_jp2k.py
Changes:
=====================================
CHANGES.txt
=====================================
@@ -1,3 +1,8 @@
+June 15, 2022 - v0.10.0
+ Allow parsing of Exif UUIDs missing the EXIF\00\00 lead-in
+ Add read support for additional Exif tags
+ Add support for TLM segment generation
+
March 23, 2022 - v0.9.9
Fix bug retrieving some TIFF tags on big endian systems
@@ -13,67 +18,67 @@ December 27, 2021 - v0.9.7
Add ndim, dtype properties
November 04, 2021 - v0.9.6
- Fix tiff support on windows.
- Update doc support for python 3.10.
+ Fix tiff support on windows
+ Update doc support for python 3.10
November 03, 2021 - v0.9.5
- Add support for generation of PLT markers.
- Add support for converting TIFFs to JPEG 2000.
+ Add support for generation of PLT markers
+ Add support for converting TIFFs to JPEG 2000
September 01, 2021 - v0.9.4
- Add support for writing images tile-by-tile.
- Add support for opj_set_decoded_components.
- Remove support for Python 3.6.
+ Add support for writing images tile-by-tile
+ Add support for opj_set_decoded_components
+ Remove support for Python 3.6
December 31, 2020 - v0.9.3
Qualify support on Python 3.9, OpenJPEG 2.4
Add support for multithreaded writes
June 30, 2020 - v0.9.2
- Update setup.py to include tests.
- Update gdal imports to stop DeprecationWarning.
+ Update setup.py to include tests
+ Update gdal imports to stop DeprecationWarning
June 30, 2020 - v0.9.2
- Update setup.py to include tests.
- Update gdal imports to stop DeprecationWarning.
+ Update setup.py to include tests
+ Update gdal imports to stop DeprecationWarning
January 15, 2020 - v0.9.1
Remove GDAL from setup.py requirements
January 14, 2020 - v0.9.0
- Removed support for python2.7.
- Fixed Cygwin support.
- Fixed appveyor builds, Travis-CI framework reworked.
- Some fragile tests removed.
+ Removed support for python2.7
+ Fixed Cygwin support
+ Fixed appveyor builds, Travis-CI framework reworked
+ Some fragile tests removed
November 15, 2019 - v0.8.19
- Qualify on Python 3.8.
+ Qualify on Python 3.8
April 24, 2019 - v0.8.18
- Fix geotiff UUID corner coordinate string representation.
- Improve warning and error messages.
- Correct improperly raised exception types.
- Remove build/test for Python 3.4 (EOL).
- Fix read-the-docs requirements.
+ Fix geotiff UUID corner coordinate string representation
+ Improve warning and error messages
+ Correct improperly raised exception types
+ Remove build/test for Python 3.4 (EOL)
+ Fix read-the-docs requirements
February 19, 2019 - v0.8.17
- Add support for ICC profile raw data.
- Fix parsing of negative resolution box exponents.
+ Add support for ICC profile raw data
+ Fix parsing of negative resolution box exponents
September 18, 2018 - v0.8.16
- Qualify on Python 3.7.
- Fix documentation typo.
+ Qualify on Python 3.7
+ Fix documentation typo
April 07, 2018 - v0.8.15
- Fix link to readthedocs.
- Fix for invalid progression order display.
+ Fix link to readthedocs
+ Fix for invalid progression order display
January 21, 2018 - v0.8.14
- Fix layers bug.
+ Fix layers bug
January 10, 2018 - v0.8.13
- Clarify PSNR usage.
- Add support for openjpeg threads.
+ Clarify PSNR usage
+ Add support for openjpeg threads
October 14, 2017 - v0.8.12
Qualify on OpenJPEG v2.3.0
@@ -81,19 +86,19 @@ October 14, 2017 - v0.8.12
August 15, 2017 - v0.8.11
Qualify on OpenJPEG v2.2.0
- State LTS plans.
+ State LTS plans
March 22, 2017 - v0.8.10
- Add pathlib support.
- Add appveyor to CI testing.
+ Add pathlib support
+ Add appveyor to CI testing
January 26, 2017 - v0.8.9
- Qualified on Python 3.6.
- Change travis-ci testing to use Anaconda.
+ Qualified on Python 3.6
+ Change travis-ci testing to use Anaconda
December 01, 2016 - v0.8.8
- Refactor test suite.
- Fix printing errors in case of bad colr box.
+ Refactor test suite
+ Fix printing errors in case of bad colr box
Fix tests on CentOS when seeing OpenJPEG 1.3
October 02, 2016 - v0.8.7
=====================================
debian/changelog
=====================================
@@ -1,3 +1,9 @@
+glymur (0.10.0-1) unstable; urgency=medium
+
+ * New upstream release.
+
+ -- Antonio Valentino <antonio.valentino at tiscali.it> Sat, 18 Jun 2022 06:27:29 +0000
+
glymur (0.9.9-1) unstable; urgency=medium
* New upstream release.
=====================================
docs/source/conf.py
=====================================
@@ -76,9 +76,9 @@ copyright = '2013-2022, John Evans'
# built documents.
#
# The short X.Y version.
-version = '0.9'
+version = '0.10'
# The full version, including alpha/beta/rc tags.
-release = '0.9.9'
+release = '0.10.0'
# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
=====================================
docs/source/whatsnew/0.10.0.rst
=====================================
@@ -0,0 +1,11 @@
+######################
+Changes in glymur 0.10
+######################
+
+*****************
+Changes in 0.10.0
+*****************
+
+ Allow parsing of Exif UUIDs missing the EXIF\00\00 lead-in
+ Add read support for additional Exif tags
+ Add support for TLM segment generation
=====================================
docs/source/whatsnew/index.rst
=====================================
@@ -8,6 +8,7 @@ These document the changes between minor (or major) versions of glymur.
.. toctree::
+ 0.10
0.9
0.8
0.7
=====================================
glymur/_tiff.py
=====================================
@@ -152,7 +152,14 @@ class Ifd(object):
msg = f'Unrecognized UUID box TIFF tag ({tag}).'
warnings.warn(msg, UserWarning)
tag_name = tag
- self.processed_ifd[tag_name] = value
+
+ if tag_name == 'ExifTag':
+ # There's an Exif IFD at the offset specified here.
+ ifd = ExifImageIfd(self.endian, self.read_buffer, value)
+ self.processed_ifd[tag_name] = ifd.processed_ifd
+ else:
+ # just a regular tag, treat it as a simple value
+ self.processed_ifd[tag_name] = value
class ExifImageIfd(Ifd):
@@ -274,7 +281,19 @@ class ExifImageIfd(Ifd):
34857: 'Interlace',
34858: 'TimeZoneOffset',
34859: 'SelfTimerMode',
+ 34864: 'SensitivityType',
+ 34865: 'StandardOutputSensitivity',
+ 34866: 'RecommendedExposureIndex',
+ 34867: 'ISOSpeed',
+ 34868: 'ISOSpeedLatitudeYYY',
+ 34869: 'ISOSpeedLatitudeZZZ',
+ 36864: 'ExifVersion',
+ 36880: 'OffsetTime',
+ 36881: 'OffsetTimeOriginal',
+ 36882: 'OffsetTimeDigitized',
36867: 'DateTimeOriginal',
+ 36867: 'DateTimeDigitized',
+ 37121: 'ComponentsConfiguration',
37122: 'CompressedBitsPerPixel',
37377: 'ShutterSpeedValue',
37378: 'ApertureValue',
@@ -299,13 +318,62 @@ class ExifImageIfd(Ifd):
37397: 'ExposureIndex',
37398: 'TIFFEPStandardID',
37399: 'SensingMethod',
+ 37500: 'MakerNote',
+ 37510: 'UserComment',
+ 37520: 'SubSecTime',
+ 37521: 'SubSecTimeOriginal',
+ 37522: 'SubSecTimeDigitized',
+ 37888: 'Temperature',
+ 37889: 'Humidity',
+ 37890: 'Pressure',
+ 37891: 'WaterDepth',
+ 37892: 'Acceleration',
+ 37893: 'CameraElevationAngle',
40091: 'XPTitle',
40092: 'XPComment',
40093: 'XPAuthor',
40094: 'XPKeywords',
40095: 'XPSubject',
+ 40960: 'FlashPixVersion',
+ 40961: 'ColorSpace',
+ 40962: 'PixelXDimension',
+ 40963: 'PixelYDimension',
+ 41483: 'FlashEnergy',
+ 41484: 'SpatialFrequencyResponse',
+ 41486: 'FocalPlaneXResolution',
+ 41487: 'FocalPlaneYResolution',
+ 41488: 'FocalPlaneResolutionUnit',
+ 41492: 'SubjectLocation',
+ 41493: 'ExposureIndex',
+ 41495: 'SensingMethod',
+ 41728: 'FileSource',
+ 41729: 'SceneType',
+ 41730: 'CFAPattern',
+ 41985: 'CustomRendered',
+ 41986: 'ExposureMode',
+ 41987: 'WhiteBalance',
+ 41988: 'DigitalZoomRatio',
+ 41989: 'FocalLengthIn35MMFilm',
+ 41990: 'SceneCaptureType',
+ 41991: 'GainControl',
+ 41992: 'Contrast',
+ 41993: 'Saturation',
+ 41994: 'Sharpness',
+ 41995: 'DeviceSettingDescription',
+ 41996: 'SubjectDistanceRange',
+ 42016: 'ImageUniqueID',
+ 42032: 'CameraOwnerName',
+ 42033: 'BodySerialNumber',
+ 42034: 'LensSpecification',
+ 42035: 'LensMake',
+ 42036: 'LensModel',
+ 42037: 'LensSerialNumber',
+ 42080: 'CompositeImage',
+ 42081: 'SourceImageNumberOfCompositeImage',
+ 42082: 'SourceExposureTimeOfCompositeImage',
42112: 'GDALMetadata',
42113: 'GDALNoData',
+ 42240: 'Gamma',
50341: 'PrintImageMatching',
50706: 'DNGVersion',
50707: 'DNGBackwardVersion',
=====================================
glymur/jp2box.py
=====================================
@@ -3389,8 +3389,21 @@ class UUIDBox(Jp2kBox):
elif self.uuid == _GEOTIFF_UUID:
self.data = tiff_header(self.raw_data)
elif self.uuid == _EXIF_UUID:
- # Cut off 'EXIF\0\0' part.
- self.data = tiff_header(self.raw_data[6:])
+ if self.raw_data[0:4].decode('utf-8').lower() == 'exif':
+ # Cut off 'EXIF\0\0' part.
+ payload = self.raw_data[6:]
+ self.data = tiff_header(payload)
+ elif self.raw_data[:2].decode('utf-8').lower() in ['ii', 'mm']:
+ # Missing the exif lead-in, take the data as-is.
+ payload = self.raw_data
+ self.data = tiff_header(payload)
+ else:
+ msg = (
+ 'A UUID that identified itself as an EXIF UUID could not '
+ 'be parsed.'
+ )
+ warnings.warn(msg)
+ self.data = None
else:
self.data = self.raw_data
@@ -3428,15 +3441,29 @@ class UUIDBox(Jp2kBox):
lst.append(text)
elif self.uuid == _EXIF_UUID:
s = io.StringIO()
- for tag in [
- 'JPEGTables', 'StripByteCounts', 'StripOffsets',
- 'TileOffsets', 'TileByteCounts'
- ]:
- if tag in self.data:
- self.data[tag] = '... skipped ...'
- pprint.pprint(self.data, stream=s, indent=4)
- text = f'UUID Data: {s.getvalue().rstrip()}'
- lst.append(text)
+
+ if self.data is None:
+ # If the UUID was malformed, just say so and go on. This
+ # should not be a showstopper.
+ text = 'UUID Data: Invalid Exif UUID'
+ lst.append(text)
+ else:
+ data_copy = self.data.copy()
+ for tag in [
+ 'JPEGTables', 'StripByteCounts', 'StripOffsets',
+ 'TileOffsets', 'TileByteCounts'
+ ]:
+ if tag in self.data:
+ data_copy[tag] = '... skipped ...'
+
+ if 'ExifTag' in data_copy:
+ for tag in ['MakerNote']:
+ if tag in data_copy['ExifTag']:
+ data_copy['ExifTag'][tag] = '... skipped ...'
+
+ pprint.pprint(data_copy, stream=s, indent=4)
+ text = f'UUID Data: {s.getvalue().rstrip()}'
+ lst.append(text)
elif self.uuid == _GEOTIFF_UUID:
txt = f'UUID Data: {self._print_geotiff()}'
lst.append(txt)
=====================================
glymur/jp2k.py
=====================================
@@ -99,7 +99,7 @@ class Jp2k(Jp2kBox):
cbsize=None, cinema2k=None, cinema4k=None, colorspace=None,
cratios=None, eph=None, grid_offset=None, irreversible=None, mct=None,
modesw=None, numres=None, plt=False, prog=None, psizes=None, psnr=None,
- sop=None, subsam=None,
+ sop=None, subsam=None, tlm=False
):
"""
Parameters
@@ -156,6 +156,8 @@ class Jp2k(Jp2kBox):
Subsampling factors (dy, dx).
tilesize : tuple, optional
Tile size in terms of (numrows, numcols), not (X, Y).
+ tlm : bool, optional
+ Generate TLM markers.
verbose : bool, optional
Print informational messages produced by the OpenJPEG library.
"""
@@ -189,6 +191,7 @@ class Jp2k(Jp2kBox):
self._sop = sop
self._subsam = subsam
self._tilesize = tilesize
+ self._tlm = tlm
self._shape = None
self._ndim = None
@@ -899,6 +902,9 @@ class Jp2k(Jp2kBox):
if self._plt:
opj2.encoder_set_extra_options(codec, plt=self._plt)
+ if self._tlm:
+ opj2.encoder_set_extra_options(codec, tlm=self._tlm)
+
strm = opj2.stream_create_default_file_stream(self.filename, False)
num_threads = get_option('lib.num_threads')
=====================================
glymur/lib/openjp2.py
=====================================
@@ -953,7 +953,7 @@ def image_tile_create(comptparms, clrspc):
return image
-def encoder_set_extra_options(codec, plt=False):
+def encoder_set_extra_options(codec, plt=False, tlm=False):
"""Specify extra options for the encoder.
Wraps the openjp2 library function opj_encoder_set_extra_options.
@@ -963,8 +963,10 @@ def encoder_set_extra_options(codec, plt=False):
codec: codec_t
The JPEG2000 codec to read.
plt : bool
- If True, PLT marker segments indicating the length of each packet in
- the tile-part header will be written.
+ If True, PLT segments indicating the length of each packet in the
+ tile-part header will be written.
+ tlm : bool
+ If True, TLM segments will be generated.
"""
ARGTYPES = [
CODEC_TYPE,
@@ -973,9 +975,13 @@ def encoder_set_extra_options(codec, plt=False):
OPENJP2.opj_encoder_set_extra_options.argtypes = ARGTYPES
OPENJP2.opj_encoder_set_extra_options.restype = check_error
- arr = (ctypes.c_char_p * 2)()
+ arr = (ctypes.c_char_p * 3)()
arr[0] = 'PLT=YES'.encode('utf-8') if plt else 'PLT=NO'.encode('utf-8')
- arr[1] = None
+ if version() >= '2.5.0':
+ arr[1] = 'TLM=YES'.encode('utf-8') if tlm else 'TLM=NO'.encode('utf-8')
+ arr[2] = None
+ else:
+ arr[1] = None
OPENJP2.opj_encoder_set_extra_options(codec, arr)
=====================================
glymur/version.py
=====================================
@@ -21,7 +21,7 @@ from .lib import tiff
# Do not change the format of this next line! Doing so risks breaking
# setup.py
-version = "0.9.9"
+version = "0.10.0"
version_tuple = parse(version).release
=====================================
setup.cfg
=====================================
@@ -1,6 +1,6 @@
[metadata]
name = Glymur
-version = 0.9.9
+version = 0.10.0
author = 'John Evans'
author_email = "John Evans" <john.g.evans.ne at gmail.com>
license = 'MIT'
=====================================
tests/data/issue549.dat
=====================================
Binary files /dev/null and b/tests/data/issue549.dat differ
=====================================
tests/test_jp2box_uuid.py
=====================================
@@ -197,6 +197,41 @@ class TestSuite(fixtures.TestCommon):
b.seek(0)
return b.read()
+ def test__read_exif_uuid_missing_exif00_lead_in(self):
+ """
+ SCENARIO: Parse a JpgTiffExif->Jp2 UUID that is missing the 'EXIF\0\0'
+ lead-in.
+
+ EXPECTED RESULT: Should not error out. Verify the UUID type. Verify
+ the existance of one of the "Exif.Photo" tags.
+ """
+ box_data = ir.read_binary('tests.data', 'issue549.dat')
+ bf = io.BytesIO(box_data)
+ box = UUIDBox.parse(bf, 0, len(box_data))
+
+ actual = box.uuid
+ expected = uuid.UUID(bytes=b'JpgTiffExif->JP2')
+ self.assertEqual(actual, expected)
+
+ self.assertEqual(box.data['ExifTag']['ExifVersion'], (48, 50, 51, 50))
+
+ def test__read_malformed_exif_uuid(self):
+ """
+ SCENARIO: Parse a JpgTiffExif->Jp2 UUID that is not only missing the
+ 'EXIF\0\0' lead-in, but even the TIFF header is malformed.
+
+ EXPECTED RESULT: RuntimeError
+ """
+ box_data = ir.read_binary('tests.data', 'issue549.dat')
+ bf = io.BytesIO(box_data[:16] + box_data[20:])
+ with warnings.catch_warnings():
+ warnings.simplefilter("ignore")
+ box = UUIDBox.parse(bf, 0, 37700)
+
+ actual = box.uuid
+ expected = uuid.UUID(bytes=b'JpgTiffExif->JP2')
+ self.assertEqual(actual, expected)
+
def test__printing__geotiff_uuid__xml_sidecar(self):
"""
SCENARIO: Print a geotiff UUID with XML sidecar file
=====================================
tests/test_jp2k.py
=====================================
@@ -1163,6 +1163,48 @@ class TestJp2k_write(fixtures.MetadataBase):
with self.assertRaises(RuntimeError):
Jp2k(self.temp_jp2_filename, **kwargs)
+ @unittest.skipIf(glymur.version.openjpeg_version < '2.5.0',
+ "Requires as least v2.5.0")
+ def test_tlm_yes(self):
+ """
+ SCENARIO: Use the tlm keyword.
+
+ EXPECTED RESULT: A TLM segment is detected.
+ """
+ kwargs = {
+ 'data': self.jp2_data,
+ 'tlm': True
+ }
+ j = Jp2k(self.temp_jp2_filename, **kwargs)
+
+ codestream = j.get_codestream(header_only=False)
+
+ at_least_one_tlm_segment = any(
+ isinstance(seg, glymur.codestream.TLMsegment)
+ for seg in codestream.segment
+ )
+ self.assertTrue(at_least_one_tlm_segment)
+
+ def test_tlm_no(self):
+ """
+ SCENARIO: Use the tlm keyword set to False
+
+ EXPECTED RESULT: A TLM segment not detected.
+ """
+ kwargs = {
+ 'data': self.jp2_data,
+ 'tlm': False
+ }
+ j = Jp2k(self.temp_jp2_filename, **kwargs)
+
+ codestream = j.get_codestream(header_only=False)
+
+ at_least_one_tlm_segment = any(
+ isinstance(seg, glymur.codestream.TLMsegment)
+ for seg in codestream.segment
+ )
+ self.assertFalse(at_least_one_tlm_segment)
+
@unittest.skipIf(
not fixtures.HAVE_SCIKIT_IMAGE, fixtures.HAVE_SCIKIT_IMAGE_MSG
)
View it on GitLab: https://salsa.debian.org/debian-gis-team/glymur/-/compare/bb905696b372c527049d438b0c40b14bee28320c...b1fa9e301dfa1b79bb71e4bd5b04cc8bbc1507f3
--
View it on GitLab: https://salsa.debian.org/debian-gis-team/glymur/-/compare/bb905696b372c527049d438b0c40b14bee28320c...b1fa9e301dfa1b79bb71e4bd5b04cc8bbc1507f3
You're receiving this email because of your account on salsa.debian.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/pkg-grass-devel/attachments/20220618/2367720b/attachment-0001.htm>
More information about the Pkg-grass-devel
mailing list