Permalink
Browse files

* Fixed another issue in gif plugin while using one of the modules in

Scripts/;

* Fixed Scripts/explode.py and Scripts/gifmaker;
  • Loading branch information...
1 parent 79b7d80 commit a2e45665216f1ffb7b9bcc749879f3f1b2f1b396 gpolo committed Dec 31, 2008
Showing with 14 additions and 14 deletions.
  1. +4 −4 PIL/GifImagePlugin.py
  2. +9 −7 Scripts/explode.py
  3. +1 −3 Scripts/gifmaker.py
@@ -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
View
@@ -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:
@@ -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))
@@ -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
View
@@ -40,8 +40,6 @@
#
import Image, ImageChops
-import string
-
from GifImagePlugin import getheader, getdata
# --------------------------------------------------------------------
@@ -100,7 +98,7 @@ def makedelta(fp, sequence):
frames = frames + 1
- fp.write(";")
+ fp.write(b";")
return frames

0 comments on commit a2e4566

Please sign in to comment.