[Image-SIG] PILing tiff G3 files?

Hans-Peter Jansen hpj@urpla.net
Mon, 11 Feb 2002 19:11:50 +0100


On Monday, 11. February 2002 18:12, Stephan Richter wrote:
> On Monday, 11. February 2002 15:07, Hans-Peter Jansen wrote:

> >I'm currently evaluating for a wxPython based fax viewer/manager project 
> >for fax G3 tiffs, which are typically generated by hylafax.

> >I've found the Image Squeezer on http://starship.python.net/jjkunce/
> >as a basic example, how to mix wxPython and PIL, where I fall over this:
> >When loading a fax tiff, im.mode is set to "1", and trying to convert it
> >to RGB results in:

> >IOError: decoder group3 not available

> >Is there any chance, that PIL supports this decoder soon, or do
> >I need to look for other ways to get around this?
>
> Well, I asked the question about 2 years ago and it comes up frequently. I
> guess noone with the necessary cash or knowledge has been able to write the
> driver.

Bad news!

Well, I dived into this a bit deeper this afternoon, and found a
workaround, because wxImage was able to decode the G3 stuff:

        if img1.format == "TIFF" and img1.mode == "1":
            # Fax G3 tiff
            img = wxImage(self.srcpath, wxBITMAP_TYPE_TIF)
            bm = img.ConvertToBitmap()
            imgsize = bm.GetWidth(), bm.GetHeight()
            img1 = Image.fromstring("RGB", imgsize, img.GetData())

Unfortunately, I ran right across the next problems:

wxImage ignores any subsequent pages of the fax tiff. Does some
enlighted wxMind know, how do I get all images/pages out of this kind
of tiff's?

Now, I stick in the process of getting the scaling of low resolution 
faxes right (with different V/H resolutions). I guess, I've to double 
every scanline of them :()

> Regards,
> Stephan

Cheers,
  Hans-Peter