---On Fri, 18 May 2001 07:13:49 +0200,  Michael Nordstr�m said

> You added some code that attempts to detect the symptom of this
> problem, but I rather see that the bug itself is fixed, i.e. the
> parser should not include images larger than 64k.
>
> Is anyone taking a closer look at this problem in the parser?
> Bill? Dirk? Chris?

I took a look last night. Something like this??
ImageParser.py

@@ -54,6 +55,19 @@
         try:
             try:
                 self.convert_to_pnm(data, tmpfile)
+                pipe = os.popen("identify -ping " + tmpfile)
+                info = pipe.read()
+                pipe.close()
+                info = string.split(info) #info is now an array
+                info = string.split(info[1], 'x')
+                myheight = info[1]
+                myheight = string.split(myheight, '+')
+                size = int(info[0]) * int(myheight[0]) * bpp
+                if size > MAX_IMAGE_SIZE:    # 60000 * 8
+                    print "Image %s too large. (%d bits)" % (url, size)
+                    self._doc = None
+                    self._scaled = 0
+                    return
                 self._doc.set_data(self.convert_to_Tbmp(tmpfile))
             finally:
                 try: os.unlink(tmpfile)

Or should we somehow inform the viewer that the size was too big??
(Maybe return a text document that says [IMG too large for viewer]) ??

Unfortunatly, (in imageMagick at least) we have to convert to pnm and
(possibly) scale the image before we know how big it will be on the palm.

Suggestions/Ideas/Jeers ??

--re: Re: Plucker 1.1 problem with big image

                                 Chris
#include <stddisclaimer.h>
#include <win_slams.h>

[EMAIL PROTECTED]
Christopher R. Hawks Software Engineer
Syscon Plantstar a Division of Syscon International





Reply via email to