コード例 #1
0
ファイル: BadgePaster.py プロジェクト: dvirsky/badger
 def __init__(self, imageURL, badgeURL):
     '''
     Constructor
     '''
     self.imageURL = imageURL
     self.badgeURL = badgeURL
     self.image = None
     self.badge = None
     Image.init()
コード例 #2
0
def install_Image(lis):
    import Image
    # PIL uses lazy initialization.
    # you candecide if you want only the
    # default stuff:
    Image.preinit()
    # or just everything:
    Image.init()
    import sys
    for name in sys.modules:
        if name[-11:] == "ImagePlugin":
            lis.append(name)
コード例 #3
0
ファイル: hook-PIL.Image.py プロジェクト: pombreda/comp304
def install_Image(lis):
    import Image
    # PIL uses lazy initialization.
    # you candecide if you want only the
    # default stuff:
    Image.preinit()
    # or just everything:
    Image.init()
    import sys
    for name in sys.modules:
        if name[-11:] == "ImagePlugin":
            lis.append(name)
コード例 #4
0
ファイル: pilexport.py プロジェクト: KDE/calligra-history
    def __init__(self, scriptaction):
        """ The constructor called if the Exporter class got instanciated and
        imports our needed modules to be sure there are available. """

        try:
            import Kross
        except:
            raise "Failed to import the Kross module."

        try:
            import Krita
        except:
            raise "Failed to import the Krita module."

        try:
            import Image, ImageFile
            Image.init()
        except:
            raise "Failed to import the Python Imaging Library (PIL)."

        self.scriptaction = scriptaction
        self.showDialog()
コード例 #5
0
ファイル: loadimagesnew.py プロジェクト: jsilter/CellProfiler
    has_bioformats = True
except:
    has_bioformats = False
import Image as PILImage
import TiffImagePlugin as TIFF
import cellprofiler.dib
import matplotlib.image
import scipy.io.matlab.mio

import cellprofiler.cpmodule as cpmodule
import cellprofiler.cpimage as cpimage
import cellprofiler.measurements as cpm
import cellprofiler.preferences as preferences
import cellprofiler.settings as cps

PILImage.init()

FF_INDIVIDUAL_IMAGES = 'individual images'
FF_STK_MOVIES = 'stk movies'
FF_AVI_MOVIES = 'avi movies'
FF_OTHER_MOVIES = 'tif,tiff,flex movies'
if has_bioformats:
    FF_CHOICES = [FF_INDIVIDUAL_IMAGES, FF_STK_MOVIES, FF_AVI_MOVIES, FF_OTHER_MOVIES]
else:
    FF_CHOICES = [FF_INDIVIDUAL_IMAGES, FF_STK_MOVIES]

# The metadata choices:
# M_NONE - don't extract metadata
# M_FILE_NAME - extract metadata from the file name
# M_PATH_NAME - extract metadata from the subdirectory path
# M_BOTH      - extract metadata from both the file name and path
コード例 #6
0
ファイル: pilprint.py プロジェクト: bushuhui/pyKanjiDict
    print "  -P <printer>  same as -p but use given printer"
    sys.exit(1)

try:
    opt, argv = getopt.getopt(sys.argv[1:], "cdpP:")
except getopt.error, v:
    print v
    sys.exit(1)

printer = None # print to stdout
monochrome = 1 # reduce file size for most common case

for o, a in opt:
    if o == "-d":
        # debug: show available drivers
        Image.init()
        print Image.ID
        sys.exit(1)
    elif o == "-c":
        # colour printer
        monochrome = 0
    elif o == "-p":
        # default printer channel
        printer = "lpr"
    elif o == "-P":
        # printer channel
        printer = "lpr -P%s" % a

for file in argv:
    try:
コード例 #7
0
ファイル: pilprint.py プロジェクト: lisarosalina/App
    print "  -P <printer>  same as -p but use given printer"
    sys.exit(1)

try:
    opt, argv = getopt.getopt(sys.argv[1:], "cdpP:")
except getopt.error, v:
    print v
    sys.exit(1)

printer = None  # print to stdout
monochrome = 1  # reduce file size for most common case

for o, a in opt:
    if o == "-d":
        # debug: show available drivers
        Image.init()
        print Image.ID
        sys.exit(1)
    elif o == "-c":
        # colour printer
        monochrome = 0
    elif o == "-p":
        # default printer channel
        printer = "lpr"
    elif o == "-P":
        # printer channel
        printer = "lpr -P%s" % a

for file in argv:
    try:
コード例 #8
0
ファイル: img_pil.py プロジェクト: 13768324554/kivy
 def extensions():
     '''Return accepted extensions for this loader'''
     PILImage.init()
     return tuple((ext_with_dot[1:] for ext_with_dot in PILImage.EXTENSION))
コード例 #9
0
ファイル: img_pil.py プロジェクト: babatana/kivy-project
 def extensions():
     '''Return accepted extensions for this loader'''
     PILImage.init()
     return tuple((ext_with_dot[1:] for ext_with_dot in PILImage.EXTENSION))
コード例 #10
0
ファイル: image.py プロジェクト: jsgf/imagestore3
    p = Picture(sha1hash = sha1hash,
                md5hash = md5hash,
                width=width, height=height,
                datasize = len(data),
                mimetype = mimetype,
                owner = owner,
                visibility = visibility,
                camera = camera,
                created_time = created_time,
                created_time_us = created_time.microsecond,
                orientation = orientation,
                **kwargs)
    p.save()

    try:
        m = Media.store(p.mediakey('orig'), data, sha1hash)
    except Exception, e:
        p.delete()
        raise e

    if tags:
        p.addtags(tags)

    return p

PIL.init()                            # load all codecs
for t in [ v for v in PIL.MIME.values() if v.startswith('image/') ]:
    register_importer(t, still_image_importer)

__all__ = [ 'importer', 'ImageProcessor' ]