---On Wed, 6 Jun 2001 14:23:13 PDT, Bill Janssen said
> I've checked in changes to the ImageParser.py module and
> PalmImagePlugin.py that support the 16-bit color standard. Slow as
> heck, but it works. I'm working on the netpbm version now.
>
Cool!!
Anything on protecting the user from creating images the viewer can't
show because of size? I hacked up a test, but, it only checks after the
image has been created. We should check first.
Add this function:
MAX_IMAGE_SIZE = 60000 * 8 # 60k * 8 bits
def check_size(data):
(wide, high, deep) = struct.unpack(">HHxxxxB", data[:9])
size = high * wide * deep
if size > MAX_IMAGE_SIZE:
print "Image %s too large. (%d bits)" % (url, size)
return 1
return 0
and call it in the parsing:
try:
try:
self.convert_to_pnm(data, tmpfile)
data = self.convert_to_Tbmp(tmpfile)
+ if check_size(data[:9]):
+ self._doc = None
+ self._scaled = 0
+ else:
self._doc.set_data(data)
finally:
try: os.unlink(tmpfile)
except: pass
except RuntimeError:
# This we pass through...
raise
except:
raise RuntimeError, "Error while converting image (%s)." % self._url
--re: PalmOS 4.0 16-bit color now supported with PIL
Chris
#include <stddisclaimer.h>
#include <win_slams.h>
[EMAIL PROTECTED]
Christopher R. Hawks Software Engineer
Syscon Plantstar a Division of Syscon International