Skip to content

Commit

Permalink
* Fixed another issue in gif plugin while using one of the modules in
Browse files Browse the repository at this point in the history
Scripts/;

* Fixed Scripts/explode.py and Scripts/gifmaker;
  • Loading branch information
gpolo committed Dec 31, 2008
1 parent 79b7d80 commit a2e4566
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 14 deletions.
8 changes: 4 additions & 4 deletions PIL/GifImagePlugin.py
Expand Up @@ -372,17 +372,17 @@ def write(self, data):
im.encoderinfo = params

# local image header
fp.write("," +
fp.write(b"," +
o16(offset[0]) + # offset
o16(offset[1]) +
o16(im.size[0]) + # size
o16(im.size[1]) +
chr(0) + # flags
chr(8)) # bits
bytes((0, # flags
8))) # bits

ImageFile._save(im, fp, [("gif", (0,0)+im.size, 0, RAWMODE[im.mode])])

fp.write("\0") # end of image data
fp.write(b"\0") # end of image data

finally:
del im.encoderinfo
Expand Down
16 changes: 9 additions & 7 deletions Scripts/explode.py
Expand Up @@ -5,8 +5,10 @@
# split an animation into a number of frame files
#

import os
import sys

import Image
import os, string, sys

class Interval:

Expand All @@ -18,18 +20,18 @@ def setinterval(self, interval):

self.hilo = []

for s in string.split(interval, ","):
if not string.strip(s):
for s in interval.split(","):
if not s.strip():
continue
try:
v = string.atoi(s)
v = int(s)
if v < 0:
lo, hi = 0, -v
else:
lo = hi = v
except ValueError:
i = string.find(s, "-")
lo, hi = string.atoi(s[:i]), string.atoi(s[i+1:])
i = s.find("-")
lo, hi = int(s[:i]), int(s[i+1:])

self.hilo.append((hi, lo))

Expand Down Expand Up @@ -69,7 +71,7 @@ def __getitem__(self, index):
infile = sys.argv[1]
outfile = sys.argv[2]

frames = Interval(string.join(sys.argv[3:], ","))
frames = Interval(",".join(sys.argv[3:]))

try:
# check if outfile contains a placeholder
Expand Down
4 changes: 1 addition & 3 deletions Scripts/gifmaker.py
Expand Up @@ -40,8 +40,6 @@
#

import Image, ImageChops
import string

from GifImagePlugin import getheader, getdata

# --------------------------------------------------------------------
Expand Down Expand Up @@ -100,7 +98,7 @@ def makedelta(fp, sequence):

frames = frames + 1

fp.write(";")
fp.write(b";")

return frames

Expand Down

0 comments on commit a2e4566

Please sign in to comment.