mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-06-30 01:43:17 +03:00
Merge pull request #5956 from radarhere/spider
This commit is contained in:
commit
47bac9b6bb
|
@ -238,17 +238,18 @@ def makeSpiderHeader(im):
|
||||||
if 1024 % lenbyt != 0:
|
if 1024 % lenbyt != 0:
|
||||||
labrec += 1
|
labrec += 1
|
||||||
labbyt = labrec * lenbyt
|
labbyt = labrec * lenbyt
|
||||||
hdr = []
|
|
||||||
nvalues = int(labbyt / 4)
|
nvalues = int(labbyt / 4)
|
||||||
|
if nvalues < 23:
|
||||||
|
return []
|
||||||
|
|
||||||
|
hdr = []
|
||||||
for i in range(nvalues):
|
for i in range(nvalues):
|
||||||
hdr.append(0.0)
|
hdr.append(0.0)
|
||||||
|
|
||||||
if len(hdr) < 23:
|
|
||||||
return []
|
|
||||||
|
|
||||||
# NB these are Fortran indices
|
# NB these are Fortran indices
|
||||||
hdr[1] = 1.0 # nslice (=1 for an image)
|
hdr[1] = 1.0 # nslice (=1 for an image)
|
||||||
hdr[2] = float(nrow) # number of rows per slice
|
hdr[2] = float(nrow) # number of rows per slice
|
||||||
|
hdr[3] = float(nrow) # number of records in the image
|
||||||
hdr[5] = 1.0 # iform for 2D image
|
hdr[5] = 1.0 # iform for 2D image
|
||||||
hdr[12] = float(nsam) # number of pixels per line
|
hdr[12] = float(nsam) # number of pixels per line
|
||||||
hdr[13] = float(labrec) # number of records in file header
|
hdr[13] = float(labrec) # number of records in file header
|
||||||
|
@ -259,10 +260,7 @@ def makeSpiderHeader(im):
|
||||||
hdr = hdr[1:]
|
hdr = hdr[1:]
|
||||||
hdr.append(0.0)
|
hdr.append(0.0)
|
||||||
# pack binary data into a string
|
# pack binary data into a string
|
||||||
hdrstr = []
|
return [struct.pack("f", v) for v in hdr]
|
||||||
for v in hdr:
|
|
||||||
hdrstr.append(struct.pack("f", v))
|
|
||||||
return hdrstr
|
|
||||||
|
|
||||||
|
|
||||||
def _save(im, fp, filename):
|
def _save(im, fp, filename):
|
||||||
|
|
Loading…
Reference in New Issue
Block a user