Skip to content

Commit

Permalink
Move method
Browse files Browse the repository at this point in the history
  • Loading branch information
jabriffa committed Jun 14, 2018
1 parent fefc56f commit 80b7385
Showing 1 changed file with 18 additions and 17 deletions.
35 changes: 18 additions & 17 deletions pyshared/jbtiff.py
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,24 @@ def write_float(data, fid, size, little_endian):
fid.write(buf)
return

# get tags with strip offset and length from IFD
@staticmethod
def get_strip_parameters(IFD):
tag_offset = None
tag_length = None
if 273 in IFD:
assert 279 in IFD
assert 513 not in IFD and 514 not in IFD
tag_offset = 273
tag_length = 279
if 513 in IFD:
assert 514 in IFD
assert 273 not in IFD and 279 not in IFD
tag_offset = 513
tag_length = 514
assert tag_offset and tag_length
return tag_offset, tag_length

## class methods

# get camera model from given IFD, if present
Expand Down Expand Up @@ -467,23 +485,6 @@ def read_directory(self, fid, ifd_offset, spans):
# return directory
return IFD

@staticmethod
def get_strip_parameters(IFD):
tag_offset = None
tag_length = None
if 273 in IFD:
assert 279 in IFD
assert 513 not in IFD and 514 not in IFD
tag_offset = 273
tag_length = 279
if 513 in IFD:
assert 514 in IFD
assert 273 not in IFD and 279 not in IFD
tag_offset = 513
tag_length = 514
assert tag_offset and tag_length
return tag_offset, tag_length

# initialize class from stream
def __init__(self, fid):
# keep track of range of bytes read
Expand Down

0 comments on commit 80b7385

Please sign in to comment.