Changeset 1397


Ignore:
Timestamp:
Jun 26, 2014 1:23:03 PM (7 years ago)
Author:
toby
Message:

Allow use of Image from pillow in place of PIL

Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASII.py

    r1391 r1397  
    33893389        print "Image (PIL):",Image.VERSION
    33903390    except ImportError:
    3391         print "Image module not present; Note that PIL (Python Imaging Library) is needed for some image formats."
     3391        try:
     3392            from PIL import Image
     3393            print "pillow:     ",Image.VERSION
     3394        except ImportError:
     3395            print "Image module not present; Note that PIL (Python Imaging Library) or pillow is needed for some image operations"
    33923396    try:
    33933397        import mkl
  • trunk/GSASIIIO.py

    r1386 r1397  
    526526    '''
    527527    import struct as st
    528     import Image as Im
     528    try:
     529        import Image as Im
     530    except ImportError:
     531        try:
     532            from PIL import Image as Im
     533        except ImportError:
     534            print "PIL/pillow Image module not present. TIFs cannot be read without this"
     535            raise Exception("PIL/pillow Image module not found")
    529536    import array as ar
    530537    import ReadMarCCDFrame as rmf
  • trunk/GSASIIplot.py

    r1396 r1397  
    33013301   
    33023302    def OnKeyBox(event):
    3303         import Image
    33043303#        Draw()                          #make sure plot is fresh!!
    33053304        mode = cb.GetValue()
    33063305        if mode in ['jpeg','bmp','tiff',]:
     3306            try:
     3307                import Image as Im
     3308            except ImportError:
     3309                try:
     3310                    from PIL import Image as Im
     3311                except ImportError:
     3312                    print "PIL/pillow Image module not present. Cannot save images without this"
     3313                    raise Exception("PIL/pillow Image module not found")
    33073314            Fname = os.path.join(Mydir,generalData['Name']+'.'+mode)
    33083315            size = Page.canvas.GetSize()
Note: See TracChangeset for help on using the changeset viewer.