我们从Python开源项目中,提取了以下33个代码示例,用于说明如何使用PIL.Image.point()。
def point(self, im): return self.apply(im)
def getProfileInfo(profile): """ (pyCMS) Gets the internal product information for the given profile. If profile isn't a valid CmsProfile object or filename to a profile, a PyCMSError is raised. If an error occurs while trying to obtain the info tag, a PyCMSError is raised Use this function to obtain the information stored in the profile's info tag. This often contains details about the profile, and how it was created, as supplied by the creator. :param profile: EITHER a valid CmsProfile object, OR a string of the filename of an ICC profile. :returns: A string containing the internal profile information stored in an ICC tag. :exception PyCMSError: """ try: if not isinstance(profile, ImageCmsProfile): profile = ImageCmsProfile(profile) # add an extra newline to preserve pyCMS compatibility # Python, not C. the white point bits weren't working well, # so skipping. # // info was description \r\n\r\n copyright \r\n\r\n K007 tag \r\n\r\n whitepoint description = profile.profile.product_description cpright = profile.profile.product_copyright arr = [] for elt in (description, cpright): if elt: arr.append(elt) return "\r\n\r\n".join(arr) + "\r\n\r\n" except (AttributeError, IOError, TypeError, ValueError) as v: raise PyCMSError(v)
def img_preparation(img): img = img.convert('L') sharpness = ImageEnhance.Contrast(img) sharp_img = sharpness.enhance(2.0) two_value_out = sharp_img.point(table, '1') return two_value_out
def createProfile(colorSpace, colorTemp=-1): """ (pyCMS) Creates a profile. If colorSpace not in ["LAB", "XYZ", "sRGB"], a PyCMSError is raised If using LAB and colorTemp != a positive integer, a PyCMSError is raised. If an error occurs while creating the profile, a PyCMSError is raised. Use this function to create common profiles on-the-fly instead of having to supply a profile on disk and knowing the path to it. It returns a normal CmsProfile object that can be passed to ImageCms.buildTransformFromOpenProfiles() to create a transform to apply to images. :param colorSpace: String, the color space of the profile you wish to create. Currently only "LAB", "XYZ", and "sRGB" are supported. :param colorTemp: Positive integer for the white point for the profile, in degrees Kelvin (i.e. 5000, 6500, 9600, etc.). The default is for D50 illuminant if omitted (5000k). colorTemp is ONLY applied to LAB profiles, and is ignored for XYZ and sRGB. :returns: A CmsProfile class object :exception PyCMSError: """ if colorSpace not in ["LAB", "XYZ", "sRGB"]: raise PyCMSError( "Color space not supported for on-the-fly profile creation (%s)" % colorSpace) if colorSpace == "LAB": try: colorTemp = float(colorTemp) except: raise PyCMSError( "Color temperature must be numeric, \"%s\" not valid" % colorTemp) try: return core.createProfile(colorSpace, colorTemp) except (TypeError, ValueError) as v: raise PyCMSError(v)