[-]
[+]
|
Changed |
_service:tar_git:harbour-simplecrop.spec
|
|
[-]
[+]
|
Changed |
_service
^
|
@@ -1,12 +1,8 @@
<services>
- <service name="webhook">
- <param name="repourl">https://github.com/poetaster/harbour-simplecrop.git</param>
- <param name="branch">master</param>
- </service>
<service name="tar_git">
<param name="url">https://github.com/poetaster/harbour-simplecrop.git</param>
<param name="branch">main</param>
- <param name="revision"/>
+ <param name="revision">v1.0-2</param>
<param name="token"/>
<param name="debian">N</param>
<param name="dumb">N</param>
|
[-]
[+]
|
Deleted |
_service:tar_git:harbour-simplecrop-1.0+main.20210420100251.4.g6bfb428.tar.bz2/lib/arm64/PIL/BdfFontFile.py
^
|
@@ -1,110 +0,0 @@
-#
-# The Python Imaging Library
-# $Id$
-#
-# bitmap distribution font (bdf) file parser
-#
-# history:
-# 1996-05-16 fl created (as bdf2pil)
-# 1997-08-25 fl converted to FontFile driver
-# 2001-05-25 fl removed bogus __init__ call
-# 2002-11-20 fl robustification (from Kevin Cazabon, Dmitry Vasiliev)
-# 2003-04-22 fl more robustification (from Graham Dumpleton)
-#
-# Copyright (c) 1997-2003 by Secret Labs AB.
-# Copyright (c) 1997-2003 by Fredrik Lundh.
-#
-# See the README file for information on usage and redistribution.
-#
-
-"""
-Parse X Bitmap Distribution Format (BDF)
-"""
-
-
-from . import FontFile, Image
-
-bdf_slant = {
- "R": "Roman",
- "I": "Italic",
- "O": "Oblique",
- "RI": "Reverse Italic",
- "RO": "Reverse Oblique",
- "OT": "Other",
-}
-
-bdf_spacing = {"P": "Proportional", "M": "Monospaced", "C": "Cell"}
-
-
-def bdf_char(f):
- # skip to STARTCHAR
- while True:
- s = f.readline()
- if not s:
- return None
- if s[:9] == b"STARTCHAR":
- break
- id = s[9:].strip().decode("ascii")
-
- # load symbol properties
- props = {}
- while True:
- s = f.readline()
- if not s or s[:6] == b"BITMAP":
- break
- i = s.find(b" ")
- props[s[:i].decode("ascii")] = s[i + 1 : -1].decode("ascii")
-
- # load bitmap
- bitmap = []
- while True:
- s = f.readline()
- if not s or s[:7] == b"ENDCHAR":
- break
- bitmap.append(s[:-1])
- bitmap = b"".join(bitmap)
-
- [x, y, l, d] = [int(p) for p in props["BBX"].split()]
- [dx, dy] = [int(p) for p in props["DWIDTH"].split()]
-
- bbox = (dx, dy), (l, -d - y, x + l, -d), (0, 0, x, y)
-
- try:
- im = Image.frombytes("1", (x, y), bitmap, "hex", "1")
- except ValueError:
- # deal with zero-width characters
- im = Image.new("1", (x, y))
-
- return id, int(props["ENCODING"]), bbox, im
-
-
-class BdfFontFile(FontFile.FontFile):
- """Font file plugin for the X11 BDF format."""
-
- def __init__(self, fp):
- super().__init__()
-
- s = fp.readline()
- if s[:13] != b"STARTFONT 2.1":
- raise SyntaxError("not a valid BDF file")
-
- props = {}
- comments = []
-
- while True:
- s = fp.readline()
- if not s or s[:13] == b"ENDPROPERTIES":
- break
- i = s.find(b" ")
- props[s[:i].decode("ascii")] = s[i + 1 : -1].decode("ascii")
- if s[:i] in [b"COMMENT", b"COPYRIGHT"]:
- if s.find(b"LogicalFontDescription") < 0:
- comments.append(s[i + 1 : -1].decode("ascii"))
-
- while True:
- c = bdf_char(fp)
- if not c:
- break
- id, ch, (xy, dst, src), im = c
- if 0 <= ch < len(self.glyph):
- self.glyph[ch] = xy, dst, src, im
|
[-]
[+]
|
Deleted |
_service:tar_git:harbour-simplecrop-1.0+main.20210420100251.4.g6bfb428.tar.bz2/lib/arm64/PIL/BlpImagePlugin.py
^
|
@@ -1,420 +0,0 @@
-"""
-Blizzard Mipmap Format (.blp)
-Jerome Leclanche <jerome@leclan.ch>
-
-The contents of this file are hereby released in the public domain (CC0)
-Full text of the CC0 license:
- https://creativecommons.org/publicdomain/zero/1.0/
-
-BLP1 files, used mostly in Warcraft III, are not fully supported.
-All types of BLP2 files used in World of Warcraft are supported.
-
-The BLP file structure consists of a header, up to 16 mipmaps of the
-texture
-
-Texture sizes must be powers of two, though the two dimensions do
-not have to be equal; 512x256 is valid, but 512x200 is not.
-The first mipmap (mipmap #0) is the full size image; each subsequent
-mipmap halves both dimensions. The final mipmap should be 1x1.
-
-BLP files come in many different flavours:
-* JPEG-compressed (type == 0) - only supported for BLP1.
-* RAW images (type == 1, encoding == 1). Each mipmap is stored as an
- array of 8-bit values, one per pixel, left to right, top to bottom.
- Each value is an index to the palette.
-* DXT-compressed (type == 1, encoding == 2):
-- DXT1 compression is used if alpha_encoding == 0.
- - An additional alpha bit is used if alpha_depth == 1.
- - DXT3 compression is used if alpha_encoding == 1.
- - DXT5 compression is used if alpha_encoding == 7.
-"""
-
-import struct
-from io import BytesIO
-
-from . import Image, ImageFile
-
-BLP_FORMAT_JPEG = 0
-
-BLP_ENCODING_UNCOMPRESSED = 1
-BLP_ENCODING_DXT = 2
-BLP_ENCODING_UNCOMPRESSED_RAW_BGRA = 3
-
-BLP_ALPHA_ENCODING_DXT1 = 0
-BLP_ALPHA_ENCODING_DXT3 = 1
-BLP_ALPHA_ENCODING_DXT5 = 7
-
-
-def unpack_565(i):
- return (((i >> 11) & 0x1F) << 3, ((i >> 5) & 0x3F) << 2, (i & 0x1F) << 3)
-
-
-def decode_dxt1(data, alpha=False):
- """
- input: one "row" of data (i.e. will produce 4*width pixels)
- """
-
- blocks = len(data) // 8 # number of blocks in row
- ret = (bytearray(), bytearray(), bytearray(), bytearray())
-
- for block in range(blocks):
- # Decode next 8-byte block.
- idx = block * 8
- color0, color1, bits = struct.unpack_from("<HHI", data, idx)
-
- r0, g0, b0 = unpack_565(color0)
- r1, g1, b1 = unpack_565(color1)
-
- # Decode this block into 4x4 pixels
- # Accumulate the results onto our 4 row accumulators
- for j in range(4):
- for i in range(4):
- # get next control op and generate a pixel
-
- control = bits & 3
- bits = bits >> 2
-
- a = 0xFF
- if control == 0:
- r, g, b = r0, g0, b0
- elif control == 1:
- r, g, b = r1, g1, b1
- elif control == 2:
- if color0 > color1:
- r = (2 * r0 + r1) // 3
- g = (2 * g0 + g1) // 3
- b = (2 * b0 + b1) // 3
- else:
- r = (r0 + r1) // 2
- g = (g0 + g1) // 2
- b = (b0 + b1) // 2
- elif control == 3:
- if color0 > color1:
- r = (2 * r1 + r0) // 3
- g = (2 * g1 + g0) // 3
- b = (2 * b1 + b0) // 3
- else:
- r, g, b, a = 0, 0, 0, 0
-
- if alpha:
- ret[j].extend([r, g, b, a])
- else:
- ret[j].extend([r, g, b])
-
- return ret
-
-
-def decode_dxt3(data):
- """
- input: one "row" of data (i.e. will produce 4*width pixels)
- """
-
- blocks = len(data) // 16 # number of blocks in row
- ret = (bytearray(), bytearray(), bytearray(), bytearray())
-
- for block in range(blocks):
- idx = block * 16
- block = data[idx : idx + 16]
- # Decode next 16-byte block.
- bits = struct.unpack_from("<8B", block)
- color0, color1 = struct.unpack_from("<HH", block, 8)
-
- (code,) = struct.unpack_from("<I", block, 12)
-
- r0, g0, b0 = unpack_565(color0)
- r1, g1, b1 = unpack_565(color1)
-
- for j in range(4):
- high = False # Do we want the higher bits?
- for i in range(4):
- alphacode_index = (4 * j + i) // 2
- a = bits[alphacode_index]
- if high:
- high = False
- a >>= 4
- else:
- high = True
- a &= 0xF
- a *= 17 # We get a value between 0 and 15
-
- color_code = (code >> 2 * (4 * j + i)) & 0x03
-
- if color_code == 0:
- r, g, b = r0, g0, b0
- elif color_code == 1:
- r, g, b = r1, g1, b1
- elif color_code == 2:
- r = (2 * r0 + r1) // 3
- g = (2 * g0 + g1) // 3
- b = (2 * b0 + b1) // 3
- elif color_code == 3:
- r = (2 * r1 + r0) // 3
- g = (2 * g1 + g0) // 3
- b = (2 * b1 + b0) // 3
-
- ret[j].extend([r, g, b, a])
-
- return ret
-
-
-def decode_dxt5(data):
- """
- input: one "row" of data (i.e. will produce 4 * width pixels)
- """
-
- blocks = len(data) // 16 # number of blocks in row
- ret = (bytearray(), bytearray(), bytearray(), bytearray())
-
- for block in range(blocks):
- idx = block * 16
- block = data[idx : idx + 16]
- # Decode next 16-byte block.
- a0, a1 = struct.unpack_from("<BB", block)
-
- bits = struct.unpack_from("<6B", block, 2)
- alphacode1 = bits[2] | (bits[3] << 8) | (bits[4] << 16) | (bits[5] << 24)
- alphacode2 = bits[0] | (bits[1] << 8)
-
- color0, color1 = struct.unpack_from("<HH", block, 8)
-
- (code,) = struct.unpack_from("<I", block, 12)
-
- r0, g0, b0 = unpack_565(color0)
- r1, g1, b1 = unpack_565(color1)
-
- for j in range(4):
- for i in range(4):
- # get next control op and generate a pixel
- alphacode_index = 3 * (4 * j + i)
-
- if alphacode_index <= 12:
- alphacode = (alphacode2 >> alphacode_index) & 0x07
- elif alphacode_index == 15:
- alphacode = (alphacode2 >> 15) | ((alphacode1 << 1) & 0x06)
- else: # alphacode_index >= 18 and alphacode_index <= 45
- alphacode = (alphacode1 >> (alphacode_index - 16)) & 0x07
-
- if alphacode == 0:
- a = a0
- elif alphacode == 1:
|
[-]
[+]
|
Deleted |
_service:tar_git:harbour-simplecrop-1.0+main.20210420100251.4.g6bfb428.tar.bz2/lib/arm64/PIL/BmpImagePlugin.py
^
|
@@ -1,380 +0,0 @@
-#
-# The Python Imaging Library.
-# $Id$
-#
-# BMP file handler
-#
-# Windows (and OS/2) native bitmap storage format.
-#
-# history:
-# 1995-09-01 fl Created
-# 1996-04-30 fl Added save
-# 1997-08-27 fl Fixed save of 1-bit images
-# 1998-03-06 fl Load P images as L where possible
-# 1998-07-03 fl Load P images as 1 where possible
-# 1998-12-29 fl Handle small palettes
-# 2002-12-30 fl Fixed load of 1-bit palette images
-# 2003-04-21 fl Fixed load of 1-bit monochrome images
-# 2003-04-23 fl Added limited support for BI_BITFIELDS compression
-#
-# Copyright (c) 1997-2003 by Secret Labs AB
-# Copyright (c) 1995-2003 by Fredrik Lundh
-#
-# See the README file for information on usage and redistribution.
-#
-
-
-from . import Image, ImageFile, ImagePalette
-from ._binary import i8, i16le as i16, i32le as i32, o8, o16le as o16, o32le as o32
-
-#
-# --------------------------------------------------------------------
-# Read BMP file
-
-BIT2MODE = {
- # bits => mode, rawmode
- 1: ("P", "P;1"),
- 4: ("P", "P;4"),
- 8: ("P", "P"),
- 16: ("RGB", "BGR;15"),
- 24: ("RGB", "BGR"),
- 32: ("RGB", "BGRX"),
-}
-
-
-def _accept(prefix):
- return prefix[:2] == b"BM"
-
-
-def _dib_accept(prefix):
- return i32(prefix[:4]) in [12, 40, 64, 108, 124]
-
-
-# =============================================================================
-# Image plugin for the Windows BMP format.
-# =============================================================================
-class BmpImageFile(ImageFile.ImageFile):
- """ Image plugin for the Windows Bitmap format (BMP) """
-
- # ------------------------------------------------------------- Description
- format_description = "Windows Bitmap"
- format = "BMP"
-
- # -------------------------------------------------- BMP Compression values
- COMPRESSIONS = {"RAW": 0, "RLE8": 1, "RLE4": 2, "BITFIELDS": 3, "JPEG": 4, "PNG": 5}
- for k, v in COMPRESSIONS.items():
- vars()[k] = v
-
- def _bitmap(self, header=0, offset=0):
- """ Read relevant info about the BMP """
- read, seek = self.fp.read, self.fp.seek
- if header:
- seek(header)
- file_info = {}
- # read bmp header size @offset 14 (this is part of the header size)
- file_info["header_size"] = i32(read(4))
- file_info["direction"] = -1
-
- # -------------------- If requested, read header at a specific position
- # read the rest of the bmp header, without its size
- header_data = ImageFile._safe_read(self.fp, file_info["header_size"] - 4)
-
- # -------------------------------------------------- IBM OS/2 Bitmap v1
- # ----- This format has different offsets because of width/height types
- if file_info["header_size"] == 12:
- file_info["width"] = i16(header_data[0:2])
- file_info["height"] = i16(header_data[2:4])
- file_info["planes"] = i16(header_data[4:6])
- file_info["bits"] = i16(header_data[6:8])
- file_info["compression"] = self.RAW
- file_info["palette_padding"] = 3
-
- # --------------------------------------------- Windows Bitmap v2 to v5
- # v3, OS/2 v2, v4, v5
- elif file_info["header_size"] in (40, 64, 108, 124):
- file_info["y_flip"] = i8(header_data[7]) == 0xFF
- file_info["direction"] = 1 if file_info["y_flip"] else -1
- file_info["width"] = i32(header_data[0:4])
- file_info["height"] = (
- i32(header_data[4:8])
- if not file_info["y_flip"]
- else 2 ** 32 - i32(header_data[4:8])
- )
- file_info["planes"] = i16(header_data[8:10])
- file_info["bits"] = i16(header_data[10:12])
- file_info["compression"] = i32(header_data[12:16])
- # byte size of pixel data
- file_info["data_size"] = i32(header_data[16:20])
- file_info["pixels_per_meter"] = (
- i32(header_data[20:24]),
- i32(header_data[24:28]),
- )
- file_info["colors"] = i32(header_data[28:32])
- file_info["palette_padding"] = 4
- self.info["dpi"] = tuple(
- int(x / 39.3701 + 0.5) for x in file_info["pixels_per_meter"]
- )
- if file_info["compression"] == self.BITFIELDS:
- if len(header_data) >= 52:
- for idx, mask in enumerate(
- ["r_mask", "g_mask", "b_mask", "a_mask"]
- ):
- file_info[mask] = i32(header_data[36 + idx * 4 : 40 + idx * 4])
- else:
- # 40 byte headers only have the three components in the
- # bitfields masks, ref:
- # https://msdn.microsoft.com/en-us/library/windows/desktop/dd183376(v=vs.85).aspx
- # See also
- # https://github.com/python-pillow/Pillow/issues/1293
- # There is a 4th component in the RGBQuad, in the alpha
- # location, but it is listed as a reserved component,
- # and it is not generally an alpha channel
- file_info["a_mask"] = 0x0
- for mask in ["r_mask", "g_mask", "b_mask"]:
- file_info[mask] = i32(read(4))
- file_info["rgb_mask"] = (
- file_info["r_mask"],
- file_info["g_mask"],
- file_info["b_mask"],
- )
- file_info["rgba_mask"] = (
- file_info["r_mask"],
- file_info["g_mask"],
- file_info["b_mask"],
- file_info["a_mask"],
- )
- else:
- raise OSError("Unsupported BMP header type (%d)" % file_info["header_size"])
-
- # ------------------ Special case : header is reported 40, which
- # ---------------------- is shorter than real size for bpp >= 16
- self._size = file_info["width"], file_info["height"]
-
- # ------- If color count was not found in the header, compute from bits
- file_info["colors"] = (
- file_info["colors"]
- if file_info.get("colors", 0)
- else (1 << file_info["bits"])
- )
-
- # ------------------------------- Check abnormal values for DOS attacks
- if file_info["width"] * file_info["height"] > 2 ** 31:
- raise OSError("Unsupported BMP Size: (%dx%d)" % self.size)
-
- # ---------------------- Check bit depth for unusual unsupported values
- self.mode, raw_mode = BIT2MODE.get(file_info["bits"], (None, None))
- if self.mode is None:
- raise OSError("Unsupported BMP pixel depth (%d)" % file_info["bits"])
-
- # ---------------- Process BMP with Bitfields compression (not palette)
- if file_info["compression"] == self.BITFIELDS:
- SUPPORTED = {
- 32: [
- (0xFF0000, 0xFF00, 0xFF, 0x0),
- (0xFF0000, 0xFF00, 0xFF, 0xFF000000),
- (0xFF, 0xFF00, 0xFF0000, 0xFF000000),
- (0x0, 0x0, 0x0, 0x0),
- (0xFF000000, 0xFF0000, 0xFF00, 0x0),
- ],
- 24: [(0xFF0000, 0xFF00, 0xFF)],
- 16: [(0xF800, 0x7E0, 0x1F), (0x7C00, 0x3E0, 0x1F)],
- }
- MASK_MODES = {
- (32, (0xFF0000, 0xFF00, 0xFF, 0x0)): "BGRX",
- (32, (0xFF000000, 0xFF0000, 0xFF00, 0x0)): "XBGR",
- (32, (0xFF, 0xFF00, 0xFF0000, 0xFF000000)): "RGBA",
- (32, (0xFF0000, 0xFF00, 0xFF, 0xFF000000)): "BGRA",
- (32, (0x0, 0x0, 0x0, 0x0)): "BGRA",
- (24, (0xFF0000, 0xFF00, 0xFF)): "BGR",
- (16, (0xF800, 0x7E0, 0x1F)): "BGR;16",
- (16, (0x7C00, 0x3E0, 0x1F)): "BGR;15",
- }
- if file_info["bits"] in SUPPORTED:
- if (
- file_info["bits"] == 32
- and file_info["rgba_mask"] in SUPPORTED[file_info["bits"]]
- ):
- raw_mode = MASK_MODES[(file_info["bits"], file_info["rgba_mask"])]
- self.mode = "RGBA" if "A" in raw_mode else self.mode
- elif (
|
[-]
[+]
|
Deleted |
_service:tar_git:harbour-simplecrop-1.0+main.20210420100251.4.g6bfb428.tar.bz2/lib/arm64/PIL/BufrStubImagePlugin.py
^
|
@@ -1,73 +0,0 @@
-#
-# The Python Imaging Library
-# $Id$
-#
-# BUFR stub adapter
-#
-# Copyright (c) 1996-2003 by Fredrik Lundh
-#
-# See the README file for information on usage and redistribution.
-#
-
-from . import Image, ImageFile
-
-_handler = None
-
-
-def register_handler(handler):
- """
- Install application-specific BUFR image handler.
-
- :param handler: Handler object.
- """
- global _handler
- _handler = handler
-
-
-# --------------------------------------------------------------------
-# Image adapter
-
-
-def _accept(prefix):
- return prefix[:4] == b"BUFR" or prefix[:4] == b"ZCZC"
-
-
-class BufrStubImageFile(ImageFile.StubImageFile):
-
- format = "BUFR"
- format_description = "BUFR"
-
- def _open(self):
-
- offset = self.fp.tell()
-
- if not _accept(self.fp.read(4)):
- raise SyntaxError("Not a BUFR file")
-
- self.fp.seek(offset)
-
- # make something up
- self.mode = "F"
- self._size = 1, 1
-
- loader = self._load()
- if loader:
- loader.open(self)
-
- def _load(self):
- return _handler
-
-
-def _save(im, fp, filename):
- if _handler is None or not hasattr("_handler", "save"):
- raise OSError("BUFR save handler not installed")
- _handler.save(im, fp, filename)
-
-
-# --------------------------------------------------------------------
-# Registry
-
-Image.register_open(BufrStubImageFile.format, BufrStubImageFile, _accept)
-Image.register_save(BufrStubImageFile.format, _save)
-
-Image.register_extension(BufrStubImageFile.format, ".bufr")
|
[-]
[+]
|
Deleted |
_service:tar_git:harbour-simplecrop-1.0+main.20210420100251.4.g6bfb428.tar.bz2/lib/arm64/PIL/ContainerIO.py
^
|
@@ -1,120 +0,0 @@
-#
-# The Python Imaging Library.
-# $Id$
-#
-# a class to read from a container file
-#
-# History:
-# 1995-06-18 fl Created
-# 1995-09-07 fl Added readline(), readlines()
-#
-# Copyright (c) 1997-2001 by Secret Labs AB
-# Copyright (c) 1995 by Fredrik Lundh
-#
-# See the README file for information on usage and redistribution.
-#
-
-
-import io
-
-
-class ContainerIO:
- """
- A file object that provides read access to a part of an existing
- file (for example a TAR file).
- """
-
- def __init__(self, file, offset, length):
- """
- Create file object.
-
- :param file: Existing file.
- :param offset: Start of region, in bytes.
- :param length: Size of region, in bytes.
- """
- self.fh = file
- self.pos = 0
- self.offset = offset
- self.length = length
- self.fh.seek(offset)
-
- ##
- # Always false.
-
- def isatty(self):
- return False
-
- def seek(self, offset, mode=io.SEEK_SET):
- """
- Move file pointer.
-
- :param offset: Offset in bytes.
- :param mode: Starting position. Use 0 for beginning of region, 1
- for current offset, and 2 for end of region. You cannot move
- the pointer outside the defined region.
- """
- if mode == 1:
- self.pos = self.pos + offset
- elif mode == 2:
- self.pos = self.length + offset
- else:
- self.pos = offset
- # clamp
- self.pos = max(0, min(self.pos, self.length))
- self.fh.seek(self.offset + self.pos)
-
- def tell(self):
- """
- Get current file pointer.
-
- :returns: Offset from start of region, in bytes.
- """
- return self.pos
-
- def read(self, n=0):
- """
- Read data.
-
- :param n: Number of bytes to read. If omitted or zero,
- read until end of region.
- :returns: An 8-bit string.
- """
- if n:
- n = min(n, self.length - self.pos)
- else:
- n = self.length - self.pos
- if not n: # EOF
- return b"" if "b" in self.fh.mode else ""
- self.pos = self.pos + n
- return self.fh.read(n)
-
- def readline(self):
- """
- Read a line of text.
-
- :returns: An 8-bit string.
- """
- s = b"" if "b" in self.fh.mode else ""
- newline_character = b"\n" if "b" in self.fh.mode else "\n"
- while True:
- c = self.read(1)
- if not c:
- break
- s = s + c
- if c == newline_character:
- break
- return s
-
- def readlines(self):
- """
- Read multiple lines of text.
-
- :returns: A list of 8-bit strings.
- """
- lines = []
- while True:
- s = self.readline()
- if not s:
- break
- lines.append(s)
- return lines
|
[-]
[+]
|
Deleted |
_service:tar_git:harbour-simplecrop-1.0+main.20210420100251.4.g6bfb428.tar.bz2/lib/arm64/PIL/CurImagePlugin.py
^
|
@@ -1,74 +0,0 @@
-#
-# The Python Imaging Library.
-# $Id$
-#
-# Windows Cursor support for PIL
-#
-# notes:
-# uses BmpImagePlugin.py to read the bitmap data.
-#
-# history:
-# 96-05-27 fl Created
-#
-# Copyright (c) Secret Labs AB 1997.
-# Copyright (c) Fredrik Lundh 1996.
-#
-# See the README file for information on usage and redistribution.
-#
-from . import BmpImagePlugin, Image
-from ._binary import i8, i16le as i16, i32le as i32
-
-#
-# --------------------------------------------------------------------
-
-
-def _accept(prefix):
- return prefix[:4] == b"\0\0\2\0"
-
-
-##
-# Image plugin for Windows Cursor files.
-
-
-class CurImageFile(BmpImagePlugin.BmpImageFile):
-
- format = "CUR"
- format_description = "Windows Cursor"
-
- def _open(self):
-
- offset = self.fp.tell()
-
- # check magic
- s = self.fp.read(6)
- if not _accept(s):
- raise SyntaxError("not a CUR file")
-
- # pick the largest cursor in the file
- m = b""
- for i in range(i16(s[4:])):
- s = self.fp.read(16)
- if not m:
- m = s
- elif i8(s[0]) > i8(m[0]) and i8(s[1]) > i8(m[1]):
- m = s
- if not m:
- raise TypeError("No cursors were found")
-
- # load as bitmap
- self._bitmap(i32(m[12:]) + offset)
-
- # patch up the bitmap height
- self._size = self.size[0], self.size[1] // 2
- d, e, o, a = self.tile[0]
- self.tile[0] = d, (0, 0) + self.size, o, a
-
- return
-
-
-#
-# --------------------------------------------------------------------
-
-Image.register_open(CurImageFile.format, CurImageFile, _accept)
-
-Image.register_extension(CurImageFile.format, ".cur")
|
[-]
[+]
|
Deleted |
_service:tar_git:harbour-simplecrop-1.0+main.20210420100251.4.g6bfb428.tar.bz2/lib/arm64/PIL/DcxImagePlugin.py
^
|
@@ -1,89 +0,0 @@
-#
-# The Python Imaging Library.
-# $Id$
-#
-# DCX file handling
-#
-# DCX is a container file format defined by Intel, commonly used
-# for fax applications. Each DCX file consists of a directory
-# (a list of file offsets) followed by a set of (usually 1-bit)
-# PCX files.
-#
-# History:
-# 1995-09-09 fl Created
-# 1996-03-20 fl Properly derived from PcxImageFile.
-# 1998-07-15 fl Renamed offset attribute to avoid name clash
-# 2002-07-30 fl Fixed file handling
-#
-# Copyright (c) 1997-98 by Secret Labs AB.
-# Copyright (c) 1995-96 by Fredrik Lundh.
-#
-# See the README file for information on usage and redistribution.
-#
-
-from . import Image
-from ._binary import i32le as i32
-from .PcxImagePlugin import PcxImageFile
-
-MAGIC = 0x3ADE68B1 # QUIZ: what's this value, then?
-
-
-def _accept(prefix):
- return len(prefix) >= 4 and i32(prefix) == MAGIC
-
-
-##
-# Image plugin for the Intel DCX format.
-
-
-class DcxImageFile(PcxImageFile):
-
- format = "DCX"
- format_description = "Intel DCX"
- _close_exclusive_fp_after_loading = False
-
- def _open(self):
-
- # Header
- s = self.fp.read(4)
- if not _accept(s):
- raise SyntaxError("not a DCX file")
-
- # Component directory
- self._offset = []
- for i in range(1024):
- offset = i32(self.fp.read(4))
- if not offset:
- break
- self._offset.append(offset)
-
- self.__fp = self.fp
- self.frame = None
- self.n_frames = len(self._offset)
- self.is_animated = self.n_frames > 1
- self.seek(0)
-
- def seek(self, frame):
- if not self._seek_check(frame):
- return
- self.frame = frame
- self.fp = self.__fp
- self.fp.seek(self._offset[frame])
- PcxImageFile._open(self)
-
- def tell(self):
- return self.frame
-
- def _close__fp(self):
- try:
- if self.__fp != self.fp:
- self.__fp.close()
- except AttributeError:
- pass
- finally:
- self.__fp = None
-
-
-Image.register_open(DcxImageFile.format, DcxImageFile, _accept)
-
-Image.register_extension(DcxImageFile.format, ".dcx")
|
[-]
[+]
|
Deleted |
_service:tar_git:harbour-simplecrop-1.0+main.20210420100251.4.g6bfb428.tar.bz2/lib/arm64/PIL/DdsImagePlugin.py
^
|
@@ -1,178 +0,0 @@
-"""
-A Pillow loader for .dds files (S3TC-compressed aka DXTC)
-Jerome Leclanche <jerome@leclan.ch>
-
-Documentation:
- https://web.archive.org/web/20170802060935/http://oss.sgi.com/projects/ogl-sample/registry/EXT/texture_compression_s3tc.txt
-
-The contents of this file are hereby released in the public domain (CC0)
-Full text of the CC0 license:
- https://creativecommons.org/publicdomain/zero/1.0/
-"""
-
-import struct
-from io import BytesIO
-
-from . import Image, ImageFile
-
-# Magic ("DDS ")
-DDS_MAGIC = 0x20534444
-
-# DDS flags
-DDSD_CAPS = 0x1
-DDSD_HEIGHT = 0x2
-DDSD_WIDTH = 0x4
-DDSD_PITCH = 0x8
-DDSD_PIXELFORMAT = 0x1000
-DDSD_MIPMAPCOUNT = 0x20000
-DDSD_LINEARSIZE = 0x80000
-DDSD_DEPTH = 0x800000
-
-# DDS caps
-DDSCAPS_COMPLEX = 0x8
-DDSCAPS_TEXTURE = 0x1000
-DDSCAPS_MIPMAP = 0x400000
-
-DDSCAPS2_CUBEMAP = 0x200
-DDSCAPS2_CUBEMAP_POSITIVEX = 0x400
-DDSCAPS2_CUBEMAP_NEGATIVEX = 0x800
-DDSCAPS2_CUBEMAP_POSITIVEY = 0x1000
-DDSCAPS2_CUBEMAP_NEGATIVEY = 0x2000
-DDSCAPS2_CUBEMAP_POSITIVEZ = 0x4000
-DDSCAPS2_CUBEMAP_NEGATIVEZ = 0x8000
-DDSCAPS2_VOLUME = 0x200000
-
-# Pixel Format
-DDPF_ALPHAPIXELS = 0x1
-DDPF_ALPHA = 0x2
-DDPF_FOURCC = 0x4
-DDPF_PALETTEINDEXED8 = 0x20
-DDPF_RGB = 0x40
-DDPF_LUMINANCE = 0x20000
-
-
-# dds.h
-
-DDS_FOURCC = DDPF_FOURCC
-DDS_RGB = DDPF_RGB
-DDS_RGBA = DDPF_RGB | DDPF_ALPHAPIXELS
-DDS_LUMINANCE = DDPF_LUMINANCE
-DDS_LUMINANCEA = DDPF_LUMINANCE | DDPF_ALPHAPIXELS
-DDS_ALPHA = DDPF_ALPHA
-DDS_PAL8 = DDPF_PALETTEINDEXED8
-
-DDS_HEADER_FLAGS_TEXTURE = DDSD_CAPS | DDSD_HEIGHT | DDSD_WIDTH | DDSD_PIXELFORMAT
-DDS_HEADER_FLAGS_MIPMAP = DDSD_MIPMAPCOUNT
-DDS_HEADER_FLAGS_VOLUME = DDSD_DEPTH
-DDS_HEADER_FLAGS_PITCH = DDSD_PITCH
-DDS_HEADER_FLAGS_LINEARSIZE = DDSD_LINEARSIZE
-
-DDS_HEIGHT = DDSD_HEIGHT
-DDS_WIDTH = DDSD_WIDTH
-
-DDS_SURFACE_FLAGS_TEXTURE = DDSCAPS_TEXTURE
-DDS_SURFACE_FLAGS_MIPMAP = DDSCAPS_COMPLEX | DDSCAPS_MIPMAP
-DDS_SURFACE_FLAGS_CUBEMAP = DDSCAPS_COMPLEX
-
-DDS_CUBEMAP_POSITIVEX = DDSCAPS2_CUBEMAP | DDSCAPS2_CUBEMAP_POSITIVEX
-DDS_CUBEMAP_NEGATIVEX = DDSCAPS2_CUBEMAP | DDSCAPS2_CUBEMAP_NEGATIVEX
-DDS_CUBEMAP_POSITIVEY = DDSCAPS2_CUBEMAP | DDSCAPS2_CUBEMAP_POSITIVEY
-DDS_CUBEMAP_NEGATIVEY = DDSCAPS2_CUBEMAP | DDSCAPS2_CUBEMAP_NEGATIVEY
-DDS_CUBEMAP_POSITIVEZ = DDSCAPS2_CUBEMAP | DDSCAPS2_CUBEMAP_POSITIVEZ
-DDS_CUBEMAP_NEGATIVEZ = DDSCAPS2_CUBEMAP | DDSCAPS2_CUBEMAP_NEGATIVEZ
-
-
-# DXT1
-DXT1_FOURCC = 0x31545844
-
-# DXT3
-DXT3_FOURCC = 0x33545844
-
-# DXT5
-DXT5_FOURCC = 0x35545844
-
-
-# dxgiformat.h
-
-DXGI_FORMAT_BC7_TYPELESS = 97
-DXGI_FORMAT_BC7_UNORM = 98
-DXGI_FORMAT_BC7_UNORM_SRGB = 99
-
-
-class DdsImageFile(ImageFile.ImageFile):
- format = "DDS"
- format_description = "DirectDraw Surface"
-
- def _open(self):
- magic, header_size = struct.unpack("<II", self.fp.read(8))
- if header_size != 124:
- raise OSError("Unsupported header size %r" % (header_size))
- header_bytes = self.fp.read(header_size - 4)
- if len(header_bytes) != 120:
- raise OSError("Incomplete header: %s bytes" % len(header_bytes))
- header = BytesIO(header_bytes)
-
- flags, height, width = struct.unpack("<3I", header.read(12))
- self._size = (width, height)
- self.mode = "RGBA"
-
- pitch, depth, mipmaps = struct.unpack("<3I", header.read(12))
- struct.unpack("<11I", header.read(44)) # reserved
-
- # pixel format
- pfsize, pfflags = struct.unpack("<2I", header.read(8))
- fourcc = header.read(4)
- (bitcount,) = struct.unpack("<I", header.read(4))
- masks = struct.unpack("<4I", header.read(16))
- if pfflags & 0x40:
- # DDPF_RGB - Texture contains uncompressed RGB data
- masks = {mask: ["R", "G", "B", "A"][i] for i, mask in enumerate(masks)}
- rawmode = ""
- if bitcount == 32:
- rawmode += masks[0xFF000000]
- rawmode += masks[0xFF0000] + masks[0xFF00] + masks[0xFF]
-
- self.tile = [("raw", (0, 0) + self.size, 0, (rawmode, 0, 1))]
- else:
- data_start = header_size + 4
- n = 0
- if fourcc == b"DXT1":
- self.pixel_format = "DXT1"
- n = 1
- elif fourcc == b"DXT3":
- self.pixel_format = "DXT3"
- n = 2
- elif fourcc == b"DXT5":
- self.pixel_format = "DXT5"
- n = 3
- elif fourcc == b"DX10":
- data_start += 20
- # ignoring flags which pertain to volume textures and cubemaps
- dxt10 = BytesIO(self.fp.read(20))
- dxgi_format, dimension = struct.unpack("<II", dxt10.read(8))
- if dxgi_format in (DXGI_FORMAT_BC7_TYPELESS, DXGI_FORMAT_BC7_UNORM):
- self.pixel_format = "BC7"
- n = 7
- elif dxgi_format == DXGI_FORMAT_BC7_UNORM_SRGB:
- self.pixel_format = "BC7"
- self.info["gamma"] = 1 / 2.2
- n = 7
- else:
- raise NotImplementedError(
- "Unimplemented DXGI format %d" % (dxgi_format)
- )
- else:
- raise NotImplementedError("Unimplemented pixel format %r" % (fourcc))
-
- self.tile = [("bcn", (0, 0) + self.size, data_start, (n))]
-
- def load_seek(self, pos):
- pass
-
-
-def _validate(prefix):
- return prefix[:4] == b"DDS "
-
-
-Image.register_open(DdsImageFile.format, DdsImageFile, _validate)
-Image.register_extension(DdsImageFile.format, ".dds")
|
[-]
[+]
|
Deleted |
_service:tar_git:harbour-simplecrop-1.0+main.20210420100251.4.g6bfb428.tar.bz2/lib/arm64/PIL/EpsImagePlugin.py
^
|
@@ -1,419 +0,0 @@
-#
-# The Python Imaging Library.
-# $Id$
-#
-# EPS file handling
-#
-# History:
-# 1995-09-01 fl Created (0.1)
-# 1996-05-18 fl Don't choke on "atend" fields, Ghostscript interface (0.2)
-# 1996-08-22 fl Don't choke on floating point BoundingBox values
-# 1996-08-23 fl Handle files from Macintosh (0.3)
-# 2001-02-17 fl Use 're' instead of 'regex' (Python 2.1) (0.4)
-# 2003-09-07 fl Check gs.close status (from Federico Di Gregorio) (0.5)
-# 2014-05-07 e Handling of EPS with binary preview and fixed resolution
-# resizing
-#
-# Copyright (c) 1997-2003 by Secret Labs AB.
-# Copyright (c) 1995-2003 by Fredrik Lundh
-#
-# See the README file for information on usage and redistribution.
-#
-
-import io
-import os
-import re
-import subprocess
-import sys
-import tempfile
-
-from . import Image, ImageFile
-from ._binary import i32le as i32
-
-#
-# --------------------------------------------------------------------
-
-split = re.compile(r"^%%([^:]*):[ \t]*(.*)[ \t]*$")
-field = re.compile(r"^%[%!\w]([^:]*)[ \t]*$")
-
-gs_windows_binary = None
-if sys.platform.startswith("win"):
- import shutil
-
- for binary in ("gswin32c", "gswin64c", "gs"):
- if shutil.which(binary) is not None:
- gs_windows_binary = binary
- break
- else:
- gs_windows_binary = False
-
-
-def has_ghostscript():
- if gs_windows_binary:
- return True
- if not sys.platform.startswith("win"):
- try:
- subprocess.check_call(["gs", "--version"], stdout=subprocess.DEVNULL)
- return True
- except OSError:
- # No Ghostscript
- pass
- return False
-
-
-def Ghostscript(tile, size, fp, scale=1):
- """Render an image using Ghostscript"""
-
- # Unpack decoder tile
- decoder, tile, offset, data = tile[0]
- length, bbox = data
-
- # Hack to support hi-res rendering
- scale = int(scale) or 1
- # orig_size = size
- # orig_bbox = bbox
- size = (size[0] * scale, size[1] * scale)
- # resolution is dependent on bbox and size
- res = (
- 72.0 * size[0] / (bbox[2] - bbox[0]),
- 72.0 * size[1] / (bbox[3] - bbox[1]),
- )
-
- out_fd, outfile = tempfile.mkstemp()
- os.close(out_fd)
-
- infile_temp = None
- if hasattr(fp, "name") and os.path.exists(fp.name):
- infile = fp.name
- else:
- in_fd, infile_temp = tempfile.mkstemp()
- os.close(in_fd)
- infile = infile_temp
-
- # Ignore length and offset!
- # Ghostscript can read it
- # Copy whole file to read in Ghostscript
- with open(infile_temp, "wb") as f:
- # fetch length of fp
- fp.seek(0, io.SEEK_END)
- fsize = fp.tell()
- # ensure start position
- # go back
- fp.seek(0)
- lengthfile = fsize
- while lengthfile > 0:
- s = fp.read(min(lengthfile, 100 * 1024))
- if not s:
- break
- lengthfile -= len(s)
- f.write(s)
-
- # Build Ghostscript command
- command = [
- "gs",
- "-q", # quiet mode
- "-g%dx%d" % size, # set output geometry (pixels)
- "-r%fx%f" % res, # set input DPI (dots per inch)
- "-dBATCH", # exit after processing
- "-dNOPAUSE", # don't pause between pages
- "-dSAFER", # safe mode
- "-sDEVICE=ppmraw", # ppm driver
- "-sOutputFile=%s" % outfile, # output file
- # adjust for image origin
- "-c",
- "%d %d translate" % (-bbox[0], -bbox[1]),
- "-f",
- infile, # input file
- # showpage (see https://bugs.ghostscript.com/show_bug.cgi?id=698272)
- "-c",
- "showpage",
- ]
-
- if gs_windows_binary is not None:
- if not gs_windows_binary:
- raise OSError("Unable to locate Ghostscript on paths")
- command[0] = gs_windows_binary
-
- # push data through Ghostscript
- try:
- startupinfo = None
- if sys.platform.startswith("win"):
- startupinfo = subprocess.STARTUPINFO()
- startupinfo.dwFlags |= subprocess.STARTF_USESHOWWINDOW
- subprocess.check_call(command, startupinfo=startupinfo)
- out_im = Image.open(outfile)
- out_im.load()
- finally:
- try:
- os.unlink(outfile)
- if infile_temp:
- os.unlink(infile_temp)
- except OSError:
- pass
-
- im = out_im.im.copy()
- out_im.close()
- return im
-
-
-class PSFile:
- """
- Wrapper for bytesio object that treats either CR or LF as end of line.
- """
-
- def __init__(self, fp):
- self.fp = fp
- self.char = None
-
- def seek(self, offset, whence=io.SEEK_SET):
- self.char = None
- self.fp.seek(offset, whence)
-
- def readline(self):
- s = self.char or b""
- self.char = None
-
- c = self.fp.read(1)
- while c not in b"\r\n":
- s = s + c
- c = self.fp.read(1)
-
- self.char = self.fp.read(1)
- # line endings can be 1 or 2 of \r \n, in either order
- if self.char in b"\r\n":
- self.char = None
-
- return s.decode("latin-1")
-
-
-def _accept(prefix):
- return prefix[:4] == b"%!PS" or (len(prefix) >= 4 and i32(prefix) == 0xC6D3D0C5)
-
-
-##
-# Image plugin for Encapsulated Postscript. This plugin supports only
-# a few variants of this format.
-
-
-class EpsImageFile(ImageFile.ImageFile):
- """EPS File Parser for the Python Imaging Library"""
|
[-]
[+]
|
Deleted |
_service:tar_git:harbour-simplecrop-1.0+main.20210420100251.4.g6bfb428.tar.bz2/lib/arm64/PIL/ExifTags.py
^
|
@@ -1,318 +0,0 @@
-#
-# The Python Imaging Library.
-# $Id$
-#
-# EXIF tags
-#
-# Copyright (c) 2003 by Secret Labs AB
-#
-# See the README file for information on usage and redistribution.
-#
-
-"""
-This module provides constants and clear-text names for various
-well-known EXIF tags.
-"""
-
-
-TAGS = {
- # possibly incomplete
- 0x000B: "ProcessingSoftware",
- 0x00FE: "NewSubfileType",
- 0x00FF: "SubfileType",
- 0x0100: "ImageWidth",
- 0x0101: "ImageLength",
- 0x0102: "BitsPerSample",
- 0x0103: "Compression",
- 0x0106: "PhotometricInterpretation",
- 0x0107: "Thresholding",
- 0x0108: "CellWidth",
- 0x0109: "CellLength",
- 0x010A: "FillOrder",
- 0x010D: "DocumentName",
- 0x010E: "ImageDescription",
- 0x010F: "Make",
- 0x0110: "Model",
- 0x0111: "StripOffsets",
- 0x0112: "Orientation",
- 0x0115: "SamplesPerPixel",
- 0x0116: "RowsPerStrip",
- 0x0117: "StripByteCounts",
- 0x0118: "MinSampleValue",
- 0x0119: "MaxSampleValue",
- 0x011A: "XResolution",
- 0x011B: "YResolution",
- 0x011C: "PlanarConfiguration",
- 0x011D: "PageName",
- 0x0120: "FreeOffsets",
- 0x0121: "FreeByteCounts",
- 0x0122: "GrayResponseUnit",
- 0x0123: "GrayResponseCurve",
- 0x0124: "T4Options",
- 0x0125: "T6Options",
- 0x0128: "ResolutionUnit",
- 0x0129: "PageNumber",
- 0x012D: "TransferFunction",
- 0x0131: "Software",
- 0x0132: "DateTime",
- 0x013B: "Artist",
- 0x013C: "HostComputer",
- 0x013D: "Predictor",
- 0x013E: "WhitePoint",
- 0x013F: "PrimaryChromaticities",
- 0x0140: "ColorMap",
- 0x0141: "HalftoneHints",
- 0x0142: "TileWidth",
- 0x0143: "TileLength",
- 0x0144: "TileOffsets",
- 0x0145: "TileByteCounts",
- 0x014A: "SubIFDs",
- 0x014C: "InkSet",
- 0x014D: "InkNames",
- 0x014E: "NumberOfInks",
- 0x0150: "DotRange",
- 0x0151: "TargetPrinter",
- 0x0152: "ExtraSamples",
- 0x0153: "SampleFormat",
- 0x0154: "SMinSampleValue",
- 0x0155: "SMaxSampleValue",
- 0x0156: "TransferRange",
- 0x0157: "ClipPath",
- 0x0158: "XClipPathUnits",
- 0x0159: "YClipPathUnits",
- 0x015A: "Indexed",
- 0x015B: "JPEGTables",
- 0x015F: "OPIProxy",
- 0x0200: "JPEGProc",
- 0x0201: "JpegIFOffset",
- 0x0202: "JpegIFByteCount",
- 0x0203: "JpegRestartInterval",
- 0x0205: "JpegLosslessPredictors",
- 0x0206: "JpegPointTransforms",
- 0x0207: "JpegQTables",
- 0x0208: "JpegDCTables",
- 0x0209: "JpegACTables",
- 0x0211: "YCbCrCoefficients",
- 0x0212: "YCbCrSubSampling",
- 0x0213: "YCbCrPositioning",
- 0x0214: "ReferenceBlackWhite",
- 0x02BC: "XMLPacket",
- 0x1000: "RelatedImageFileFormat",
- 0x1001: "RelatedImageWidth",
- 0x1002: "RelatedImageLength",
- 0x4746: "Rating",
- 0x4749: "RatingPercent",
- 0x800D: "ImageID",
- 0x828D: "CFARepeatPatternDim",
- 0x828E: "CFAPattern",
- 0x828F: "BatteryLevel",
- 0x8298: "Copyright",
- 0x829A: "ExposureTime",
- 0x829D: "FNumber",
- 0x83BB: "IPTCNAA",
- 0x8649: "ImageResources",
- 0x8769: "ExifOffset",
- 0x8773: "InterColorProfile",
- 0x8822: "ExposureProgram",
- 0x8824: "SpectralSensitivity",
- 0x8825: "GPSInfo",
- 0x8827: "ISOSpeedRatings",
- 0x8828: "OECF",
- 0x8829: "Interlace",
- 0x882A: "TimeZoneOffset",
- 0x882B: "SelfTimerMode",
- 0x9000: "ExifVersion",
- 0x9003: "DateTimeOriginal",
- 0x9004: "DateTimeDigitized",
- 0x9101: "ComponentsConfiguration",
- 0x9102: "CompressedBitsPerPixel",
- 0x9201: "ShutterSpeedValue",
- 0x9202: "ApertureValue",
- 0x9203: "BrightnessValue",
- 0x9204: "ExposureBiasValue",
- 0x9205: "MaxApertureValue",
- 0x9206: "SubjectDistance",
- 0x9207: "MeteringMode",
- 0x9208: "LightSource",
- 0x9209: "Flash",
- 0x920A: "FocalLength",
- 0x920B: "FlashEnergy",
- 0x920C: "SpatialFrequencyResponse",
- 0x920D: "Noise",
- 0x9211: "ImageNumber",
- 0x9212: "SecurityClassification",
- 0x9213: "ImageHistory",
- 0x9214: "SubjectLocation",
- 0x9215: "ExposureIndex",
- 0x9216: "TIFF/EPStandardID",
- 0x927C: "MakerNote",
- 0x9286: "UserComment",
- 0x9290: "SubsecTime",
- 0x9291: "SubsecTimeOriginal",
- 0x9292: "SubsecTimeDigitized",
- 0x9400: "AmbientTemperature",
- 0x9401: "Humidity",
- 0x9402: "Pressure",
- 0x9403: "WaterDepth",
- 0x9404: "Acceleration",
- 0x9405: "CameraElevationAngle",
- 0x9C9B: "XPTitle",
- 0x9C9C: "XPComment",
- 0x9C9D: "XPAuthor",
- 0x9C9E: "XPKeywords",
- 0x9C9F: "XPSubject",
- 0xA000: "FlashPixVersion",
- 0xA001: "ColorSpace",
- 0xA002: "ExifImageWidth",
- 0xA003: "ExifImageHeight",
- 0xA004: "RelatedSoundFile",
- 0xA005: "ExifInteroperabilityOffset",
- 0xA20B: "FlashEnergy",
- 0xA20C: "SpatialFrequencyResponse",
- 0xA20E: "FocalPlaneXResolution",
- 0xA20F: "FocalPlaneYResolution",
- 0xA210: "FocalPlaneResolutionUnit",
- 0xA214: "SubjectLocation",
- 0xA215: "ExposureIndex",
- 0xA217: "SensingMethod",
- 0xA300: "FileSource",
- 0xA301: "SceneType",
- 0xA302: "CFAPattern",
- 0xA401: "CustomRendered",
- 0xA402: "ExposureMode",
- 0xA403: "WhiteBalance",
- 0xA404: "DigitalZoomRatio",
- 0xA405: "FocalLengthIn35mmFilm",
- 0xA406: "SceneCaptureType",
- 0xA407: "GainControl",
- 0xA408: "Contrast",
- 0xA409: "Saturation",
- 0xA40A: "Sharpness",
- 0xA40B: "DeviceSettingDescription",
- 0xA40C: "SubjectDistanceRange",
- 0xA420: "ImageUniqueID",
- 0xA430: "CameraOwnerName",
- 0xA431: "BodySerialNumber",
- 0xA432: "LensSpecification",
- 0xA433: "LensMake",
- 0xA434: "LensModel",
- 0xA435: "LensSerialNumber",
|
[-]
[+]
|
Deleted |
_service:tar_git:harbour-simplecrop-1.0+main.20210420100251.4.g6bfb428.tar.bz2/lib/arm64/PIL/FitsStubImagePlugin.py
^
|
@@ -1,76 +0,0 @@
-#
-# The Python Imaging Library
-# $Id$
-#
-# FITS stub adapter
-#
-# Copyright (c) 1998-2003 by Fredrik Lundh
-#
-# See the README file for information on usage and redistribution.
-#
-
-from . import Image, ImageFile
-
-_handler = None
-
-
-def register_handler(handler):
- """
- Install application-specific FITS image handler.
-
- :param handler: Handler object.
- """
- global _handler
- _handler = handler
-
-
-# --------------------------------------------------------------------
-# Image adapter
-
-
-def _accept(prefix):
- return prefix[:6] == b"SIMPLE"
-
-
-class FITSStubImageFile(ImageFile.StubImageFile):
-
- format = "FITS"
- format_description = "FITS"
-
- def _open(self):
-
- offset = self.fp.tell()
-
- if not _accept(self.fp.read(6)):
- raise SyntaxError("Not a FITS file")
-
- # FIXME: add more sanity checks here; mandatory header items
- # include SIMPLE, BITPIX, NAXIS, etc.
-
- self.fp.seek(offset)
-
- # make something up
- self.mode = "F"
- self._size = 1, 1
-
- loader = self._load()
- if loader:
- loader.open(self)
-
- def _load(self):
- return _handler
-
-
-def _save(im, fp, filename):
- if _handler is None or not hasattr("_handler", "save"):
- raise OSError("FITS save handler not installed")
- _handler.save(im, fp, filename)
-
-
-# --------------------------------------------------------------------
-# Registry
-
-Image.register_open(FITSStubImageFile.format, FITSStubImageFile, _accept)
-Image.register_save(FITSStubImageFile.format, _save)
-
-Image.register_extensions(FITSStubImageFile.format, [".fit", ".fits"])
|
[-]
[+]
|
Deleted |
_service:tar_git:harbour-simplecrop-1.0+main.20210420100251.4.g6bfb428.tar.bz2/lib/arm64/PIL/FliImagePlugin.py
^
|
@@ -1,169 +0,0 @@
-#
-# The Python Imaging Library.
-# $Id$
-#
-# FLI/FLC file handling.
-#
-# History:
-# 95-09-01 fl Created
-# 97-01-03 fl Fixed parser, setup decoder tile
-# 98-07-15 fl Renamed offset attribute to avoid name clash
-#
-# Copyright (c) Secret Labs AB 1997-98.
-# Copyright (c) Fredrik Lundh 1995-97.
-#
-# See the README file for information on usage and redistribution.
-#
-
-
-from . import Image, ImageFile, ImagePalette
-from ._binary import i8, i16le as i16, i32le as i32, o8
-
-#
-# decoder
-
-
-def _accept(prefix):
- return len(prefix) >= 6 and i16(prefix[4:6]) in [0xAF11, 0xAF12]
-
-
-##
-# Image plugin for the FLI/FLC animation format. Use the <b>seek</b>
-# method to load individual frames.
-
-
-class FliImageFile(ImageFile.ImageFile):
-
- format = "FLI"
- format_description = "Autodesk FLI/FLC Animation"
- _close_exclusive_fp_after_loading = False
-
- def _open(self):
-
- # HEAD
- s = self.fp.read(128)
- if not (
- _accept(s)
- and i16(s[14:16]) in [0, 3] # flags
- and s[20:22] == b"\x00\x00" # reserved
- ):
- raise SyntaxError("not an FLI/FLC file")
-
- # frames
- self.n_frames = i16(s[6:8])
- self.is_animated = self.n_frames > 1
-
- # image characteristics
- self.mode = "P"
- self._size = i16(s[8:10]), i16(s[10:12])
-
- # animation speed
- duration = i32(s[16:20])
- magic = i16(s[4:6])
- if magic == 0xAF11:
- duration = (duration * 1000) // 70
- self.info["duration"] = duration
-
- # look for palette
- palette = [(a, a, a) for a in range(256)]
-
- s = self.fp.read(16)
-
- self.__offset = 128
-
- if i16(s[4:6]) == 0xF100:
- # prefix chunk; ignore it
- self.__offset = self.__offset + i32(s)
- s = self.fp.read(16)
-
- if i16(s[4:6]) == 0xF1FA:
- # look for palette chunk
- s = self.fp.read(6)
- if i16(s[4:6]) == 11:
- self._palette(palette, 2)
- elif i16(s[4:6]) == 4:
- self._palette(palette, 0)
-
- palette = [o8(r) + o8(g) + o8(b) for (r, g, b) in palette]
- self.palette = ImagePalette.raw("RGB", b"".join(palette))
-
- # set things up to decode first frame
- self.__frame = -1
- self.__fp = self.fp
- self.__rewind = self.fp.tell()
- self.seek(0)
-
- def _palette(self, palette, shift):
- # load palette
-
- i = 0
- for e in range(i16(self.fp.read(2))):
- s = self.fp.read(2)
- i = i + i8(s[0])
- n = i8(s[1])
- if n == 0:
- n = 256
- s = self.fp.read(n * 3)
- for n in range(0, len(s), 3):
- r = i8(s[n]) << shift
- g = i8(s[n + 1]) << shift
- b = i8(s[n + 2]) << shift
- palette[i] = (r, g, b)
- i += 1
-
- def seek(self, frame):
- if not self._seek_check(frame):
- return
- if frame < self.__frame:
- self._seek(0)
-
- for f in range(self.__frame + 1, frame + 1):
- self._seek(f)
-
- def _seek(self, frame):
- if frame == 0:
- self.__frame = -1
- self.__fp.seek(self.__rewind)
- self.__offset = 128
- else:
- # ensure that the previous frame was loaded
- self.load()
-
- if frame != self.__frame + 1:
- raise ValueError("cannot seek to frame %d" % frame)
- self.__frame = frame
-
- # move to next frame
- self.fp = self.__fp
- self.fp.seek(self.__offset)
-
- s = self.fp.read(4)
- if not s:
- raise EOFError
-
- framesize = i32(s)
-
- self.decodermaxblock = framesize
- self.tile = [("fli", (0, 0) + self.size, self.__offset, None)]
-
- self.__offset += framesize
-
- def tell(self):
- return self.__frame
-
- def _close__fp(self):
- try:
- if self.__fp != self.fp:
- self.__fp.close()
- except AttributeError:
- pass
- finally:
- self.__fp = None
-
-
-#
-# registry
-
-Image.register_open(FliImageFile.format, FliImageFile, _accept)
-
-Image.register_extensions(FliImageFile.format, [".fli", ".flc"])
|
[-]
[+]
|
Deleted |
_service:tar_git:harbour-simplecrop-1.0+main.20210420100251.4.g6bfb428.tar.bz2/lib/arm64/PIL/FontFile.py
^
|
@@ -1,111 +0,0 @@
-#
-# The Python Imaging Library
-# $Id$
-#
-# base class for raster font file parsers
-#
-# history:
-# 1997-06-05 fl created
-# 1997-08-19 fl restrict image width
-#
-# Copyright (c) 1997-1998 by Secret Labs AB
-# Copyright (c) 1997-1998 by Fredrik Lundh
-#
-# See the README file for information on usage and redistribution.
-#
-
-
-import os
-
-from . import Image, _binary
-
-WIDTH = 800
-
-
-def puti16(fp, values):
- """Write network order (big-endian) 16-bit sequence"""
- for v in values:
- if v < 0:
- v += 65536
- fp.write(_binary.o16be(v))
-
-
-class FontFile:
- """Base class for raster font file handlers."""
-
- bitmap = None
-
- def __init__(self):
-
- self.info = {}
- self.glyph = [None] * 256
-
- def __getitem__(self, ix):
- return self.glyph[ix]
-
- def compile(self):
- """Create metrics and bitmap"""
-
- if self.bitmap:
- return
-
- # create bitmap large enough to hold all data
- h = w = maxwidth = 0
- lines = 1
- for glyph in self:
- if glyph:
- d, dst, src, im = glyph
- h = max(h, src[3] - src[1])
- w = w + (src[2] - src[0])
- if w > WIDTH:
- lines += 1
- w = src[2] - src[0]
- maxwidth = max(maxwidth, w)
-
- xsize = maxwidth
- ysize = lines * h
-
- if xsize == 0 and ysize == 0:
- return ""
-
- self.ysize = h
-
- # paste glyphs into bitmap
- self.bitmap = Image.new("1", (xsize, ysize))
- self.metrics = [None] * 256
- x = y = 0
- for i in range(256):
- glyph = self[i]
- if glyph:
- d, dst, src, im = glyph
- xx = src[2] - src[0]
- # yy = src[3] - src[1]
- x0, y0 = x, y
- x = x + xx
- if x > WIDTH:
- x, y = 0, y + h
- x0, y0 = x, y
- x = xx
- s = src[0] + x0, src[1] + y0, src[2] + x0, src[3] + y0
- self.bitmap.paste(im.crop(src), s)
- self.metrics[i] = d, dst, s
-
- def save(self, filename):
- """Save font"""
-
- self.compile()
-
- # font data
- self.bitmap.save(os.path.splitext(filename)[0] + ".pbm", "PNG")
-
- # font metrics
- with open(os.path.splitext(filename)[0] + ".pil", "wb") as fp:
- fp.write(b"PILfont\n")
- fp.write((";;;;;;%d;\n" % self.ysize).encode("ascii")) # HACK!!!
- fp.write(b"DATA\n")
- for id in range(256):
- m = self.metrics[id]
- if not m:
- puti16(fp, [0] * 10)
- else:
- puti16(fp, m[0] + m[1] + m[2])
|
[-]
[+]
|
Deleted |
_service:tar_git:harbour-simplecrop-1.0+main.20210420100251.4.g6bfb428.tar.bz2/lib/arm64/PIL/FpxImagePlugin.py
^
|
@@ -1,242 +0,0 @@
-#
-# THIS IS WORK IN PROGRESS
-#
-# The Python Imaging Library.
-# $Id$
-#
-# FlashPix support for PIL
-#
-# History:
-# 97-01-25 fl Created (reads uncompressed RGB images only)
-#
-# Copyright (c) Secret Labs AB 1997.
-# Copyright (c) Fredrik Lundh 1997.
-#
-# See the README file for information on usage and redistribution.
-#
-import olefile
-
-from . import Image, ImageFile
-from ._binary import i8, i32le as i32
-
-# we map from colour field tuples to (mode, rawmode) descriptors
-MODES = {
- # opacity
- (0x00007FFE): ("A", "L"),
- # monochrome
- (0x00010000,): ("L", "L"),
- (0x00018000, 0x00017FFE): ("RGBA", "LA"),
- # photo YCC
- (0x00020000, 0x00020001, 0x00020002): ("RGB", "YCC;P"),
- (0x00028000, 0x00028001, 0x00028002, 0x00027FFE): ("RGBA", "YCCA;P"),
- # standard RGB (NIFRGB)
- (0x00030000, 0x00030001, 0x00030002): ("RGB", "RGB"),
- (0x00038000, 0x00038001, 0x00038002, 0x00037FFE): ("RGBA", "RGBA"),
-}
-
-
-#
-# --------------------------------------------------------------------
-
-
-def _accept(prefix):
- return prefix[:8] == olefile.MAGIC
-
-
-##
-# Image plugin for the FlashPix images.
-
-
-class FpxImageFile(ImageFile.ImageFile):
-
- format = "FPX"
- format_description = "FlashPix"
-
- def _open(self):
- #
- # read the OLE directory and see if this is a likely
- # to be a FlashPix file
-
- try:
- self.ole = olefile.OleFileIO(self.fp)
- except OSError as e:
- raise SyntaxError("not an FPX file; invalid OLE file") from e
-
- if self.ole.root.clsid != "56616700-C154-11CE-8553-00AA00A1F95B":
- raise SyntaxError("not an FPX file; bad root CLSID")
-
- self._open_index(1)
-
- def _open_index(self, index=1):
- #
- # get the Image Contents Property Set
-
- prop = self.ole.getproperties(
- ["Data Object Store %06d" % index, "\005Image Contents"]
- )
-
- # size (highest resolution)
-
- self._size = prop[0x1000002], prop[0x1000003]
-
- size = max(self.size)
- i = 1
- while size > 64:
- size = size / 2
- i += 1
- self.maxid = i - 1
-
- # mode. instead of using a single field for this, flashpix
- # requires you to specify the mode for each channel in each
- # resolution subimage, and leaves it to the decoder to make
- # sure that they all match. for now, we'll cheat and assume
- # that this is always the case.
-
- id = self.maxid << 16
-
- s = prop[0x2000002 | id]
-
- colors = []
- bands = i32(s, 4)
- if bands > 4:
- raise OSError("Invalid number of bands")
- for i in range(bands):
- # note: for now, we ignore the "uncalibrated" flag
- colors.append(i32(s, 8 + i * 4) & 0x7FFFFFFF)
-
- self.mode, self.rawmode = MODES[tuple(colors)]
-
- # load JPEG tables, if any
- self.jpeg = {}
- for i in range(256):
- id = 0x3000001 | (i << 16)
- if id in prop:
- self.jpeg[i] = prop[id]
-
- self._open_subimage(1, self.maxid)
-
- def _open_subimage(self, index=1, subimage=0):
- #
- # setup tile descriptors for a given subimage
-
- stream = [
- "Data Object Store %06d" % index,
- "Resolution %04d" % subimage,
- "Subimage 0000 Header",
- ]
-
- fp = self.ole.openstream(stream)
-
- # skip prefix
- fp.read(28)
-
- # header stream
- s = fp.read(36)
-
- size = i32(s, 4), i32(s, 8)
- # tilecount = i32(s, 12)
- tilesize = i32(s, 16), i32(s, 20)
- # channels = i32(s, 24)
- offset = i32(s, 28)
- length = i32(s, 32)
-
- if size != self.size:
- raise OSError("subimage mismatch")
-
- # get tile descriptors
- fp.seek(28 + offset)
- s = fp.read(i32(s, 12) * length)
-
- x = y = 0
- xsize, ysize = size
- xtile, ytile = tilesize
- self.tile = []
-
- for i in range(0, len(s), length):
-
- compression = i32(s, i + 8)
-
- if compression == 0:
- self.tile.append(
- (
- "raw",
- (x, y, x + xtile, y + ytile),
- i32(s, i) + 28,
- (self.rawmode),
- )
- )
-
- elif compression == 1:
-
- # FIXME: the fill decoder is not implemented
- self.tile.append(
- (
- "fill",
- (x, y, x + xtile, y + ytile),
- i32(s, i) + 28,
- (self.rawmode, s[12:16]),
- )
- )
-
- elif compression == 2:
-
- internal_color_conversion = i8(s[14])
- jpeg_tables = i8(s[15])
- rawmode = self.rawmode
-
- if internal_color_conversion:
- # The image is stored as usual (usually YCbCr).
- if rawmode == "RGBA":
- # For "RGBA", data is stored as YCbCrA based on
- # negative RGB. The following trick works around
- # this problem :
- jpegmode, rawmode = "YCbCrK", "CMYK"
- else:
- jpegmode = None # let the decoder decide
-
- else:
- # The image is stored as defined by rawmode
- jpegmode = rawmode
|
[-]
[+]
|
Deleted |
_service:tar_git:harbour-simplecrop-1.0+main.20210420100251.4.g6bfb428.tar.bz2/lib/arm64/PIL/FtexImagePlugin.py
^
|
@@ -1,106 +0,0 @@
-"""
-A Pillow loader for .ftc and .ftu files (FTEX)
-Jerome Leclanche <jerome@leclan.ch>
-
-The contents of this file are hereby released in the public domain (CC0)
-Full text of the CC0 license:
- https://creativecommons.org/publicdomain/zero/1.0/
-
-Independence War 2: Edge Of Chaos - Texture File Format - 16 October 2001
-
-The textures used for 3D objects in Independence War 2: Edge Of Chaos are in a
-packed custom format called FTEX. This file format uses file extensions FTC
-and FTU.
-* FTC files are compressed textures (using standard texture compression).
-* FTU files are not compressed.
-Texture File Format
-The FTC and FTU texture files both use the same format. This
-has the following structure:
-{header}
-{format_directory}
-{data}
-Where:
-{header} = {
- u32:magic,
- u32:version,
- u32:width,
- u32:height,
- u32:mipmap_count,
- u32:format_count
-}
-
-* The "magic" number is "FTEX".
-* "width" and "height" are the dimensions of the texture.
-* "mipmap_count" is the number of mipmaps in the texture.
-* "format_count" is the number of texture formats (different versions of the
-same texture) in this file.
-
-{format_directory} = format_count * { u32:format, u32:where }
-
-The format value is 0 for DXT1 compressed textures and 1 for 24-bit RGB
-uncompressed textures.
-The texture data for a format starts at the position "where" in the file.
-
-Each set of texture data in the file has the following structure:
-{data} = format_count * { u32:mipmap_size, mipmap_size * { u8 } }
-* "mipmap_size" is the number of bytes in that mip level. For compressed
-textures this is the size of the texture data compressed with DXT1. For 24 bit
-uncompressed textures, this is 3 * width * height. Following this are the image
-bytes for that mipmap level.
-
-Note: All data is stored in little-Endian (Intel) byte order.
-"""
-
-import struct
-from io import BytesIO
-
-from . import Image, ImageFile
-
-MAGIC = b"FTEX"
-FORMAT_DXT1 = 0
-FORMAT_UNCOMPRESSED = 1
-
-
-class FtexImageFile(ImageFile.ImageFile):
- format = "FTEX"
- format_description = "Texture File Format (IW2:EOC)"
-
- def _open(self):
- struct.unpack("<I", self.fp.read(4)) # magic
- struct.unpack("<i", self.fp.read(4)) # version
- self._size = struct.unpack("<2i", self.fp.read(8))
- mipmap_count, format_count = struct.unpack("<2i", self.fp.read(8))
-
- self.mode = "RGB"
-
- # Only support single-format files.
- # I don't know of any multi-format file.
- assert format_count == 1
-
- format, where = struct.unpack("<2i", self.fp.read(8))
- self.fp.seek(where)
- (mipmap_size,) = struct.unpack("<i", self.fp.read(4))
-
- data = self.fp.read(mipmap_size)
-
- if format == FORMAT_DXT1:
- self.mode = "RGBA"
- self.tile = [("bcn", (0, 0) + self.size, 0, (1))]
- elif format == FORMAT_UNCOMPRESSED:
- self.tile = [("raw", (0, 0) + self.size, 0, ("RGB", 0, 1))]
- else:
- raise ValueError("Invalid texture compression format: %r" % (format))
-
- self.fp.close()
- self.fp = BytesIO(data)
-
- def load_seek(self, pos):
- pass
-
-
-def _validate(prefix):
- return prefix[:4] == MAGIC
-
-
-Image.register_open(FtexImageFile.format, FtexImageFile, _validate)
-Image.register_extensions(FtexImageFile.format, [".ftc", ".ftu"])
|
[-]
[+]
|
Deleted |
_service:tar_git:harbour-simplecrop-1.0+main.20210420100251.4.g6bfb428.tar.bz2/lib/arm64/PIL/GbrImagePlugin.py
^
|
@@ -1,100 +0,0 @@
-#
-# The Python Imaging Library
-#
-# load a GIMP brush file
-#
-# History:
-# 96-03-14 fl Created
-# 16-01-08 es Version 2
-#
-# Copyright (c) Secret Labs AB 1997.
-# Copyright (c) Fredrik Lundh 1996.
-# Copyright (c) Eric Soroos 2016.
-#
-# See the README file for information on usage and redistribution.
-#
-#
-# See https://github.com/GNOME/gimp/blob/mainline/devel-docs/gbr.txt for
-# format documentation.
-#
-# This code Interprets version 1 and 2 .gbr files.
-# Version 1 files are obsolete, and should not be used for new
-# brushes.
-# Version 2 files are saved by GIMP v2.8 (at least)
-# Version 3 files have a format specifier of 18 for 16bit floats in
-# the color depth field. This is currently unsupported by Pillow.
-
-from . import Image, ImageFile
-from ._binary import i32be as i32
-
-
-def _accept(prefix):
- return len(prefix) >= 8 and i32(prefix[:4]) >= 20 and i32(prefix[4:8]) in (1, 2)
-
-
-##
-# Image plugin for the GIMP brush format.
-
-
-class GbrImageFile(ImageFile.ImageFile):
-
- format = "GBR"
- format_description = "GIMP brush file"
-
- def _open(self):
- header_size = i32(self.fp.read(4))
- version = i32(self.fp.read(4))
- if header_size < 20:
- raise SyntaxError("not a GIMP brush")
- if version not in (1, 2):
- raise SyntaxError("Unsupported GIMP brush version: %s" % version)
-
- width = i32(self.fp.read(4))
- height = i32(self.fp.read(4))
- color_depth = i32(self.fp.read(4))
- if width <= 0 or height <= 0:
- raise SyntaxError("not a GIMP brush")
- if color_depth not in (1, 4):
- raise SyntaxError("Unsupported GIMP brush color depth: %s" % color_depth)
-
- if version == 1:
- comment_length = header_size - 20
- else:
- comment_length = header_size - 28
- magic_number = self.fp.read(4)
- if magic_number != b"GIMP":
- raise SyntaxError("not a GIMP brush, bad magic number")
- self.info["spacing"] = i32(self.fp.read(4))
-
- comment = self.fp.read(comment_length)[:-1]
-
- if color_depth == 1:
- self.mode = "L"
- else:
- self.mode = "RGBA"
-
- self._size = width, height
-
- self.info["comment"] = comment
-
- # Image might not be small
- Image._decompression_bomb_check(self.size)
-
- # Data is an uncompressed block of w * h * bytes/pixel
- self._data_size = width * height * color_depth
-
- def load(self):
- if self.im:
- # Already loaded
- return
-
- self.im = Image.core.new(self.mode, self.size)
- self.frombytes(self.fp.read(self._data_size))
-
-
-#
-# registry
-
-
-Image.register_open(GbrImageFile.format, GbrImageFile, _accept)
-Image.register_extension(GbrImageFile.format, ".gbr")
|
[-]
[+]
|
Deleted |
_service:tar_git:harbour-simplecrop-1.0+main.20210420100251.4.g6bfb428.tar.bz2/lib/arm64/PIL/GdImageFile.py
^
|
@@ -1,89 +0,0 @@
-#
-# The Python Imaging Library.
-# $Id$
-#
-# GD file handling
-#
-# History:
-# 1996-04-12 fl Created
-#
-# Copyright (c) 1997 by Secret Labs AB.
-# Copyright (c) 1996 by Fredrik Lundh.
-#
-# See the README file for information on usage and redistribution.
-#
-
-
-"""
-.. note::
- This format cannot be automatically recognized, so the
- class is not registered for use with :py:func:`PIL.Image.open()`. To open a
- gd file, use the :py:func:`PIL.GdImageFile.open()` function instead.
-
-.. warning::
- THE GD FORMAT IS NOT DESIGNED FOR DATA INTERCHANGE. This
- implementation is provided for convenience and demonstrational
- purposes only.
-"""
-
-
-from . import ImageFile, ImagePalette, UnidentifiedImageError
-from ._binary import i8, i16be as i16, i32be as i32
-
-
-class GdImageFile(ImageFile.ImageFile):
- """
- Image plugin for the GD uncompressed format. Note that this format
- is not supported by the standard :py:func:`PIL.Image.open()` function. To use
- this plugin, you have to import the :py:mod:`PIL.GdImageFile` module and
- use the :py:func:`PIL.GdImageFile.open()` function.
- """
-
- format = "GD"
- format_description = "GD uncompressed images"
-
- def _open(self):
-
- # Header
- s = self.fp.read(1037)
-
- if not i16(s[:2]) in [65534, 65535]:
- raise SyntaxError("Not a valid GD 2.x .gd file")
-
- self.mode = "L" # FIXME: "P"
- self._size = i16(s[2:4]), i16(s[4:6])
-
- trueColor = i8(s[6])
- trueColorOffset = 2 if trueColor else 0
-
- # transparency index
- tindex = i32(s[7 + trueColorOffset : 7 + trueColorOffset + 4])
- if tindex < 256:
- self.info["transparency"] = tindex
-
- self.palette = ImagePalette.raw(
- "XBGR", s[7 + trueColorOffset + 4 : 7 + trueColorOffset + 4 + 256 * 4]
- )
-
- self.tile = [
- ("raw", (0, 0) + self.size, 7 + trueColorOffset + 4 + 256 * 4, ("L", 0, 1))
- ]
-
-
-def open(fp, mode="r"):
- """
- Load texture from a GD image file.
-
- :param filename: GD file name, or an opened file handle.
- :param mode: Optional mode. In this version, if the mode argument
- is given, it must be "r".
- :returns: An image instance.
- :raises OSError: If the image could not be read.
- """
- if mode != "r":
- raise ValueError("bad mode")
-
- try:
- return GdImageFile(fp)
- except SyntaxError as e:
- raise UnidentifiedImageError("cannot identify this image file") from e
|
[-]
[+]
|
Deleted |
_service:tar_git:harbour-simplecrop-1.0+main.20210420100251.4.g6bfb428.tar.bz2/lib/arm64/PIL/GifImagePlugin.py
^
|
@@ -1,885 +0,0 @@
-#
-# The Python Imaging Library.
-# $Id$
-#
-# GIF file handling
-#
-# History:
-# 1995-09-01 fl Created
-# 1996-12-14 fl Added interlace support
-# 1996-12-30 fl Added animation support
-# 1997-01-05 fl Added write support, fixed local colour map bug
-# 1997-02-23 fl Make sure to load raster data in getdata()
-# 1997-07-05 fl Support external decoder (0.4)
-# 1998-07-09 fl Handle all modes when saving (0.5)
-# 1998-07-15 fl Renamed offset attribute to avoid name clash
-# 2001-04-16 fl Added rewind support (seek to frame 0) (0.6)
-# 2001-04-17 fl Added palette optimization (0.7)
-# 2002-06-06 fl Added transparency support for save (0.8)
-# 2004-02-24 fl Disable interlacing for small images
-#
-# Copyright (c) 1997-2004 by Secret Labs AB
-# Copyright (c) 1995-2004 by Fredrik Lundh
-#
-# See the README file for information on usage and redistribution.
-#
-
-import itertools
-import math
-import os
-import subprocess
-
-from . import Image, ImageChops, ImageFile, ImagePalette, ImageSequence
-from ._binary import i8, i16le as i16, o8, o16le as o16
-
-# --------------------------------------------------------------------
-# Identify/read GIF files
-
-
-def _accept(prefix):
- return prefix[:6] in [b"GIF87a", b"GIF89a"]
-
-
-##
-# Image plugin for GIF images. This plugin supports both GIF87 and
-# GIF89 images.
-
-
-class GifImageFile(ImageFile.ImageFile):
-
- format = "GIF"
- format_description = "Compuserve GIF"
- _close_exclusive_fp_after_loading = False
-
- global_palette = None
-
- def data(self):
- s = self.fp.read(1)
- if s and i8(s):
- return self.fp.read(i8(s))
- return None
-
- def _open(self):
-
- # Screen
- s = self.fp.read(13)
- if not _accept(s):
- raise SyntaxError("not a GIF file")
-
- self.info["version"] = s[:6]
- self._size = i16(s[6:]), i16(s[8:])
- self.tile = []
- flags = i8(s[10])
- bits = (flags & 7) + 1
-
- if flags & 128:
- # get global palette
- self.info["background"] = i8(s[11])
- # check if palette contains colour indices
- p = self.fp.read(3 << bits)
- for i in range(0, len(p), 3):
- if not (i // 3 == i8(p[i]) == i8(p[i + 1]) == i8(p[i + 2])):
- p = ImagePalette.raw("RGB", p)
- self.global_palette = self.palette = p
- break
-
- self.__fp = self.fp # FIXME: hack
- self.__rewind = self.fp.tell()
- self._n_frames = None
- self._is_animated = None
- self._seek(0) # get ready to read first frame
-
- @property
- def n_frames(self):
- if self._n_frames is None:
- current = self.tell()
- try:
- while True:
- self.seek(self.tell() + 1)
- except EOFError:
- self._n_frames = self.tell() + 1
- self.seek(current)
- return self._n_frames
-
- @property
- def is_animated(self):
- if self._is_animated is None:
- if self._n_frames is not None:
- self._is_animated = self._n_frames != 1
- else:
- current = self.tell()
-
- try:
- self.seek(1)
- self._is_animated = True
- except EOFError:
- self._is_animated = False
-
- self.seek(current)
- return self._is_animated
-
- def seek(self, frame):
- if not self._seek_check(frame):
- return
- if frame < self.__frame:
- if frame != 0:
- self.im = None
- self._seek(0)
-
- last_frame = self.__frame
- for f in range(self.__frame + 1, frame + 1):
- try:
- self._seek(f)
- except EOFError as e:
- self.seek(last_frame)
- raise EOFError("no more images in GIF file") from e
-
- def _seek(self, frame):
-
- if frame == 0:
- # rewind
- self.__offset = 0
- self.dispose = None
- self.dispose_extent = [0, 0, 0, 0] # x0, y0, x1, y1
- self.__frame = -1
- self.__fp.seek(self.__rewind)
- self._prev_im = None
- self.disposal_method = 0
- else:
- # ensure that the previous frame was loaded
- if not self.im:
- self.load()
-
- if frame != self.__frame + 1:
- raise ValueError("cannot seek to frame %d" % frame)
- self.__frame = frame
-
- self.tile = []
-
- self.fp = self.__fp
- if self.__offset:
- # backup to last frame
- self.fp.seek(self.__offset)
- while self.data():
- pass
- self.__offset = 0
-
- if self.dispose:
- self.im.paste(self.dispose, self.dispose_extent)
-
- from copy import copy
-
- self.palette = copy(self.global_palette)
-
- info = {}
- while True:
-
- s = self.fp.read(1)
- if not s or s == b";":
- break
-
- elif s == b"!":
- #
- # extensions
- #
- s = self.fp.read(1)
- block = self.data()
- if i8(s) == 249:
- #
- # graphic control extension
- #
- flags = i8(block[0])
- if flags & 1:
- info["transparency"] = i8(block[3])
- info["duration"] = i16(block[1:3]) * 10
-
- # disposal method - find the value of bits 4 - 6
- dispose_bits = 0b00011100 & flags
- dispose_bits = dispose_bits >> 2
- if dispose_bits:
|
[-]
[+]
|
Deleted |
_service:tar_git:harbour-simplecrop-1.0+main.20210420100251.4.g6bfb428.tar.bz2/lib/arm64/PIL/GimpGradientFile.py
^
|
@@ -1,140 +0,0 @@
-#
-# Python Imaging Library
-# $Id$
-#
-# stuff to read (and render) GIMP gradient files
-#
-# History:
-# 97-08-23 fl Created
-#
-# Copyright (c) Secret Labs AB 1997.
-# Copyright (c) Fredrik Lundh 1997.
-#
-# See the README file for information on usage and redistribution.
-#
-
-"""
-Stuff to translate curve segments to palette values (derived from
-the corresponding code in GIMP, written by Federico Mena Quintero.
-See the GIMP distribution for more information.)
-"""
-
-
-from math import log, pi, sin, sqrt
-
-from ._binary import o8
-
-EPSILON = 1e-10
-"""""" # Enable auto-doc for data member
-
-
-def linear(middle, pos):
- if pos <= middle:
- if middle < EPSILON:
- return 0.0
- else:
- return 0.5 * pos / middle
- else:
- pos = pos - middle
- middle = 1.0 - middle
- if middle < EPSILON:
- return 1.0
- else:
- return 0.5 + 0.5 * pos / middle
-
-
-def curved(middle, pos):
- return pos ** (log(0.5) / log(max(middle, EPSILON)))
-
-
-def sine(middle, pos):
- return (sin((-pi / 2.0) + pi * linear(middle, pos)) + 1.0) / 2.0
-
-
-def sphere_increasing(middle, pos):
- return sqrt(1.0 - (linear(middle, pos) - 1.0) ** 2)
-
-
-def sphere_decreasing(middle, pos):
- return 1.0 - sqrt(1.0 - linear(middle, pos) ** 2)
-
-
-SEGMENTS = [linear, curved, sine, sphere_increasing, sphere_decreasing]
-"""""" # Enable auto-doc for data member
-
-
-class GradientFile:
-
- gradient = None
-
- def getpalette(self, entries=256):
-
- palette = []
-
- ix = 0
- x0, x1, xm, rgb0, rgb1, segment = self.gradient[ix]
-
- for i in range(entries):
-
- x = i / (entries - 1)
-
- while x1 < x:
- ix += 1
- x0, x1, xm, rgb0, rgb1, segment = self.gradient[ix]
-
- w = x1 - x0
-
- if w < EPSILON:
- scale = segment(0.5, 0.5)
- else:
- scale = segment((xm - x0) / w, (x - x0) / w)
-
- # expand to RGBA
- r = o8(int(255 * ((rgb1[0] - rgb0[0]) * scale + rgb0[0]) + 0.5))
- g = o8(int(255 * ((rgb1[1] - rgb0[1]) * scale + rgb0[1]) + 0.5))
- b = o8(int(255 * ((rgb1[2] - rgb0[2]) * scale + rgb0[2]) + 0.5))
- a = o8(int(255 * ((rgb1[3] - rgb0[3]) * scale + rgb0[3]) + 0.5))
-
- # add to palette
- palette.append(r + g + b + a)
-
- return b"".join(palette), "RGBA"
-
-
-class GimpGradientFile(GradientFile):
- """File handler for GIMP's gradient format."""
-
- def __init__(self, fp):
-
- if fp.readline()[:13] != b"GIMP Gradient":
- raise SyntaxError("not a GIMP gradient file")
-
- line = fp.readline()
-
- # GIMP 1.2 gradient files don't contain a name, but GIMP 1.3 files do
- if line.startswith(b"Name: "):
- line = fp.readline().strip()
-
- count = int(line)
-
- gradient = []
-
- for i in range(count):
-
- s = fp.readline().split()
- w = [float(x) for x in s[:11]]
-
- x0, x1 = w[0], w[2]
- xm = w[1]
- rgb0 = w[3:7]
- rgb1 = w[7:11]
-
- segment = SEGMENTS[int(s[11])]
- cspace = int(s[12])
-
- if cspace != 0:
- raise OSError("cannot handle HSV colour space")
-
- gradient.append((x0, x1, xm, rgb0, rgb1, segment))
-
- self.gradient = gradient
|
[-]
[+]
|
Deleted |
_service:tar_git:harbour-simplecrop-1.0+main.20210420100251.4.g6bfb428.tar.bz2/lib/arm64/PIL/GimpPaletteFile.py
^
|
@@ -1,56 +0,0 @@
-#
-# Python Imaging Library
-# $Id$
-#
-# stuff to read GIMP palette files
-#
-# History:
-# 1997-08-23 fl Created
-# 2004-09-07 fl Support GIMP 2.0 palette files.
-#
-# Copyright (c) Secret Labs AB 1997-2004. All rights reserved.
-# Copyright (c) Fredrik Lundh 1997-2004.
-#
-# See the README file for information on usage and redistribution.
-#
-
-import re
-
-from ._binary import o8
-
-
-class GimpPaletteFile:
- """File handler for GIMP's palette format."""
-
- rawmode = "RGB"
-
- def __init__(self, fp):
-
- self.palette = [o8(i) * 3 for i in range(256)]
-
- if fp.readline()[:12] != b"GIMP Palette":
- raise SyntaxError("not a GIMP palette file")
-
- for i in range(256):
-
- s = fp.readline()
- if not s:
- break
-
- # skip fields and comment lines
- if re.match(br"\w+:|#", s):
- continue
- if len(s) > 100:
- raise SyntaxError("bad palette file")
-
- v = tuple(map(int, s.split()[:3]))
- if len(v) != 3:
- raise ValueError("bad palette entry")
-
- self.palette[i] = o8(v[0]) + o8(v[1]) + o8(v[2])
-
- self.palette = b"".join(self.palette)
-
- def getpalette(self):
-
- return self.palette, self.rawmode
|
[-]
[+]
|
Deleted |
_service:tar_git:harbour-simplecrop-1.0+main.20210420100251.4.g6bfb428.tar.bz2/lib/arm64/PIL/GribStubImagePlugin.py
^
|
@@ -1,74 +0,0 @@
-#
-# The Python Imaging Library
-# $Id$
-#
-# GRIB stub adapter
-#
-# Copyright (c) 1996-2003 by Fredrik Lundh
-#
-# See the README file for information on usage and redistribution.
-#
-
-from . import Image, ImageFile
-from ._binary import i8
-
-_handler = None
-
-
-def register_handler(handler):
- """
- Install application-specific GRIB image handler.
-
- :param handler: Handler object.
- """
- global _handler
- _handler = handler
-
-
-# --------------------------------------------------------------------
-# Image adapter
-
-
-def _accept(prefix):
- return prefix[0:4] == b"GRIB" and i8(prefix[7]) == 1
-
-
-class GribStubImageFile(ImageFile.StubImageFile):
-
- format = "GRIB"
- format_description = "GRIB"
-
- def _open(self):
-
- offset = self.fp.tell()
-
- if not _accept(self.fp.read(8)):
- raise SyntaxError("Not a GRIB file")
-
- self.fp.seek(offset)
-
- # make something up
- self.mode = "F"
- self._size = 1, 1
-
- loader = self._load()
- if loader:
- loader.open(self)
-
- def _load(self):
- return _handler
-
-
-def _save(im, fp, filename):
- if _handler is None or not hasattr("_handler", "save"):
- raise OSError("GRIB save handler not installed")
- _handler.save(im, fp, filename)
-
-
-# --------------------------------------------------------------------
-# Registry
-
-Image.register_open(GribStubImageFile.format, GribStubImageFile, _accept)
-Image.register_save(GribStubImageFile.format, _save)
-
-Image.register_extension(GribStubImageFile.format, ".grib")
|
[-]
[+]
|
Deleted |
_service:tar_git:harbour-simplecrop-1.0+main.20210420100251.4.g6bfb428.tar.bz2/lib/arm64/PIL/Hdf5StubImagePlugin.py
^
|
@@ -1,73 +0,0 @@
-#
-# The Python Imaging Library
-# $Id$
-#
-# HDF5 stub adapter
-#
-# Copyright (c) 2000-2003 by Fredrik Lundh
-#
-# See the README file for information on usage and redistribution.
-#
-
-from . import Image, ImageFile
-
-_handler = None
-
-
-def register_handler(handler):
- """
- Install application-specific HDF5 image handler.
-
- :param handler: Handler object.
- """
- global _handler
- _handler = handler
-
-
-# --------------------------------------------------------------------
-# Image adapter
-
-
-def _accept(prefix):
- return prefix[:8] == b"\x89HDF\r\n\x1a\n"
-
-
-class HDF5StubImageFile(ImageFile.StubImageFile):
-
- format = "HDF5"
- format_description = "HDF5"
-
- def _open(self):
-
- offset = self.fp.tell()
-
- if not _accept(self.fp.read(8)):
- raise SyntaxError("Not an HDF file")
-
- self.fp.seek(offset)
-
- # make something up
- self.mode = "F"
- self._size = 1, 1
-
- loader = self._load()
- if loader:
- loader.open(self)
-
- def _load(self):
- return _handler
-
-
-def _save(im, fp, filename):
- if _handler is None or not hasattr("_handler", "save"):
- raise OSError("HDF5 save handler not installed")
- _handler.save(im, fp, filename)
-
-
-# --------------------------------------------------------------------
-# Registry
-
-Image.register_open(HDF5StubImageFile.format, HDF5StubImageFile, _accept)
-Image.register_save(HDF5StubImageFile.format, _save)
-
-Image.register_extensions(HDF5StubImageFile.format, [".h5", ".hdf"])
|
[-]
[+]
|
Deleted |
_service:tar_git:harbour-simplecrop-1.0+main.20210420100251.4.g6bfb428.tar.bz2/lib/arm64/PIL/IcnsImagePlugin.py
^
|
@@ -1,384 +0,0 @@
-#
-# The Python Imaging Library.
-# $Id$
-#
-# macOS icns file decoder, based on icns.py by Bob Ippolito.
-#
-# history:
-# 2004-10-09 fl Turned into a PIL plugin; removed 2.3 dependencies.
-#
-# Copyright (c) 2004 by Bob Ippolito.
-# Copyright (c) 2004 by Secret Labs.
-# Copyright (c) 2004 by Fredrik Lundh.
-# Copyright (c) 2014 by Alastair Houghton.
-#
-# See the README file for information on usage and redistribution.
-#
-
-import io
-import os
-import shutil
-import struct
-import subprocess
-import sys
-import tempfile
-
-from PIL import Image, ImageFile, PngImagePlugin, features
-from PIL._binary import i8
-
-enable_jpeg2k = features.check_codec("jpg_2000")
-if enable_jpeg2k:
- from PIL import Jpeg2KImagePlugin
-
-HEADERSIZE = 8
-
-
-def nextheader(fobj):
- return struct.unpack(">4sI", fobj.read(HEADERSIZE))
-
-
-def read_32t(fobj, start_length, size):
- # The 128x128 icon seems to have an extra header for some reason.
- (start, length) = start_length
- fobj.seek(start)
- sig = fobj.read(4)
- if sig != b"\x00\x00\x00\x00":
- raise SyntaxError("Unknown signature, expecting 0x00000000")
- return read_32(fobj, (start + 4, length - 4), size)
-
-
-def read_32(fobj, start_length, size):
- """
- Read a 32bit RGB icon resource. Seems to be either uncompressed or
- an RLE packbits-like scheme.
- """
- (start, length) = start_length
- fobj.seek(start)
- pixel_size = (size[0] * size[2], size[1] * size[2])
- sizesq = pixel_size[0] * pixel_size[1]
- if length == sizesq * 3:
- # uncompressed ("RGBRGBGB")
- indata = fobj.read(length)
- im = Image.frombuffer("RGB", pixel_size, indata, "raw", "RGB", 0, 1)
- else:
- # decode image
- im = Image.new("RGB", pixel_size, None)
- for band_ix in range(3):
- data = []
- bytesleft = sizesq
- while bytesleft > 0:
- byte = fobj.read(1)
- if not byte:
- break
- byte = i8(byte)
- if byte & 0x80:
- blocksize = byte - 125
- byte = fobj.read(1)
- for i in range(blocksize):
- data.append(byte)
- else:
- blocksize = byte + 1
- data.append(fobj.read(blocksize))
- bytesleft -= blocksize
- if bytesleft <= 0:
- break
- if bytesleft != 0:
- raise SyntaxError("Error reading channel [%r left]" % bytesleft)
- band = Image.frombuffer("L", pixel_size, b"".join(data), "raw", "L", 0, 1)
- im.im.putband(band.im, band_ix)
- return {"RGB": im}
-
-
-def read_mk(fobj, start_length, size):
- # Alpha masks seem to be uncompressed
- start = start_length[0]
- fobj.seek(start)
- pixel_size = (size[0] * size[2], size[1] * size[2])
- sizesq = pixel_size[0] * pixel_size[1]
- band = Image.frombuffer("L", pixel_size, fobj.read(sizesq), "raw", "L", 0, 1)
- return {"A": band}
-
-
-def read_png_or_jpeg2000(fobj, start_length, size):
- (start, length) = start_length
- fobj.seek(start)
- sig = fobj.read(12)
- if sig[:8] == b"\x89PNG\x0d\x0a\x1a\x0a":
- fobj.seek(start)
- im = PngImagePlugin.PngImageFile(fobj)
- return {"RGBA": im}
- elif (
- sig[:4] == b"\xff\x4f\xff\x51"
- or sig[:4] == b"\x0d\x0a\x87\x0a"
- or sig == b"\x00\x00\x00\x0cjP \x0d\x0a\x87\x0a"
- ):
- if not enable_jpeg2k:
- raise ValueError(
- "Unsupported icon subimage format (rebuild PIL "
- "with JPEG 2000 support to fix this)"
- )
- # j2k, jpc or j2c
- fobj.seek(start)
- jp2kstream = fobj.read(length)
- f = io.BytesIO(jp2kstream)
- im = Jpeg2KImagePlugin.Jpeg2KImageFile(f)
- if im.mode != "RGBA":
- im = im.convert("RGBA")
- return {"RGBA": im}
- else:
- raise ValueError("Unsupported icon subimage format")
-
-
-class IcnsFile:
-
- SIZES = {
- (512, 512, 2): [(b"ic10", read_png_or_jpeg2000)],
- (512, 512, 1): [(b"ic09", read_png_or_jpeg2000)],
- (256, 256, 2): [(b"ic14", read_png_or_jpeg2000)],
- (256, 256, 1): [(b"ic08", read_png_or_jpeg2000)],
- (128, 128, 2): [(b"ic13", read_png_or_jpeg2000)],
- (128, 128, 1): [
- (b"ic07", read_png_or_jpeg2000),
- (b"it32", read_32t),
- (b"t8mk", read_mk),
- ],
- (64, 64, 1): [(b"icp6", read_png_or_jpeg2000)],
- (32, 32, 2): [(b"ic12", read_png_or_jpeg2000)],
- (48, 48, 1): [(b"ih32", read_32), (b"h8mk", read_mk)],
- (32, 32, 1): [
- (b"icp5", read_png_or_jpeg2000),
- (b"il32", read_32),
- (b"l8mk", read_mk),
- ],
- (16, 16, 2): [(b"ic11", read_png_or_jpeg2000)],
- (16, 16, 1): [
- (b"icp4", read_png_or_jpeg2000),
- (b"is32", read_32),
- (b"s8mk", read_mk),
- ],
- }
-
- def __init__(self, fobj):
- """
- fobj is a file-like object as an icns resource
- """
- # signature : (start, length)
- self.dct = dct = {}
- self.fobj = fobj
- sig, filesize = nextheader(fobj)
- if sig != b"icns":
- raise SyntaxError("not an icns file")
- i = HEADERSIZE
- while i < filesize:
- sig, blocksize = nextheader(fobj)
- if blocksize <= 0:
- raise SyntaxError("invalid block header")
- i += HEADERSIZE
- blocksize -= HEADERSIZE
- dct[sig] = (i, blocksize)
- fobj.seek(blocksize, io.SEEK_CUR)
- i += blocksize
-
- def itersizes(self):
- sizes = []
- for size, fmts in self.SIZES.items():
- for (fmt, reader) in fmts:
- if fmt in self.dct:
- sizes.append(size)
- break
- return sizes
-
- def bestsize(self):
- sizes = self.itersizes()
- if not sizes:
- raise SyntaxError("No 32bit icon resources found")
- return max(sizes)
-
- def dataforsize(self, size):
- """
- Get an icon resource as {channel: array}. Note that
|
[-]
[+]
|
Deleted |
_service:tar_git:harbour-simplecrop-1.0+main.20210420100251.4.g6bfb428.tar.bz2/lib/arm64/PIL/IcoImagePlugin.py
^
|
@@ -1,324 +0,0 @@
-#
-# The Python Imaging Library.
-# $Id$
-#
-# Windows Icon support for PIL
-#
-# History:
-# 96-05-27 fl Created
-#
-# Copyright (c) Secret Labs AB 1997.
-# Copyright (c) Fredrik Lundh 1996.
-#
-# See the README file for information on usage and redistribution.
-#
-
-# This plugin is a refactored version of Win32IconImagePlugin by Bryan Davis
-# <casadebender@gmail.com>.
-# https://code.google.com/archive/p/casadebender/wikis/Win32IconImagePlugin.wiki
-#
-# Icon format references:
-# * https://en.wikipedia.org/wiki/ICO_(file_format)
-# * https://msdn.microsoft.com/en-us/library/ms997538.aspx
-
-
-import struct
-import warnings
-from io import BytesIO
-from math import ceil, log
-
-from . import BmpImagePlugin, Image, ImageFile, PngImagePlugin
-from ._binary import i8, i16le as i16, i32le as i32
-
-#
-# --------------------------------------------------------------------
-
-_MAGIC = b"\0\0\1\0"
-
-
-def _save(im, fp, filename):
- fp.write(_MAGIC) # (2+2)
- sizes = im.encoderinfo.get(
- "sizes",
- [(16, 16), (24, 24), (32, 32), (48, 48), (64, 64), (128, 128), (256, 256)],
- )
- width, height = im.size
- sizes = filter(
- lambda x: False
- if (x[0] > width or x[1] > height or x[0] > 256 or x[1] > 256)
- else True,
- sizes,
- )
- sizes = list(sizes)
- fp.write(struct.pack("<H", len(sizes))) # idCount(2)
- offset = fp.tell() + len(sizes) * 16
- for size in sizes:
- width, height = size
- # 0 means 256
- fp.write(struct.pack("B", width if width < 256 else 0)) # bWidth(1)
- fp.write(struct.pack("B", height if height < 256 else 0)) # bHeight(1)
- fp.write(b"\0") # bColorCount(1)
- fp.write(b"\0") # bReserved(1)
- fp.write(b"\0\0") # wPlanes(2)
- fp.write(struct.pack("<H", 32)) # wBitCount(2)
-
- image_io = BytesIO()
- # TODO: invent a more convenient method for proportional scalings
- tmp = im.copy()
- tmp.thumbnail(size, Image.LANCZOS, reducing_gap=None)
- tmp.save(image_io, "png")
- image_io.seek(0)
- image_bytes = image_io.read()
- bytes_len = len(image_bytes)
- fp.write(struct.pack("<I", bytes_len)) # dwBytesInRes(4)
- fp.write(struct.pack("<I", offset)) # dwImageOffset(4)
- current = fp.tell()
- fp.seek(offset)
- fp.write(image_bytes)
- offset = offset + bytes_len
- fp.seek(current)
-
-
-def _accept(prefix):
- return prefix[:4] == _MAGIC
-
-
-class IcoFile:
- def __init__(self, buf):
- """
- Parse image from file-like object containing ico file data
- """
-
- # check magic
- s = buf.read(6)
- if not _accept(s):
- raise SyntaxError("not an ICO file")
-
- self.buf = buf
- self.entry = []
-
- # Number of items in file
- self.nb_items = i16(s[4:])
-
- # Get headers for each item
- for i in range(self.nb_items):
- s = buf.read(16)
-
- icon_header = {
- "width": i8(s[0]),
- "height": i8(s[1]),
- "nb_color": i8(s[2]), # No. of colors in image (0 if >=8bpp)
- "reserved": i8(s[3]),
- "planes": i16(s[4:]),
- "bpp": i16(s[6:]),
- "size": i32(s[8:]),
- "offset": i32(s[12:]),
- }
-
- # See Wikipedia
- for j in ("width", "height"):
- if not icon_header[j]:
- icon_header[j] = 256
-
- # See Wikipedia notes about color depth.
- # We need this just to differ images with equal sizes
- icon_header["color_depth"] = (
- icon_header["bpp"]
- or (
- icon_header["nb_color"] != 0
- and ceil(log(icon_header["nb_color"], 2))
- )
- or 256
- )
-
- icon_header["dim"] = (icon_header["width"], icon_header["height"])
- icon_header["square"] = icon_header["width"] * icon_header["height"]
-
- self.entry.append(icon_header)
-
- self.entry = sorted(self.entry, key=lambda x: x["color_depth"])
- # ICO images are usually squares
- # self.entry = sorted(self.entry, key=lambda x: x['width'])
- self.entry = sorted(self.entry, key=lambda x: x["square"])
- self.entry.reverse()
-
- def sizes(self):
- """
- Get a list of all available icon sizes and color depths.
- """
- return {(h["width"], h["height"]) for h in self.entry}
-
- def getentryindex(self, size, bpp=False):
- for (i, h) in enumerate(self.entry):
- if size == h["dim"] and (bpp is False or bpp == h["color_depth"]):
- return i
- return 0
-
- def getimage(self, size, bpp=False):
- """
- Get an image from the icon
- """
- return self.frame(self.getentryindex(size, bpp))
-
- def frame(self, idx):
- """
- Get an image from frame idx
- """
-
- header = self.entry[idx]
-
- self.buf.seek(header["offset"])
- data = self.buf.read(8)
- self.buf.seek(header["offset"])
-
- if data[:8] == PngImagePlugin._MAGIC:
- # png frame
- im = PngImagePlugin.PngImageFile(self.buf)
- else:
- # XOR + AND mask bmp frame
- im = BmpImagePlugin.DibImageFile(self.buf)
- Image._decompression_bomb_check(im.size)
-
- # change tile dimension to only encompass XOR image
- im._size = (im.size[0], int(im.size[1] / 2))
- d, e, o, a = im.tile[0]
- im.tile[0] = d, (0, 0) + im.size, o, a
-
- # figure out where AND mask image starts
- mode = a[0]
- bpp = 8
- for k, v in BmpImagePlugin.BIT2MODE.items():
- if mode == v[1]:
- bpp = k
- break
-
- if 32 == bpp:
- # 32-bit color depth icon image allows semitransparent areas
- # PIL's DIB format ignores transparency bits, recover them.
- # The DIB is packed in BGRX byte order where X is the alpha
- # channel.
|
[-]
[+]
|
Deleted |
_service:tar_git:harbour-simplecrop-1.0+main.20210420100251.4.g6bfb428.tar.bz2/lib/arm64/PIL/ImImagePlugin.py
^
|
@@ -1,377 +0,0 @@
-#
-# The Python Imaging Library.
-# $Id$
-#
-# IFUNC IM file handling for PIL
-#
-# history:
-# 1995-09-01 fl Created.
-# 1997-01-03 fl Save palette images
-# 1997-01-08 fl Added sequence support
-# 1997-01-23 fl Added P and RGB save support
-# 1997-05-31 fl Read floating point images
-# 1997-06-22 fl Save floating point images
-# 1997-08-27 fl Read and save 1-bit images
-# 1998-06-25 fl Added support for RGB+LUT images
-# 1998-07-02 fl Added support for YCC images
-# 1998-07-15 fl Renamed offset attribute to avoid name clash
-# 1998-12-29 fl Added I;16 support
-# 2001-02-17 fl Use 're' instead of 'regex' (Python 2.1) (0.7)
-# 2003-09-26 fl Added LA/PA support
-#
-# Copyright (c) 1997-2003 by Secret Labs AB.
-# Copyright (c) 1995-2001 by Fredrik Lundh.
-#
-# See the README file for information on usage and redistribution.
-#
-
-
-import os
-import re
-
-from . import Image, ImageFile, ImagePalette
-from ._binary import i8
-
-# --------------------------------------------------------------------
-# Standard tags
-
-COMMENT = "Comment"
-DATE = "Date"
-EQUIPMENT = "Digitalization equipment"
-FRAMES = "File size (no of images)"
-LUT = "Lut"
-NAME = "Name"
-SCALE = "Scale (x,y)"
-SIZE = "Image size (x*y)"
-MODE = "Image type"
-
-TAGS = {
- COMMENT: 0,
- DATE: 0,
- EQUIPMENT: 0,
- FRAMES: 0,
- LUT: 0,
- NAME: 0,
- SCALE: 0,
- SIZE: 0,
- MODE: 0,
-}
-
-OPEN = {
- # ifunc93/p3cfunc formats
- "0 1 image": ("1", "1"),
- "L 1 image": ("1", "1"),
- "Greyscale image": ("L", "L"),
- "Grayscale image": ("L", "L"),
- "RGB image": ("RGB", "RGB;L"),
- "RLB image": ("RGB", "RLB"),
- "RYB image": ("RGB", "RLB"),
- "B1 image": ("1", "1"),
- "B2 image": ("P", "P;2"),
- "B4 image": ("P", "P;4"),
- "X 24 image": ("RGB", "RGB"),
- "L 32 S image": ("I", "I;32"),
- "L 32 F image": ("F", "F;32"),
- # old p3cfunc formats
- "RGB3 image": ("RGB", "RGB;T"),
- "RYB3 image": ("RGB", "RYB;T"),
- # extensions
- "LA image": ("LA", "LA;L"),
- "PA image": ("LA", "PA;L"),
- "RGBA image": ("RGBA", "RGBA;L"),
- "RGBX image": ("RGBX", "RGBX;L"),
- "CMYK image": ("CMYK", "CMYK;L"),
- "YCC image": ("YCbCr", "YCbCr;L"),
-}
-
-# ifunc95 extensions
-for i in ["8", "8S", "16", "16S", "32", "32F"]:
- OPEN["L %s image" % i] = ("F", "F;%s" % i)
- OPEN["L*%s image" % i] = ("F", "F;%s" % i)
-for i in ["16", "16L", "16B"]:
- OPEN["L %s image" % i] = ("I;%s" % i, "I;%s" % i)
- OPEN["L*%s image" % i] = ("I;%s" % i, "I;%s" % i)
-for i in ["32S"]:
- OPEN["L %s image" % i] = ("I", "I;%s" % i)
- OPEN["L*%s image" % i] = ("I", "I;%s" % i)
-for i in range(2, 33):
- OPEN["L*%s image" % i] = ("F", "F;%s" % i)
-
-
-# --------------------------------------------------------------------
-# Read IM directory
-
-split = re.compile(br"^([A-Za-z][^:]*):[ \t]*(.*)[ \t]*$")
-
-
-def number(s):
- try:
- return int(s)
- except ValueError:
- return float(s)
-
-
-##
-# Image plugin for the IFUNC IM file format.
-
-
-class ImImageFile(ImageFile.ImageFile):
-
- format = "IM"
- format_description = "IFUNC Image Memory"
- _close_exclusive_fp_after_loading = False
-
- def _open(self):
-
- # Quick rejection: if there's not an LF among the first
- # 100 bytes, this is (probably) not a text header.
-
- if b"\n" not in self.fp.read(100):
- raise SyntaxError("not an IM file")
- self.fp.seek(0)
-
- n = 0
-
- # Default values
- self.info[MODE] = "L"
- self.info[SIZE] = (512, 512)
- self.info[FRAMES] = 1
-
- self.rawmode = "L"
-
- while True:
-
- s = self.fp.read(1)
-
- # Some versions of IFUNC uses \n\r instead of \r\n...
- if s == b"\r":
- continue
-
- if not s or s == b"\0" or s == b"\x1A":
- break
-
- # FIXME: this may read whole file if not a text file
- s = s + self.fp.readline()
-
- if len(s) > 100:
- raise SyntaxError("not an IM file")
-
- if s[-2:] == b"\r\n":
- s = s[:-2]
- elif s[-1:] == b"\n":
- s = s[:-1]
-
- try:
- m = split.match(s)
- except re.error as e:
- raise SyntaxError("not an IM file") from e
-
- if m:
-
- k, v = m.group(1, 2)
-
- # Don't know if this is the correct encoding,
- # but a decent guess (I guess)
- k = k.decode("latin-1", "replace")
- v = v.decode("latin-1", "replace")
-
- # Convert value as appropriate
- if k in [FRAMES, SCALE, SIZE]:
- v = v.replace("*", ",")
- v = tuple(map(number, v.split(",")))
- if len(v) == 1:
- v = v[0]
- elif k == MODE and v in OPEN:
- v, self.rawmode = OPEN[v]
-
- # Add to dictionary. Note that COMMENT tags are
- # combined into a list of strings.
- if k == COMMENT:
- if k in self.info:
- self.info[k].append(v)
- else:
- self.info[k] = [v]
- else:
- self.info[k] = v
-
- if k in TAGS:
- n += 1
-
|
[-]
[+]
|
Deleted |
_service:tar_git:harbour-simplecrop-1.0+main.20210420100251.4.g6bfb428.tar.bz2/lib/arm64/PIL/Image.py
^
|
@@ -1,3462 +0,0 @@
-#
-# The Python Imaging Library.
-# $Id$
-#
-# the Image class wrapper
-#
-# partial release history:
-# 1995-09-09 fl Created
-# 1996-03-11 fl PIL release 0.0 (proof of concept)
-# 1996-04-30 fl PIL release 0.1b1
-# 1999-07-28 fl PIL release 1.0 final
-# 2000-06-07 fl PIL release 1.1
-# 2000-10-20 fl PIL release 1.1.1
-# 2001-05-07 fl PIL release 1.1.2
-# 2002-03-15 fl PIL release 1.1.3
-# 2003-05-10 fl PIL release 1.1.4
-# 2005-03-28 fl PIL release 1.1.5
-# 2006-12-02 fl PIL release 1.1.6
-# 2009-11-15 fl PIL release 1.1.7
-#
-# Copyright (c) 1997-2009 by Secret Labs AB. All rights reserved.
-# Copyright (c) 1995-2009 by Fredrik Lundh.
-#
-# See the README file for information on usage and redistribution.
-#
-
-import atexit
-import builtins
-import io
-import logging
-import math
-import numbers
-import os
-import struct
-import sys
-import tempfile
-import warnings
-import xml.etree.ElementTree
-from collections.abc import Callable, MutableMapping
-from pathlib import Path
-
-# VERSION was removed in Pillow 6.0.0.
-# PILLOW_VERSION is deprecated and will be removed in a future release.
-# Use __version__ instead.
-from . import (
- ImageMode,
- TiffTags,
- UnidentifiedImageError,
- __version__,
- _plugins,
- _raise_version_warning,
-)
-from ._binary import i8, i32le
-from ._util import deferred_error, isPath
-
-if sys.version_info >= (3, 7):
-
- def __getattr__(name):
- if name == "PILLOW_VERSION":
- _raise_version_warning()
- return __version__
- raise AttributeError("module '{}' has no attribute '{}'".format(__name__, name))
-
-
-else:
-
- from . import PILLOW_VERSION
-
- # Silence warning
- assert PILLOW_VERSION
-
-
-logger = logging.getLogger(__name__)
-
-
-class DecompressionBombWarning(RuntimeWarning):
- pass
-
-
-class DecompressionBombError(Exception):
- pass
-
-
-# Limit to around a quarter gigabyte for a 24 bit (3 bpp) image
-MAX_IMAGE_PIXELS = int(1024 * 1024 * 1024 // 4 // 3)
-
-
-try:
- # If the _imaging C module is not present, Pillow will not load.
- # Note that other modules should not refer to _imaging directly;
- # import Image and use the Image.core variable instead.
- # Also note that Image.core is not a publicly documented interface,
- # and should be considered private and subject to change.
- from . import _imaging as core
-
- if __version__ != getattr(core, "PILLOW_VERSION", None):
- raise ImportError(
- "The _imaging extension was built for another version of Pillow or PIL:\n"
- "Core version: %s\n"
- "Pillow version: %s" % (getattr(core, "PILLOW_VERSION", None), __version__)
- )
-
-except ImportError as v:
- core = deferred_error(ImportError("The _imaging C module is not installed."))
- # Explanations for ways that we know we might have an import error
- if str(v).startswith("Module use of python"):
- # The _imaging C module is present, but not compiled for
- # the right version (windows only). Print a warning, if
- # possible.
- warnings.warn(
- "The _imaging extension was built for another version of Python.",
- RuntimeWarning,
- )
- elif str(v).startswith("The _imaging extension"):
- warnings.warn(str(v), RuntimeWarning)
- # Fail here anyway. Don't let people run with a mostly broken Pillow.
- # see docs/porting.rst
- raise
-
-
-# works everywhere, win for pypy, not cpython
-USE_CFFI_ACCESS = hasattr(sys, "pypy_version_info")
-try:
- import cffi
-except ImportError:
- cffi = None
-
-
-def isImageType(t):
- """
- Checks if an object is an image object.
-
- .. warning::
-
- This function is for internal use only.
-
- :param t: object to check if it's an image
- :returns: True if the object is an image
- """
- return hasattr(t, "im")
-
-
-#
-# Constants
-
-NONE = 0
-
-# transpose
-FLIP_LEFT_RIGHT = 0
-FLIP_TOP_BOTTOM = 1
-ROTATE_90 = 2
-ROTATE_180 = 3
-ROTATE_270 = 4
-TRANSPOSE = 5
-TRANSVERSE = 6
-
-# transforms (also defined in Imaging.h)
-AFFINE = 0
-EXTENT = 1
-PERSPECTIVE = 2
-QUAD = 3
-MESH = 4
-
-# resampling filters (also defined in Imaging.h)
-NEAREST = NONE = 0
-BOX = 4
-BILINEAR = LINEAR = 2
-HAMMING = 5
-BICUBIC = CUBIC = 3
-LANCZOS = ANTIALIAS = 1
-
-_filters_support = {BOX: 0.5, BILINEAR: 1.0, HAMMING: 1.0, BICUBIC: 2.0, LANCZOS: 3.0}
-
-
-# dithers
-NEAREST = NONE = 0
-ORDERED = 1 # Not yet implemented
-RASTERIZE = 2 # Not yet implemented
-FLOYDSTEINBERG = 3 # default
-
-# palettes/quantizers
-WEB = 0
-ADAPTIVE = 1
-
-MEDIANCUT = 0
-MAXCOVERAGE = 1
-FASTOCTREE = 2
-LIBIMAGEQUANT = 3
-
-# categories
-NORMAL = 0
-SEQUENCE = 1
-CONTAINER = 2
-
-if hasattr(core, "DEFAULT_STRATEGY"):
- DEFAULT_STRATEGY = core.DEFAULT_STRATEGY
- FILTERED = core.FILTERED
- HUFFMAN_ONLY = core.HUFFMAN_ONLY
- RLE = core.RLE
|
[-]
[+]
|
Deleted |
_service:tar_git:harbour-simplecrop-1.0+main.20210420100251.4.g6bfb428.tar.bz2/lib/arm64/PIL/ImageChops.py
^
|
@@ -1,328 +0,0 @@
-#
-# The Python Imaging Library.
-# $Id$
-#
-# standard channel operations
-#
-# History:
-# 1996-03-24 fl Created
-# 1996-08-13 fl Added logical operations (for "1" images)
-# 2000-10-12 fl Added offset method (from Image.py)
-#
-# Copyright (c) 1997-2000 by Secret Labs AB
-# Copyright (c) 1996-2000 by Fredrik Lundh
-#
-# See the README file for information on usage and redistribution.
-#
-
-from . import Image
-
-
-def constant(image, value):
- """Fill a channel with a given grey level.
-
- :rtype: :py:class:`~PIL.Image.Image`
- """
-
- return Image.new("L", image.size, value)
-
-
-def duplicate(image):
- """Copy a channel. Alias for :py:meth:`PIL.Image.Image.copy`.
-
- :rtype: :py:class:`~PIL.Image.Image`
- """
-
- return image.copy()
-
-
-def invert(image):
- """
- Invert an image (channel).
-
- .. code-block:: python
-
- out = MAX - image
-
- :rtype: :py:class:`~PIL.Image.Image`
- """
-
- image.load()
- return image._new(image.im.chop_invert())
-
-
-def lighter(image1, image2):
- """
- Compares the two images, pixel by pixel, and returns a new image containing
- the lighter values.
-
- .. code-block:: python
-
- out = max(image1, image2)
-
- :rtype: :py:class:`~PIL.Image.Image`
- """
-
- image1.load()
- image2.load()
- return image1._new(image1.im.chop_lighter(image2.im))
-
-
-def darker(image1, image2):
- """
- Compares the two images, pixel by pixel, and returns a new image containing
- the darker values.
-
- .. code-block:: python
-
- out = min(image1, image2)
-
- :rtype: :py:class:`~PIL.Image.Image`
- """
-
- image1.load()
- image2.load()
- return image1._new(image1.im.chop_darker(image2.im))
-
-
-def difference(image1, image2):
- """
- Returns the absolute value of the pixel-by-pixel difference between the two
- images.
-
- .. code-block:: python
-
- out = abs(image1 - image2)
-
- :rtype: :py:class:`~PIL.Image.Image`
- """
-
- image1.load()
- image2.load()
- return image1._new(image1.im.chop_difference(image2.im))
-
-
-def multiply(image1, image2):
- """
- Superimposes two images on top of each other.
-
- If you multiply an image with a solid black image, the result is black. If
- you multiply with a solid white image, the image is unaffected.
-
- .. code-block:: python
-
- out = image1 * image2 / MAX
-
- :rtype: :py:class:`~PIL.Image.Image`
- """
-
- image1.load()
- image2.load()
- return image1._new(image1.im.chop_multiply(image2.im))
-
-
-def screen(image1, image2):
- """
- Superimposes two inverted images on top of each other.
-
- .. code-block:: python
-
- out = MAX - ((MAX - image1) * (MAX - image2) / MAX)
-
- :rtype: :py:class:`~PIL.Image.Image`
- """
-
- image1.load()
- image2.load()
- return image1._new(image1.im.chop_screen(image2.im))
-
-
-def soft_light(image1, image2):
- """
- Superimposes two images on top of each other using the Soft Light algorithm
-
- :rtype: :py:class:`~PIL.Image.Image`
- """
-
- image1.load()
- image2.load()
- return image1._new(image1.im.chop_soft_light(image2.im))
-
-
-def hard_light(image1, image2):
- """
- Superimposes two images on top of each other using the Hard Light algorithm
-
- :rtype: :py:class:`~PIL.Image.Image`
- """
-
- image1.load()
- image2.load()
- return image1._new(image1.im.chop_hard_light(image2.im))
-
-
-def overlay(image1, image2):
- """
- Superimposes two images on top of each other using the Overlay algorithm
-
- :rtype: :py:class:`~PIL.Image.Image`
- """
-
- image1.load()
- image2.load()
- return image1._new(image1.im.chop_overlay(image2.im))
-
-
-def add(image1, image2, scale=1.0, offset=0):
- """
- Adds two images, dividing the result by scale and adding the
- offset. If omitted, scale defaults to 1.0, and offset to 0.0.
-
- .. code-block:: python
-
- out = ((image1 + image2) / scale + offset)
-
- :rtype: :py:class:`~PIL.Image.Image`
- """
-
- image1.load()
- image2.load()
- return image1._new(image1.im.chop_add(image2.im, scale, offset))
-
-
-def subtract(image1, image2, scale=1.0, offset=0):
- """
- Subtracts two images, dividing the result by scale and adding the offset.
- If omitted, scale defaults to 1.0, and offset to 0.0.
-
- .. code-block:: python
-
|
[-]
[+]
|
Deleted |
_service:tar_git:harbour-simplecrop-1.0+main.20210420100251.4.g6bfb428.tar.bz2/lib/arm64/PIL/ImageCms.py
^
|
@@ -1,990 +0,0 @@
-# The Python Imaging Library.
-# $Id$
-
-# Optional color management support, based on Kevin Cazabon's PyCMS
-# library.
-
-# History:
-
-# 2009-03-08 fl Added to PIL.
-
-# Copyright (C) 2002-2003 Kevin Cazabon
-# Copyright (c) 2009 by Fredrik Lundh
-# Copyright (c) 2013 by Eric Soroos
-
-# See the README file for information on usage and redistribution. See
-# below for the original description.
-
-import sys
-
-from PIL import Image
-
-try:
- from PIL import _imagingcms
-except ImportError as ex:
- # Allow error import for doc purposes, but error out when accessing
- # anything in core.
- from ._util import deferred_error
-
- _imagingcms = deferred_error(ex)
-
-DESCRIPTION = """
-pyCMS
-
- a Python / PIL interface to the littleCMS ICC Color Management System
- Copyright (C) 2002-2003 Kevin Cazabon
- kevin@cazabon.com
- http://www.cazabon.com
-
- pyCMS home page: http://www.cazabon.com/pyCMS
- littleCMS home page: http://www.littlecms.com
- (littleCMS is Copyright (C) 1998-2001 Marti Maria)
-
- Originally released under LGPL. Graciously donated to PIL in
- March 2009, for distribution under the standard PIL license
-
- The pyCMS.py module provides a "clean" interface between Python/PIL and
- pyCMSdll, taking care of some of the more complex handling of the direct
- pyCMSdll functions, as well as error-checking and making sure that all
- relevant data is kept together.
-
- While it is possible to call pyCMSdll functions directly, it's not highly
- recommended.
-
- Version History:
-
- 1.0.0 pil Oct 2013 Port to LCMS 2.
-
- 0.1.0 pil mod March 10, 2009
-
- Renamed display profile to proof profile. The proof
- profile is the profile of the device that is being
- simulated, not the profile of the device which is
- actually used to display/print the final simulation
- (that'd be the output profile) - also see LCMSAPI.txt
- input colorspace -> using 'renderingIntent' -> proof
- colorspace -> using 'proofRenderingIntent' -> output
- colorspace
-
- Added LCMS FLAGS support.
- Added FLAGS["SOFTPROOFING"] as default flag for
- buildProofTransform (otherwise the proof profile/intent
- would be ignored).
-
- 0.1.0 pil March 2009 - added to PIL, as PIL.ImageCms
-
- 0.0.2 alpha Jan 6, 2002
-
- Added try/except statements around type() checks of
- potential CObjects... Python won't let you use type()
- on them, and raises a TypeError (stupid, if you ask
- me!)
-
- Added buildProofTransformFromOpenProfiles() function.
- Additional fixes in DLL, see DLL code for details.
-
- 0.0.1 alpha first public release, Dec. 26, 2002
-
- Known to-do list with current version (of Python interface, not pyCMSdll):
-
- none
-
-"""
-
-VERSION = "1.0.0 pil"
-
-# --------------------------------------------------------------------.
-
-core = _imagingcms
-
-#
-# intent/direction values
-
-INTENT_PERCEPTUAL = 0
-INTENT_RELATIVE_COLORIMETRIC = 1
-INTENT_SATURATION = 2
-INTENT_ABSOLUTE_COLORIMETRIC = 3
-
-DIRECTION_INPUT = 0
-DIRECTION_OUTPUT = 1
-DIRECTION_PROOF = 2
-
-#
-# flags
-
-FLAGS = {
- "MATRIXINPUT": 1,
- "MATRIXOUTPUT": 2,
- "MATRIXONLY": (1 | 2),
- "NOWHITEONWHITEFIXUP": 4, # Don't hot fix scum dot
- # Don't create prelinearization tables on precalculated transforms
- # (internal use):
- "NOPRELINEARIZATION": 16,
- "GUESSDEVICECLASS": 32, # Guess device class (for transform2devicelink)
- "NOTCACHE": 64, # Inhibit 1-pixel cache
- "NOTPRECALC": 256,
- "NULLTRANSFORM": 512, # Don't transform anyway
- "HIGHRESPRECALC": 1024, # Use more memory to give better accuracy
- "LOWRESPRECALC": 2048, # Use less memory to minimize resources
- "WHITEBLACKCOMPENSATION": 8192,
- "BLACKPOINTCOMPENSATION": 8192,
- "GAMUTCHECK": 4096, # Out of Gamut alarm
- "SOFTPROOFING": 16384, # Do softproofing
- "PRESERVEBLACK": 32768, # Black preservation
- "NODEFAULTRESOURCEDEF": 16777216, # CRD special
- "GRIDPOINTS": lambda n: ((n) & 0xFF) << 16, # Gridpoints
-}
-
-_MAX_FLAG = 0
-for flag in FLAGS.values():
- if isinstance(flag, int):
- _MAX_FLAG = _MAX_FLAG | flag
-
-
-# --------------------------------------------------------------------.
-# Experimental PIL-level API
-# --------------------------------------------------------------------.
-
-##
-# Profile.
-
-
-class ImageCmsProfile:
- def __init__(self, profile):
- """
- :param profile: Either a string representing a filename,
- a file like object containing a profile or a
- low-level profile object
-
- """
-
- if isinstance(profile, str):
- self._set(core.profile_open(profile), profile)
- elif hasattr(profile, "read"):
- self._set(core.profile_frombytes(profile.read()))
- elif isinstance(profile, _imagingcms.CmsProfile):
- self._set(profile)
- else:
- raise TypeError("Invalid type for Profile")
-
- def _set(self, profile, filename=None):
- self.profile = profile
- self.filename = filename
- if profile:
- self.product_name = None # profile.product_name
- self.product_info = None # profile.product_info
- else:
- self.product_name = None
- self.product_info = None
-
- def tobytes(self):
- """
- Returns the profile in a format suitable for embedding in
- saved images.
-
- :returns: a bytes object containing the ICC profile.
- """
-
- return core.profile_tobytes(self.profile)
-
-
-class ImageCmsTransform(Image.ImagePointHandler):
-
- """
- Transform. This can be used with the procedural API, or with the standard
- :py:func:`~PIL.Image.Image.point` method.
-
- Will return the output profile in the ``output.info['icc_profile']``.
- """
-
|
[-]
[+]
|
Deleted |
_service:tar_git:harbour-simplecrop-1.0+main.20210420100251.4.g6bfb428.tar.bz2/lib/arm64/PIL/ImageColor.py
^
|
@@ -1,300 +0,0 @@
-#
-# The Python Imaging Library
-# $Id$
-#
-# map CSS3-style colour description strings to RGB
-#
-# History:
-# 2002-10-24 fl Added support for CSS-style color strings
-# 2002-12-15 fl Added RGBA support
-# 2004-03-27 fl Fixed remaining int() problems for Python 1.5.2
-# 2004-07-19 fl Fixed gray/grey spelling issues
-# 2009-03-05 fl Fixed rounding error in grayscale calculation
-#
-# Copyright (c) 2002-2004 by Secret Labs AB
-# Copyright (c) 2002-2004 by Fredrik Lundh
-#
-# See the README file for information on usage and redistribution.
-#
-
-import re
-
-from . import Image
-
-
-def getrgb(color):
- """
- Convert a color string to an RGB tuple. If the string cannot be parsed,
- this function raises a :py:exc:`ValueError` exception.
-
- .. versionadded:: 1.1.4
-
- :param color: A color string
- :return: ``(red, green, blue[, alpha])``
- """
- color = color.lower()
-
- rgb = colormap.get(color, None)
- if rgb:
- if isinstance(rgb, tuple):
- return rgb
- colormap[color] = rgb = getrgb(rgb)
- return rgb
-
- # check for known string formats
- if re.match("#[a-f0-9]{3}$", color):
- return (int(color[1] * 2, 16), int(color[2] * 2, 16), int(color[3] * 2, 16))
-
- if re.match("#[a-f0-9]{4}$", color):
- return (
- int(color[1] * 2, 16),
- int(color[2] * 2, 16),
- int(color[3] * 2, 16),
- int(color[4] * 2, 16),
- )
-
- if re.match("#[a-f0-9]{6}$", color):
- return (int(color[1:3], 16), int(color[3:5], 16), int(color[5:7], 16))
-
- if re.match("#[a-f0-9]{8}$", color):
- return (
- int(color[1:3], 16),
- int(color[3:5], 16),
- int(color[5:7], 16),
- int(color[7:9], 16),
- )
-
- m = re.match(r"rgb\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)$", color)
- if m:
- return (int(m.group(1)), int(m.group(2)), int(m.group(3)))
-
- m = re.match(r"rgb\(\s*(\d+)%\s*,\s*(\d+)%\s*,\s*(\d+)%\s*\)$", color)
- if m:
- return (
- int((int(m.group(1)) * 255) / 100.0 + 0.5),
- int((int(m.group(2)) * 255) / 100.0 + 0.5),
- int((int(m.group(3)) * 255) / 100.0 + 0.5),
- )
-
- m = re.match(
- r"hsl\(\s*(\d+\.?\d*)\s*,\s*(\d+\.?\d*)%\s*,\s*(\d+\.?\d*)%\s*\)$", color
- )
- if m:
- from colorsys import hls_to_rgb
-
- rgb = hls_to_rgb(
- float(m.group(1)) / 360.0,
- float(m.group(3)) / 100.0,
- float(m.group(2)) / 100.0,
- )
- return (
- int(rgb[0] * 255 + 0.5),
- int(rgb[1] * 255 + 0.5),
- int(rgb[2] * 255 + 0.5),
- )
-
- m = re.match(
- r"hs[bv]\(\s*(\d+\.?\d*)\s*,\s*(\d+\.?\d*)%\s*,\s*(\d+\.?\d*)%\s*\)$", color
- )
- if m:
- from colorsys import hsv_to_rgb
-
- rgb = hsv_to_rgb(
- float(m.group(1)) / 360.0,
- float(m.group(2)) / 100.0,
- float(m.group(3)) / 100.0,
- )
- return (
- int(rgb[0] * 255 + 0.5),
- int(rgb[1] * 255 + 0.5),
- int(rgb[2] * 255 + 0.5),
- )
-
- m = re.match(r"rgba\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)$", color)
- if m:
- return (int(m.group(1)), int(m.group(2)), int(m.group(3)), int(m.group(4)))
- raise ValueError("unknown color specifier: %r" % color)
-
-
-def getcolor(color, mode):
- """
- Same as :py:func:`~PIL.ImageColor.getrgb`, but converts the RGB value to a
- greyscale value if the mode is not color or a palette image. If the string
- cannot be parsed, this function raises a :py:exc:`ValueError` exception.
-
- .. versionadded:: 1.1.4
-
- :param color: A color string
- :return: ``(graylevel [, alpha]) or (red, green, blue[, alpha])``
- """
- # same as getrgb, but converts the result to the given mode
- color, alpha = getrgb(color), 255
- if len(color) == 4:
- color, alpha = color[0:3], color[3]
-
- if Image.getmodebase(mode) == "L":
- r, g, b = color
- # ITU-R Recommendation 601-2 for nonlinear RGB
- # scaled to 24 bits to match the convert's implementation.
- color = (r * 19595 + g * 38470 + b * 7471 + 0x8000) >> 16
- if mode[-1] == "A":
- return (color, alpha)
- else:
- if mode[-1] == "A":
- return color + (alpha,)
- return color
-
-
-colormap = {
- # X11 colour table from https://drafts.csswg.org/css-color-4/, with
- # gray/grey spelling issues fixed. This is a superset of HTML 4.0
- # colour names used in CSS 1.
- "aliceblue": "#f0f8ff",
- "antiquewhite": "#faebd7",
- "aqua": "#00ffff",
- "aquamarine": "#7fffd4",
- "azure": "#f0ffff",
- "beige": "#f5f5dc",
- "bisque": "#ffe4c4",
- "black": "#000000",
- "blanchedalmond": "#ffebcd",
- "blue": "#0000ff",
- "blueviolet": "#8a2be2",
- "brown": "#a52a2a",
- "burlywood": "#deb887",
- "cadetblue": "#5f9ea0",
- "chartreuse": "#7fff00",
- "chocolate": "#d2691e",
- "coral": "#ff7f50",
- "cornflowerblue": "#6495ed",
- "cornsilk": "#fff8dc",
- "crimson": "#dc143c",
- "cyan": "#00ffff",
- "darkblue": "#00008b",
- "darkcyan": "#008b8b",
- "darkgoldenrod": "#b8860b",
- "darkgray": "#a9a9a9",
- "darkgrey": "#a9a9a9",
- "darkgreen": "#006400",
- "darkkhaki": "#bdb76b",
- "darkmagenta": "#8b008b",
- "darkolivegreen": "#556b2f",
- "darkorange": "#ff8c00",
- "darkorchid": "#9932cc",
- "darkred": "#8b0000",
- "darksalmon": "#e9967a",
- "darkseagreen": "#8fbc8f",
- "darkslateblue": "#483d8b",
- "darkslategray": "#2f4f4f",
- "darkslategrey": "#2f4f4f",
- "darkturquoise": "#00ced1",
- "darkviolet": "#9400d3",
- "deeppink": "#ff1493",
- "deepskyblue": "#00bfff",
- "dimgray": "#696969",
- "dimgrey": "#696969",
- "dodgerblue": "#1e90ff",
- "firebrick": "#b22222",
- "floralwhite": "#fffaf0",
- "forestgreen": "#228b22",
|
[-]
[+]
|
Deleted |
_service:tar_git:harbour-simplecrop-1.0+main.20210420100251.4.g6bfb428.tar.bz2/lib/arm64/PIL/ImageDraw.py
^
|
@@ -1,566 +0,0 @@
-#
-# The Python Imaging Library
-# $Id$
-#
-# drawing interface operations
-#
-# History:
-# 1996-04-13 fl Created (experimental)
-# 1996-08-07 fl Filled polygons, ellipses.
-# 1996-08-13 fl Added text support
-# 1998-06-28 fl Handle I and F images
-# 1998-12-29 fl Added arc; use arc primitive to draw ellipses
-# 1999-01-10 fl Added shape stuff (experimental)
-# 1999-02-06 fl Added bitmap support
-# 1999-02-11 fl Changed all primitives to take options
-# 1999-02-20 fl Fixed backwards compatibility
-# 2000-10-12 fl Copy on write, when necessary
-# 2001-02-18 fl Use default ink for bitmap/text also in fill mode
-# 2002-10-24 fl Added support for CSS-style color strings
-# 2002-12-10 fl Added experimental support for RGBA-on-RGB drawing
-# 2002-12-11 fl Refactored low-level drawing API (work in progress)
-# 2004-08-26 fl Made Draw() a factory function, added getdraw() support
-# 2004-09-04 fl Added width support to line primitive
-# 2004-09-10 fl Added font mode handling
-# 2006-06-19 fl Added font bearing support (getmask2)
-#
-# Copyright (c) 1997-2006 by Secret Labs AB
-# Copyright (c) 1996-2006 by Fredrik Lundh
-#
-# See the README file for information on usage and redistribution.
-#
-
-import math
-import numbers
-
-from . import Image, ImageColor
-
-
-"""
-A simple 2D drawing interface for PIL images.
-<p>
-Application code should use the <b>Draw</b> factory, instead of
-directly.
-"""
-
-
-class ImageDraw:
- def __init__(self, im, mode=None):
- """
- Create a drawing instance.
-
- :param im: The image to draw in.
- :param mode: Optional mode to use for color values. For RGB
- images, this argument can be RGB or RGBA (to blend the
- drawing into the image). For all other modes, this argument
- must be the same as the image mode. If omitted, the mode
- defaults to the mode of the image.
- """
- im.load()
- if im.readonly:
- im._copy() # make it writeable
- blend = 0
- if mode is None:
- mode = im.mode
- if mode != im.mode:
- if mode == "RGBA" and im.mode == "RGB":
- blend = 1
- else:
- raise ValueError("mode mismatch")
- if mode == "P":
- self.palette = im.palette
- else:
- self.palette = None
- self.im = im.im
- self.draw = Image.core.draw(self.im, blend)
- self.mode = mode
- if mode in ("I", "F"):
- self.ink = self.draw.draw_ink(1)
- else:
- self.ink = self.draw.draw_ink(-1)
- if mode in ("1", "P", "I", "F"):
- # FIXME: fix Fill2 to properly support matte for I+F images
- self.fontmode = "1"
- else:
- self.fontmode = "L" # aliasing is okay for other modes
- self.fill = 0
- self.font = None
-
- def getfont(self):
- """
- Get the current default font.
-
- :returns: An image font."""
- if not self.font:
- # FIXME: should add a font repository
- from . import ImageFont
-
- self.font = ImageFont.load_default()
- return self.font
-
- def _getink(self, ink, fill=None):
- if ink is None and fill is None:
- if self.fill:
- fill = self.ink
- else:
- ink = self.ink
- else:
- if ink is not None:
- if isinstance(ink, str):
- ink = ImageColor.getcolor(ink, self.mode)
- if self.palette and not isinstance(ink, numbers.Number):
- ink = self.palette.getcolor(ink)
- ink = self.draw.draw_ink(ink)
- if fill is not None:
- if isinstance(fill, str):
- fill = ImageColor.getcolor(fill, self.mode)
- if self.palette and not isinstance(fill, numbers.Number):
- fill = self.palette.getcolor(fill)
- fill = self.draw.draw_ink(fill)
- return ink, fill
-
- def arc(self, xy, start, end, fill=None, width=0):
- """Draw an arc."""
- ink, fill = self._getink(fill)
- if ink is not None:
- self.draw.draw_arc(xy, start, end, ink, width)
-
- def bitmap(self, xy, bitmap, fill=None):
- """Draw a bitmap."""
- bitmap.load()
- ink, fill = self._getink(fill)
- if ink is None:
- ink = fill
- if ink is not None:
- self.draw.draw_bitmap(xy, bitmap.im, ink)
-
- def chord(self, xy, start, end, fill=None, outline=None, width=1):
- """Draw a chord."""
- ink, fill = self._getink(outline, fill)
- if fill is not None:
- self.draw.draw_chord(xy, start, end, fill, 1)
- if ink is not None and ink != fill and width != 0:
- self.draw.draw_chord(xy, start, end, ink, 0, width)
-
- def ellipse(self, xy, fill=None, outline=None, width=1):
- """Draw an ellipse."""
- ink, fill = self._getink(outline, fill)
- if fill is not None:
- self.draw.draw_ellipse(xy, fill, 1)
- if ink is not None and ink != fill and width != 0:
- self.draw.draw_ellipse(xy, ink, 0, width)
-
- def line(self, xy, fill=None, width=0, joint=None):
- """Draw a line, or a connected sequence of line segments."""
- ink = self._getink(fill)[0]
- if ink is not None:
- self.draw.draw_lines(xy, ink, width)
- if joint == "curve" and width > 4:
- if not isinstance(xy[0], (list, tuple)):
- xy = [tuple(xy[i : i + 2]) for i in range(0, len(xy), 2)]
- for i in range(1, len(xy) - 1):
- point = xy[i]
- angles = [
- math.degrees(math.atan2(end[0] - start[0], start[1] - end[1]))
- % 360
- for start, end in ((xy[i - 1], point), (point, xy[i + 1]))
- ]
- if angles[0] == angles[1]:
- # This is a straight line, so no joint is required
- continue
-
- def coord_at_angle(coord, angle):
- x, y = coord
- angle -= 90
- distance = width / 2 - 1
- return tuple(
- [
- p + (math.floor(p_d) if p_d > 0 else math.ceil(p_d))
- for p, p_d in (
- (x, distance * math.cos(math.radians(angle))),
- (y, distance * math.sin(math.radians(angle))),
- )
- ]
- )
-
- flipped = (
- angles[1] > angles[0] and angles[1] - 180 > angles[0]
- ) or (angles[1] < angles[0] and angles[1] + 180 > angles[0])
- coords = [
- (point[0] - width / 2 + 1, point[1] - width / 2 + 1),
- (point[0] + width / 2 - 1, point[1] + width / 2 - 1),
- ]
- if flipped:
- start, end = (angles[1] + 90, angles[0] + 90)
- else:
- start, end = (angles[0] - 90, angles[1] - 90)
- self.pieslice(coords, start - 90, end - 90, fill)
-
- if width > 8:
|
[-]
[+]
|
Deleted |
_service:tar_git:harbour-simplecrop-1.0+main.20210420100251.4.g6bfb428.tar.bz2/lib/arm64/PIL/ImageDraw2.py
^
|
@@ -1,179 +0,0 @@
-#
-# The Python Imaging Library
-# $Id$
-#
-# WCK-style drawing interface operations
-#
-# History:
-# 2003-12-07 fl created
-# 2005-05-15 fl updated; added to PIL as ImageDraw2
-# 2005-05-15 fl added text support
-# 2005-05-20 fl added arc/chord/pieslice support
-#
-# Copyright (c) 2003-2005 by Secret Labs AB
-# Copyright (c) 2003-2005 by Fredrik Lundh
-#
-# See the README file for information on usage and redistribution.
-#
-
-
-"""
-(Experimental) WCK-style drawing interface operations
-
-.. seealso:: :py:mod:`PIL.ImageDraw`
-"""
-
-
-from . import Image, ImageColor, ImageDraw, ImageFont, ImagePath
-
-
-class Pen:
- """Stores an outline color and width."""
-
- def __init__(self, color, width=1, opacity=255):
- self.color = ImageColor.getrgb(color)
- self.width = width
-
-
-class Brush:
- """Stores a fill color"""
-
- def __init__(self, color, opacity=255):
- self.color = ImageColor.getrgb(color)
-
-
-class Font:
- """Stores a TrueType font and color"""
-
- def __init__(self, color, file, size=12):
- # FIXME: add support for bitmap fonts
- self.color = ImageColor.getrgb(color)
- self.font = ImageFont.truetype(file, size)
-
-
-class Draw:
- """
- (Experimental) WCK-style drawing interface
- """
-
- def __init__(self, image, size=None, color=None):
- if not hasattr(image, "im"):
- image = Image.new(image, size, color)
- self.draw = ImageDraw.Draw(image)
- self.image = image
- self.transform = None
-
- def flush(self):
- return self.image
-
- def render(self, op, xy, pen, brush=None):
- # handle color arguments
- outline = fill = None
- width = 1
- if isinstance(pen, Pen):
- outline = pen.color
- width = pen.width
- elif isinstance(brush, Pen):
- outline = brush.color
- width = brush.width
- if isinstance(brush, Brush):
- fill = brush.color
- elif isinstance(pen, Brush):
- fill = pen.color
- # handle transformation
- if self.transform:
- xy = ImagePath.Path(xy)
- xy.transform(self.transform)
- # render the item
- if op == "line":
- self.draw.line(xy, fill=outline, width=width)
- else:
- getattr(self.draw, op)(xy, fill=fill, outline=outline)
-
- def settransform(self, offset):
- """Sets a transformation offset."""
- (xoffset, yoffset) = offset
- self.transform = (1, 0, xoffset, 0, 1, yoffset)
-
- def arc(self, xy, start, end, *options):
- """
- Draws an arc (a portion of a circle outline) between the start and end
- angles, inside the given bounding box.
-
- .. seealso:: :py:meth:`PIL.ImageDraw.ImageDraw.arc`
- """
- self.render("arc", xy, start, end, *options)
-
- def chord(self, xy, start, end, *options):
- """
- Same as :py:meth:`~PIL.ImageDraw2.Draw.arc`, but connects the end points
- with a straight line.
-
- .. seealso:: :py:meth:`PIL.ImageDraw.ImageDraw.chord`
- """
- self.render("chord", xy, start, end, *options)
-
- def ellipse(self, xy, *options):
- """
- Draws an ellipse inside the given bounding box.
-
- .. seealso:: :py:meth:`PIL.ImageDraw.ImageDraw.ellipse`
- """
- self.render("ellipse", xy, *options)
-
- def line(self, xy, *options):
- """
- Draws a line between the coordinates in the ``xy`` list.
-
- .. seealso:: :py:meth:`PIL.ImageDraw.ImageDraw.line`
- """
- self.render("line", xy, *options)
-
- def pieslice(self, xy, start, end, *options):
- """
- Same as arc, but also draws straight lines between the end points and the
- center of the bounding box.
-
- .. seealso:: :py:meth:`PIL.ImageDraw.ImageDraw.pieslice`
- """
- self.render("pieslice", xy, start, end, *options)
-
- def polygon(self, xy, *options):
- """
- Draws a polygon.
-
- The polygon outline consists of straight lines between the given
- coordinates, plus a straight line between the last and the first
- coordinate.
-
-
- .. seealso:: :py:meth:`PIL.ImageDraw.ImageDraw.polygon`
- """
- self.render("polygon", xy, *options)
-
- def rectangle(self, xy, *options):
- """
- Draws a rectangle.
-
- .. seealso:: :py:meth:`PIL.ImageDraw.ImageDraw.rectangle`
- """
- self.render("rectangle", xy, *options)
-
- def text(self, xy, text, font):
- """
- Draws the string at the given position.
-
- .. seealso:: :py:meth:`PIL.ImageDraw.ImageDraw.text`
- """
- if self.transform:
- xy = ImagePath.Path(xy)
- xy.transform(self.transform)
- self.draw.text(xy, text, font=font.font, fill=font.color)
-
- def textsize(self, text, font):
- """
- Return the size of the given string, in pixels.
-
- .. seealso:: :py:meth:`PIL.ImageDraw.ImageDraw.textsize`
- """
- return self.draw.textsize(text, font=font.font)
|
[-]
[+]
|
Deleted |
_service:tar_git:harbour-simplecrop-1.0+main.20210420100251.4.g6bfb428.tar.bz2/lib/arm64/PIL/ImageEnhance.py
^
|
@@ -1,103 +0,0 @@
-#
-# The Python Imaging Library.
-# $Id$
-#
-# image enhancement classes
-#
-# For a background, see "Image Processing By Interpolation and
-# Extrapolation", Paul Haeberli and Douglas Voorhies. Available
-# at http://www.graficaobscura.com/interp/index.html
-#
-# History:
-# 1996-03-23 fl Created
-# 2009-06-16 fl Fixed mean calculation
-#
-# Copyright (c) Secret Labs AB 1997.
-# Copyright (c) Fredrik Lundh 1996.
-#
-# See the README file for information on usage and redistribution.
-#
-
-from . import Image, ImageFilter, ImageStat
-
-
-class _Enhance:
- def enhance(self, factor):
- """
- Returns an enhanced image.
-
- :param factor: A floating point value controlling the enhancement.
- Factor 1.0 always returns a copy of the original image,
- lower factors mean less color (brightness, contrast,
- etc), and higher values more. There are no restrictions
- on this value.
- :rtype: :py:class:`~PIL.Image.Image`
- """
- return Image.blend(self.degenerate, self.image, factor)
-
-
-class Color(_Enhance):
- """Adjust image color balance.
-
- This class can be used to adjust the colour balance of an image, in
- a manner similar to the controls on a colour TV set. An enhancement
- factor of 0.0 gives a black and white image. A factor of 1.0 gives
- the original image.
- """
-
- def __init__(self, image):
- self.image = image
- self.intermediate_mode = "L"
- if "A" in image.getbands():
- self.intermediate_mode = "LA"
-
- self.degenerate = image.convert(self.intermediate_mode).convert(image.mode)
-
-
-class Contrast(_Enhance):
- """Adjust image contrast.
-
- This class can be used to control the contrast of an image, similar
- to the contrast control on a TV set. An enhancement factor of 0.0
- gives a solid grey image. A factor of 1.0 gives the original image.
- """
-
- def __init__(self, image):
- self.image = image
- mean = int(ImageStat.Stat(image.convert("L")).mean[0] + 0.5)
- self.degenerate = Image.new("L", image.size, mean).convert(image.mode)
-
- if "A" in image.getbands():
- self.degenerate.putalpha(image.getchannel("A"))
-
-
-class Brightness(_Enhance):
- """Adjust image brightness.
-
- This class can be used to control the brightness of an image. An
- enhancement factor of 0.0 gives a black image. A factor of 1.0 gives the
- original image.
- """
-
- def __init__(self, image):
- self.image = image
- self.degenerate = Image.new(image.mode, image.size, 0)
-
- if "A" in image.getbands():
- self.degenerate.putalpha(image.getchannel("A"))
-
-
-class Sharpness(_Enhance):
- """Adjust image sharpness.
-
- This class can be used to adjust the sharpness of an image. An
- enhancement factor of 0.0 gives a blurred image, a factor of 1.0 gives the
- original image, and a factor of 2.0 gives a sharpened image.
- """
-
- def __init__(self, image):
- self.image = image
- self.degenerate = image.filter(ImageFilter.SMOOTH)
-
- if "A" in image.getbands():
- self.degenerate.putalpha(image.getchannel("A"))
|
[-]
[+]
|
Deleted |
_service:tar_git:harbour-simplecrop-1.0+main.20210420100251.4.g6bfb428.tar.bz2/lib/arm64/PIL/ImageFile.py
^
|
@@ -1,693 +0,0 @@
-#
-# The Python Imaging Library.
-# $Id$
-#
-# base class for image file handlers
-#
-# history:
-# 1995-09-09 fl Created
-# 1996-03-11 fl Fixed load mechanism.
-# 1996-04-15 fl Added pcx/xbm decoders.
-# 1996-04-30 fl Added encoders.
-# 1996-12-14 fl Added load helpers
-# 1997-01-11 fl Use encode_to_file where possible
-# 1997-08-27 fl Flush output in _save
-# 1998-03-05 fl Use memory mapping for some modes
-# 1999-02-04 fl Use memory mapping also for "I;16" and "I;16B"
-# 1999-05-31 fl Added image parser
-# 2000-10-12 fl Set readonly flag on memory-mapped images
-# 2002-03-20 fl Use better messages for common decoder errors
-# 2003-04-21 fl Fall back on mmap/map_buffer if map is not available
-# 2003-10-30 fl Added StubImageFile class
-# 2004-02-25 fl Made incremental parser more robust
-#
-# Copyright (c) 1997-2004 by Secret Labs AB
-# Copyright (c) 1995-2004 by Fredrik Lundh
-#
-# See the README file for information on usage and redistribution.
-#
-
-import io
-import struct
-import sys
-import warnings
-
-from . import Image
-from ._util import isPath
-
-MAXBLOCK = 65536
-
-SAFEBLOCK = 1024 * 1024
-
-LOAD_TRUNCATED_IMAGES = False
-
-ERRORS = {
- -1: "image buffer overrun error",
- -2: "decoding error",
- -3: "unknown error",
- -8: "bad configuration",
- -9: "out of memory error",
-}
-
-
-#
-# --------------------------------------------------------------------
-# Helpers
-
-
-def raise_oserror(error):
- try:
- message = Image.core.getcodecstatus(error)
- except AttributeError:
- message = ERRORS.get(error)
- if not message:
- message = "decoder error %d" % error
- raise OSError(message + " when reading image file")
-
-
-def raise_ioerror(error):
- warnings.warn(
- "raise_ioerror is deprecated and will be removed in a future release. "
- "Use raise_oserror instead.",
- DeprecationWarning,
- )
- return raise_oserror(error)
-
-
-def _tilesort(t):
- # sort on offset
- return t[2]
-
-
-#
-# --------------------------------------------------------------------
-# ImageFile base class
-
-
-class ImageFile(Image.Image):
- """Base class for image file format handlers."""
-
- def __init__(self, fp=None, filename=None):
- super().__init__()
-
- self._min_frame = 0
-
- self.custom_mimetype = None
-
- self.tile = None
- self.readonly = 1 # until we know better
-
- self.decoderconfig = ()
- self.decodermaxblock = MAXBLOCK
-
- if isPath(fp):
- # filename
- self.fp = open(fp, "rb")
- self.filename = fp
- self._exclusive_fp = True
- else:
- # stream
- self.fp = fp
- self.filename = filename
- # can be overridden
- self._exclusive_fp = None
-
- try:
- try:
- self._open()
- except (
- IndexError, # end of data
- TypeError, # end of data (ord)
- KeyError, # unsupported mode
- EOFError, # got header but not the first frame
- struct.error,
- ) as v:
- raise SyntaxError(v) from v
-
- if not self.mode or self.size[0] <= 0:
- raise SyntaxError("not identified by this driver")
- except BaseException:
- # close the file only if we have opened it this constructor
- if self._exclusive_fp:
- self.fp.close()
- raise
-
- def get_format_mimetype(self):
- if self.custom_mimetype:
- return self.custom_mimetype
- if self.format is not None:
- return Image.MIME.get(self.format.upper())
-
- def verify(self):
- """Check file integrity"""
-
- # raise exception if something's wrong. must be called
- # directly after open, and closes file when finished.
- if self._exclusive_fp:
- self.fp.close()
- self.fp = None
-
- def load(self):
- """Load image data based on tile list"""
-
- if self.tile is None:
- raise OSError("cannot load this image")
-
- pixel = Image.Image.load(self)
- if not self.tile:
- return pixel
-
- self.map = None
- use_mmap = self.filename and len(self.tile) == 1
- # As of pypy 2.1.0, memory mapping was failing here.
- use_mmap = use_mmap and not hasattr(sys, "pypy_version_info")
-
- readonly = 0
-
- # look for read/seek overrides
- try:
- read = self.load_read
- # don't use mmap if there are custom read/seek functions
- use_mmap = False
- except AttributeError:
- read = self.fp.read
-
- try:
- seek = self.load_seek
- use_mmap = False
- except AttributeError:
- seek = self.fp.seek
-
- if use_mmap:
- # try memory mapping
- decoder_name, extents, offset, args = self.tile[0]
- if (
- decoder_name == "raw"
- and len(args) >= 3
- and args[0] == self.mode
- and args[0] in Image._MAPMODES
- ):
- try:
- if hasattr(Image.core, "map"):
- # use built-in mapper WIN32 only
- self.map = Image.core.map(self.filename)
- self.map.seek(offset)
- self.im = self.map.readimage(
- self.mode, self.size, args[1], args[2]
- )
- else:
- # use mmap, if possible
|
[-]
[+]
|
Deleted |
_service:tar_git:harbour-simplecrop-1.0+main.20210420100251.4.g6bfb428.tar.bz2/lib/arm64/PIL/ImageFilter.py
^
|
@@ -1,535 +0,0 @@
-#
-# The Python Imaging Library.
-# $Id$
-#
-# standard filters
-#
-# History:
-# 1995-11-27 fl Created
-# 2002-06-08 fl Added rank and mode filters
-# 2003-09-15 fl Fixed rank calculation in rank filter; added expand call
-#
-# Copyright (c) 1997-2003 by Secret Labs AB.
-# Copyright (c) 1995-2002 by Fredrik Lundh.
-#
-# See the README file for information on usage and redistribution.
-#
-import functools
-
-try:
- import numpy
-except ImportError: # pragma: no cover
- numpy = None
-
-
-class Filter:
- pass
-
-
-class MultibandFilter(Filter):
- pass
-
-
-class BuiltinFilter(MultibandFilter):
- def filter(self, image):
- if image.mode == "P":
- raise ValueError("cannot filter palette images")
- return image.filter(*self.filterargs)
-
-
-class Kernel(BuiltinFilter):
- """
- Create a convolution kernel. The current version only
- supports 3x3 and 5x5 integer and floating point kernels.
-
- In the current version, kernels can only be applied to
- "L" and "RGB" images.
-
- :param size: Kernel size, given as (width, height). In the current
- version, this must be (3,3) or (5,5).
- :param kernel: A sequence containing kernel weights.
- :param scale: Scale factor. If given, the result for each pixel is
- divided by this value. the default is the sum of the
- kernel weights.
- :param offset: Offset. If given, this value is added to the result,
- after it has been divided by the scale factor.
- """
-
- name = "Kernel"
-
- def __init__(self, size, kernel, scale=None, offset=0):
- if scale is None:
- # default scale is sum of kernel
- scale = functools.reduce(lambda a, b: a + b, kernel)
- if size[0] * size[1] != len(kernel):
- raise ValueError("not enough coefficients in kernel")
- self.filterargs = size, scale, offset, kernel
-
-
-class RankFilter(Filter):
- """
- Create a rank filter. The rank filter sorts all pixels in
- a window of the given size, and returns the **rank**'th value.
-
- :param size: The kernel size, in pixels.
- :param rank: What pixel value to pick. Use 0 for a min filter,
- ``size * size / 2`` for a median filter, ``size * size - 1``
- for a max filter, etc.
- """
-
- name = "Rank"
-
- def __init__(self, size, rank):
- self.size = size
- self.rank = rank
-
- def filter(self, image):
- if image.mode == "P":
- raise ValueError("cannot filter palette images")
- image = image.expand(self.size // 2, self.size // 2)
- return image.rankfilter(self.size, self.rank)
-
-
-class MedianFilter(RankFilter):
- """
- Create a median filter. Picks the median pixel value in a window with the
- given size.
-
- :param size: The kernel size, in pixels.
- """
-
- name = "Median"
-
- def __init__(self, size=3):
- self.size = size
- self.rank = size * size // 2
-
-
-class MinFilter(RankFilter):
- """
- Create a min filter. Picks the lowest pixel value in a window with the
- given size.
-
- :param size: The kernel size, in pixels.
- """
-
- name = "Min"
-
- def __init__(self, size=3):
- self.size = size
- self.rank = 0
-
-
-class MaxFilter(RankFilter):
- """
- Create a max filter. Picks the largest pixel value in a window with the
- given size.
-
- :param size: The kernel size, in pixels.
- """
-
- name = "Max"
-
- def __init__(self, size=3):
- self.size = size
- self.rank = size * size - 1
-
-
-class ModeFilter(Filter):
- """
- Create a mode filter. Picks the most frequent pixel value in a box with the
- given size. Pixel values that occur only once or twice are ignored; if no
- pixel value occurs more than twice, the original pixel value is preserved.
-
- :param size: The kernel size, in pixels.
- """
-
- name = "Mode"
-
- def __init__(self, size=3):
- self.size = size
-
- def filter(self, image):
- return image.modefilter(self.size)
-
-
-class GaussianBlur(MultibandFilter):
- """Gaussian blur filter.
-
- :param radius: Blur radius.
- """
-
- name = "GaussianBlur"
-
- def __init__(self, radius=2):
- self.radius = radius
-
- def filter(self, image):
- return image.gaussian_blur(self.radius)
-
-
-class BoxBlur(MultibandFilter):
- """Blurs the image by setting each pixel to the average value of the pixels
- in a square box extending radius pixels in each direction.
- Supports float radius of arbitrary size. Uses an optimized implementation
- which runs in linear time relative to the size of the image
- for any radius value.
-
- :param radius: Size of the box in one direction. Radius 0 does not blur,
- returns an identical image. Radius 1 takes 1 pixel
- in each direction, i.e. 9 pixels in total.
- """
-
- name = "BoxBlur"
-
- def __init__(self, radius):
- self.radius = radius
-
- def filter(self, image):
- return image.box_blur(self.radius)
-
-
-class UnsharpMask(MultibandFilter):
- """Unsharp mask filter.
-
- See Wikipedia's entry on `digital unsharp masking`_ for an explanation of
- the parameters.
-
- :param radius: Blur Radius
- :param percent: Unsharp strength, in percent
|
[-]
[+]
|
Deleted |
_service:tar_git:harbour-simplecrop-1.0+main.20210420100251.4.g6bfb428.tar.bz2/lib/arm64/PIL/ImageFont.py
^
|
@@ -1,860 +0,0 @@
-#
-# The Python Imaging Library.
-# $Id$
-#
-# PIL raster font management
-#
-# History:
-# 1996-08-07 fl created (experimental)
-# 1997-08-25 fl minor adjustments to handle fonts from pilfont 0.3
-# 1999-02-06 fl rewrote most font management stuff in C
-# 1999-03-17 fl take pth files into account in load_path (from Richard Jones)
-# 2001-02-17 fl added freetype support
-# 2001-05-09 fl added TransposedFont wrapper class
-# 2002-03-04 fl make sure we have a "L" or "1" font
-# 2002-12-04 fl skip non-directory entries in the system path
-# 2003-04-29 fl add embedded default font
-# 2003-09-27 fl added support for truetype charmap encodings
-#
-# Todo:
-# Adapt to PILFONT2 format (16-bit fonts, compressed, single file)
-#
-# Copyright (c) 1997-2003 by Secret Labs AB
-# Copyright (c) 1996-2003 by Fredrik Lundh
-#
-# See the README file for information on usage and redistribution.
-#
-
-import base64
-import os
-import sys
-from io import BytesIO
-
-from . import Image
-from ._util import isDirectory, isPath
-
-LAYOUT_BASIC = 0
-LAYOUT_RAQM = 1
-
-
-class _imagingft_not_installed:
- # module placeholder
- def __getattr__(self, id):
- raise ImportError("The _imagingft C module is not installed")
-
-
-try:
- from . import _imagingft as core
-except ImportError:
- core = _imagingft_not_installed()
-
-
-# FIXME: add support for pilfont2 format (see FontFile.py)
-
-# --------------------------------------------------------------------
-# Font metrics format:
-# "PILfont" LF
-# fontdescriptor LF
-# (optional) key=value... LF
-# "DATA" LF
-# binary data: 256*10*2 bytes (dx, dy, dstbox, srcbox)
-#
-# To place a character, cut out srcbox and paste at dstbox,
-# relative to the character position. Then move the character
-# position according to dx, dy.
-# --------------------------------------------------------------------
-
-
-class ImageFont:
- "PIL font wrapper"
-
- def _load_pilfont(self, filename):
-
- with open(filename, "rb") as fp:
- image = None
- for ext in (".png", ".gif", ".pbm"):
- if image:
- image.close()
- try:
- fullname = os.path.splitext(filename)[0] + ext
- image = Image.open(fullname)
- except Exception:
- pass
- else:
- if image and image.mode in ("1", "L"):
- break
- else:
- if image:
- image.close()
- raise OSError("cannot find glyph data file")
-
- self.file = fullname
-
- self._load_pilfont_data(fp, image)
- image.close()
-
- def _load_pilfont_data(self, file, image):
-
- # read PILfont header
- if file.readline() != b"PILfont\n":
- raise SyntaxError("Not a PILfont file")
- file.readline().split(b";")
- self.info = [] # FIXME: should be a dictionary
- while True:
- s = file.readline()
- if not s or s == b"DATA\n":
- break
- self.info.append(s)
-
- # read PILfont metrics
- data = file.read(256 * 20)
-
- # check image
- if image.mode not in ("1", "L"):
- raise TypeError("invalid font image mode")
-
- image.load()
-
- self.font = Image.core.font(image.im, data)
-
- def getsize(self, text, *args, **kwargs):
- """
- Returns width and height (in pixels) of given text.
-
- :param text: Text to measure.
-
- :return: (width, height)
- """
- return self.font.getsize(text)
-
- def getmask(self, text, mode="", *args, **kwargs):
- """
- Create a bitmap for the text.
-
- If the font uses antialiasing, the bitmap should have mode ``L`` and use a
- maximum value of 255. Otherwise, it should have mode ``1``.
-
- :param text: Text to render.
- :param mode: Used by some graphics drivers to indicate what mode the
- driver prefers; if empty, the renderer may return either
- mode. Note that the mode is always a string, to simplify
- C-level implementations.
-
- .. versionadded:: 1.1.5
-
- :return: An internal PIL storage memory instance as defined by the
- :py:mod:`PIL.Image.core` interface module.
- """
- return self.font.getmask(text, mode)
-
-
-##
-# Wrapper for FreeType fonts. Application code should use the
-# <b>truetype</b> factory function to create font objects.
-
-
-class FreeTypeFont:
- "FreeType font wrapper (requires _imagingft service)"
-
- def __init__(self, font=None, size=10, index=0, encoding="", layout_engine=None):
- # FIXME: use service provider instead
-
- self.path = font
- self.size = size
- self.index = index
- self.encoding = encoding
-
- if layout_engine not in (LAYOUT_BASIC, LAYOUT_RAQM):
- layout_engine = LAYOUT_BASIC
- if core.HAVE_RAQM:
- layout_engine = LAYOUT_RAQM
- elif layout_engine == LAYOUT_RAQM and not core.HAVE_RAQM:
- layout_engine = LAYOUT_BASIC
-
- self.layout_engine = layout_engine
-
- def load_from_bytes(f):
- self.font_bytes = f.read()
- self.font = core.getfont(
- "", size, index, encoding, self.font_bytes, layout_engine
- )
-
- if isPath(font):
- if sys.platform == "win32":
- font_bytes_path = font if isinstance(font, bytes) else font.encode()
- try:
- font_bytes_path.decode("ascii")
- except UnicodeDecodeError:
- # FreeType cannot load fonts with non-ASCII characters on Windows
- # So load it into memory first
- with open(font, "rb") as f:
- load_from_bytes(f)
- return
- self.font = core.getfont(
- font, size, index, encoding, layout_engine=layout_engine
- )
- else:
- load_from_bytes(font)
-
- def _multiline_split(self, text):
|
[-]
[+]
|
Deleted |
_service:tar_git:harbour-simplecrop-1.0+main.20210420100251.4.g6bfb428.tar.bz2/lib/arm64/PIL/ImageGrab.py
^
|
@@ -1,120 +0,0 @@
-#
-# The Python Imaging Library
-# $Id$
-#
-# screen grabber
-#
-# History:
-# 2001-04-26 fl created
-# 2001-09-17 fl use builtin driver, if present
-# 2002-11-19 fl added grabclipboard support
-#
-# Copyright (c) 2001-2002 by Secret Labs AB
-# Copyright (c) 2001-2002 by Fredrik Lundh
-#
-# See the README file for information on usage and redistribution.
-#
-
-import sys
-
-from . import Image
-
-if sys.platform == "darwin":
- import os
- import tempfile
- import subprocess
-
-
-def grab(bbox=None, include_layered_windows=False, all_screens=False, xdisplay=None):
- if xdisplay is None:
- if sys.platform == "darwin":
- fh, filepath = tempfile.mkstemp(".png")
- os.close(fh)
- subprocess.call(["screencapture", "-x", filepath])
- im = Image.open(filepath)
- im.load()
- os.unlink(filepath)
- if bbox:
- im_cropped = im.crop(bbox)
- im.close()
- return im_cropped
- return im
- elif sys.platform == "win32":
- offset, size, data = Image.core.grabscreen_win32(
- include_layered_windows, all_screens
- )
- im = Image.frombytes(
- "RGB",
- size,
- data,
- # RGB, 32-bit line padding, origin lower left corner
- "raw",
- "BGR",
- (size[0] * 3 + 3) & -4,
- -1,
- )
- if bbox:
- x0, y0 = offset
- left, top, right, bottom = bbox
- im = im.crop((left - x0, top - y0, right - x0, bottom - y0))
- return im
- # use xdisplay=None for default display on non-win32/macOS systems
- if not Image.core.HAVE_XCB:
- raise OSError("Pillow was built without XCB support")
- size, data = Image.core.grabscreen_x11(xdisplay)
- im = Image.frombytes("RGB", size, data, "raw", "BGRX", size[0] * 4, 1)
- if bbox:
- im = im.crop(bbox)
- return im
-
-
-def grabclipboard():
- if sys.platform == "darwin":
- fh, filepath = tempfile.mkstemp(".jpg")
- os.close(fh)
- commands = [
- 'set theFile to (open for access POSIX file "'
- + filepath
- + '" with write permission)',
- "try",
- " write (the clipboard as JPEG picture) to theFile",
- "end try",
- "close access theFile",
- ]
- script = ["osascript"]
- for command in commands:
- script += ["-e", command]
- subprocess.call(script)
-
- im = None
- if os.stat(filepath).st_size != 0:
- im = Image.open(filepath)
- im.load()
- os.unlink(filepath)
- return im
- elif sys.platform == "win32":
- fmt, data = Image.core.grabclipboard_win32()
- if fmt == "file": # CF_HDROP
- import struct
-
- o = struct.unpack_from("I", data)[0]
- if data[16] != 0:
- files = data[o:].decode("utf-16le").split("\0")
- else:
- files = data[o:].decode("mbcs").split("\0")
- return files[: files.index("")]
- if isinstance(data, bytes):
- import io
-
- data = io.BytesIO(data)
- if fmt == "png":
- from . import PngImagePlugin
-
- return PngImagePlugin.PngImageFile(data)
- elif fmt == "DIB":
- from . import BmpImagePlugin
-
- return BmpImagePlugin.DibImageFile(data)
- return None
- else:
- raise NotImplementedError("ImageGrab.grabclipboard() is macOS and Windows only")
|
[-]
[+]
|
Deleted |
_service:tar_git:harbour-simplecrop-1.0+main.20210420100251.4.g6bfb428.tar.bz2/lib/arm64/PIL/ImageMath.py
^
|
@@ -1,253 +0,0 @@
-#
-# The Python Imaging Library
-# $Id$
-#
-# a simple math add-on for the Python Imaging Library
-#
-# History:
-# 1999-02-15 fl Original PIL Plus release
-# 2005-05-05 fl Simplified and cleaned up for PIL 1.1.6
-# 2005-09-12 fl Fixed int() and float() for Python 2.4.1
-#
-# Copyright (c) 1999-2005 by Secret Labs AB
-# Copyright (c) 2005 by Fredrik Lundh
-#
-# See the README file for information on usage and redistribution.
-#
-
-import builtins
-
-from . import Image, _imagingmath
-
-VERBOSE = 0
-
-
-def _isconstant(v):
- return isinstance(v, (int, float))
-
-
-class _Operand:
- """Wraps an image operand, providing standard operators"""
-
- def __init__(self, im):
- self.im = im
-
- def __fixup(self, im1):
- # convert image to suitable mode
- if isinstance(im1, _Operand):
- # argument was an image.
- if im1.im.mode in ("1", "L"):
- return im1.im.convert("I")
- elif im1.im.mode in ("I", "F"):
- return im1.im
- else:
- raise ValueError("unsupported mode: %s" % im1.im.mode)
- else:
- # argument was a constant
- if _isconstant(im1) and self.im.mode in ("1", "L", "I"):
- return Image.new("I", self.im.size, im1)
- else:
- return Image.new("F", self.im.size, im1)
-
- def apply(self, op, im1, im2=None, mode=None):
- im1 = self.__fixup(im1)
- if im2 is None:
- # unary operation
- out = Image.new(mode or im1.mode, im1.size, None)
- im1.load()
- try:
- op = getattr(_imagingmath, op + "_" + im1.mode)
- except AttributeError as e:
- raise TypeError("bad operand type for '%s'" % op) from e
- _imagingmath.unop(op, out.im.id, im1.im.id)
- else:
- # binary operation
- im2 = self.__fixup(im2)
- if im1.mode != im2.mode:
- # convert both arguments to floating point
- if im1.mode != "F":
- im1 = im1.convert("F")
- if im2.mode != "F":
- im2 = im2.convert("F")
- if im1.mode != im2.mode:
- raise ValueError("mode mismatch")
- if im1.size != im2.size:
- # crop both arguments to a common size
- size = (min(im1.size[0], im2.size[0]), min(im1.size[1], im2.size[1]))
- if im1.size != size:
- im1 = im1.crop((0, 0) + size)
- if im2.size != size:
- im2 = im2.crop((0, 0) + size)
- out = Image.new(mode or im1.mode, size, None)
- else:
- out = Image.new(mode or im1.mode, im1.size, None)
- im1.load()
- im2.load()
- try:
- op = getattr(_imagingmath, op + "_" + im1.mode)
- except AttributeError as e:
- raise TypeError("bad operand type for '%s'" % op) from e
- _imagingmath.binop(op, out.im.id, im1.im.id, im2.im.id)
- return _Operand(out)
-
- # unary operators
- def __bool__(self):
- # an image is "true" if it contains at least one non-zero pixel
- return self.im.getbbox() is not None
-
- def __abs__(self):
- return self.apply("abs", self)
-
- def __pos__(self):
- return self
-
- def __neg__(self):
- return self.apply("neg", self)
-
- # binary operators
- def __add__(self, other):
- return self.apply("add", self, other)
-
- def __radd__(self, other):
- return self.apply("add", other, self)
-
- def __sub__(self, other):
- return self.apply("sub", self, other)
-
- def __rsub__(self, other):
- return self.apply("sub", other, self)
-
- def __mul__(self, other):
- return self.apply("mul", self, other)
-
- def __rmul__(self, other):
- return self.apply("mul", other, self)
-
- def __truediv__(self, other):
- return self.apply("div", self, other)
-
- def __rtruediv__(self, other):
- return self.apply("div", other, self)
-
- def __mod__(self, other):
- return self.apply("mod", self, other)
-
- def __rmod__(self, other):
- return self.apply("mod", other, self)
-
- def __pow__(self, other):
- return self.apply("pow", self, other)
-
- def __rpow__(self, other):
- return self.apply("pow", other, self)
-
- # bitwise
- def __invert__(self):
- return self.apply("invert", self)
-
- def __and__(self, other):
- return self.apply("and", self, other)
-
- def __rand__(self, other):
- return self.apply("and", other, self)
-
- def __or__(self, other):
- return self.apply("or", self, other)
-
- def __ror__(self, other):
- return self.apply("or", other, self)
-
- def __xor__(self, other):
- return self.apply("xor", self, other)
-
- def __rxor__(self, other):
- return self.apply("xor", other, self)
-
- def __lshift__(self, other):
- return self.apply("lshift", self, other)
-
- def __rshift__(self, other):
- return self.apply("rshift", self, other)
-
- # logical
- def __eq__(self, other):
- return self.apply("eq", self, other)
-
- def __ne__(self, other):
- return self.apply("ne", self, other)
-
- def __lt__(self, other):
- return self.apply("lt", self, other)
-
- def __le__(self, other):
- return self.apply("le", self, other)
-
- def __gt__(self, other):
- return self.apply("gt", self, other)
-
- def __ge__(self, other):
- return self.apply("ge", self, other)
-
-
-# conversions
-def imagemath_int(self):
- return _Operand(self.im.convert("I"))
-
-
-def imagemath_float(self):
- return _Operand(self.im.convert("F"))
-
|
[-]
[+]
|
Deleted |
_service:tar_git:harbour-simplecrop-1.0+main.20210420100251.4.g6bfb428.tar.bz2/lib/arm64/PIL/ImageMode.py
^
|
@@ -1,64 +0,0 @@
-#
-# The Python Imaging Library.
-# $Id$
-#
-# standard mode descriptors
-#
-# History:
-# 2006-03-20 fl Added
-#
-# Copyright (c) 2006 by Secret Labs AB.
-# Copyright (c) 2006 by Fredrik Lundh.
-#
-# See the README file for information on usage and redistribution.
-#
-
-# mode descriptor cache
-_modes = None
-
-
-class ModeDescriptor:
- """Wrapper for mode strings."""
-
- def __init__(self, mode, bands, basemode, basetype):
- self.mode = mode
- self.bands = bands
- self.basemode = basemode
- self.basetype = basetype
-
- def __str__(self):
- return self.mode
-
-
-def getmode(mode):
- """Gets a mode descriptor for the given mode."""
- global _modes
- if not _modes:
- # initialize mode cache
-
- from . import Image
-
- modes = {}
- # core modes
- for m, (basemode, basetype, bands) in Image._MODEINFO.items():
- modes[m] = ModeDescriptor(m, bands, basemode, basetype)
- # extra experimental modes
- modes["RGBa"] = ModeDescriptor("RGBa", ("R", "G", "B", "a"), "RGB", "L")
- modes["LA"] = ModeDescriptor("LA", ("L", "A"), "L", "L")
- modes["La"] = ModeDescriptor("La", ("L", "a"), "L", "L")
- modes["PA"] = ModeDescriptor("PA", ("P", "A"), "RGB", "L")
- # mapping modes
- for i16mode in (
- "I;16",
- "I;16S",
- "I;16L",
- "I;16LS",
- "I;16B",
- "I;16BS",
- "I;16N",
- "I;16NS",
- ):
- modes[i16mode] = ModeDescriptor(i16mode, ("I",), "L", "L")
- # set global mode cache atomically
- _modes = modes
- return _modes[mode]
|
[-]
[+]
|
Deleted |
_service:tar_git:harbour-simplecrop-1.0+main.20210420100251.4.g6bfb428.tar.bz2/lib/arm64/PIL/ImageMorph.py
^
|
@@ -1,245 +0,0 @@
-# A binary morphology add-on for the Python Imaging Library
-#
-# History:
-# 2014-06-04 Initial version.
-#
-# Copyright (c) 2014 Dov Grobgeld <dov.grobgeld@gmail.com>
-
-import re
-
-from . import Image, _imagingmorph
-
-LUT_SIZE = 1 << 9
-
-# fmt: off
-ROTATION_MATRIX = [
- 6, 3, 0,
- 7, 4, 1,
- 8, 5, 2,
-]
-MIRROR_MATRIX = [
- 2, 1, 0,
- 5, 4, 3,
- 8, 7, 6,
-]
-# fmt: on
-
-
-class LutBuilder:
- """A class for building a MorphLut from a descriptive language
-
- The input patterns is a list of a strings sequences like these::
-
- 4:(...
- .1.
- 111)->1
-
- (whitespaces including linebreaks are ignored). The option 4
- describes a series of symmetry operations (in this case a
- 4-rotation), the pattern is described by:
-
- - . or X - Ignore
- - 1 - Pixel is on
- - 0 - Pixel is off
-
- The result of the operation is described after "->" string.
-
- The default is to return the current pixel value, which is
- returned if no other match is found.
-
- Operations:
-
- - 4 - 4 way rotation
- - N - Negate
- - 1 - Dummy op for no other operation (an op must always be given)
- - M - Mirroring
-
- Example::
-
- lb = LutBuilder(patterns = ["4:(... .1. 111)->1"])
- lut = lb.build_lut()
-
- """
-
- def __init__(self, patterns=None, op_name=None):
- if patterns is not None:
- self.patterns = patterns
- else:
- self.patterns = []
- self.lut = None
- if op_name is not None:
- known_patterns = {
- "corner": ["1:(... ... ...)->0", "4:(00. 01. ...)->1"],
- "dilation4": ["4:(... .0. .1.)->1"],
- "dilation8": ["4:(... .0. .1.)->1", "4:(... .0. ..1)->1"],
- "erosion4": ["4:(... .1. .0.)->0"],
- "erosion8": ["4:(... .1. .0.)->0", "4:(... .1. ..0)->0"],
- "edge": [
- "1:(... ... ...)->0",
- "4:(.0. .1. ...)->1",
- "4:(01. .1. ...)->1",
- ],
- }
- if op_name not in known_patterns:
- raise Exception("Unknown pattern " + op_name + "!")
-
- self.patterns = known_patterns[op_name]
-
- def add_patterns(self, patterns):
- self.patterns += patterns
-
- def build_default_lut(self):
- symbols = [0, 1]
- m = 1 << 4 # pos of current pixel
- self.lut = bytearray(symbols[(i & m) > 0] for i in range(LUT_SIZE))
-
- def get_lut(self):
- return self.lut
-
- def _string_permute(self, pattern, permutation):
- """string_permute takes a pattern and a permutation and returns the
- string permuted according to the permutation list.
- """
- assert len(permutation) == 9
- return "".join(pattern[p] for p in permutation)
-
- def _pattern_permute(self, basic_pattern, options, basic_result):
- """pattern_permute takes a basic pattern and its result and clones
- the pattern according to the modifications described in the $options
- parameter. It returns a list of all cloned patterns."""
- patterns = [(basic_pattern, basic_result)]
-
- # rotations
- if "4" in options:
- res = patterns[-1][1]
- for i in range(4):
- patterns.append(
- (self._string_permute(patterns[-1][0], ROTATION_MATRIX), res)
- )
- # mirror
- if "M" in options:
- n = len(patterns)
- for pattern, res in patterns[0:n]:
- patterns.append((self._string_permute(pattern, MIRROR_MATRIX), res))
-
- # negate
- if "N" in options:
- n = len(patterns)
- for pattern, res in patterns[0:n]:
- # Swap 0 and 1
- pattern = pattern.replace("0", "Z").replace("1", "0").replace("Z", "1")
- res = 1 - int(res)
- patterns.append((pattern, res))
-
- return patterns
-
- def build_lut(self):
- """Compile all patterns into a morphology lut.
-
- TBD :Build based on (file) morphlut:modify_lut
- """
- self.build_default_lut()
- patterns = []
-
- # Parse and create symmetries of the patterns strings
- for p in self.patterns:
- m = re.search(r"(\w*):?\s*\((.+?)\)\s*->\s*(\d)", p.replace("\n", ""))
- if not m:
- raise Exception('Syntax error in pattern "' + p + '"')
- options = m.group(1)
- pattern = m.group(2)
- result = int(m.group(3))
-
- # Get rid of spaces
- pattern = pattern.replace(" ", "").replace("\n", "")
-
- patterns += self._pattern_permute(pattern, options, result)
-
- # compile the patterns into regular expressions for speed
- for i, pattern in enumerate(patterns):
- p = pattern[0].replace(".", "X").replace("X", "[01]")
- p = re.compile(p)
- patterns[i] = (p, pattern[1])
-
- # Step through table and find patterns that match.
- # Note that all the patterns are searched. The last one
- # caught overrides
- for i in range(LUT_SIZE):
- # Build the bit pattern
- bitpattern = bin(i)[2:]
- bitpattern = ("0" * (9 - len(bitpattern)) + bitpattern)[::-1]
-
- for p, r in patterns:
- if p.match(bitpattern):
- self.lut[i] = [0, 1][r]
-
- return self.lut
-
-
-class MorphOp:
- """A class for binary morphological operators"""
-
- def __init__(self, lut=None, op_name=None, patterns=None):
- """Create a binary morphological operator"""
- self.lut = lut
- if op_name is not None:
- self.lut = LutBuilder(op_name=op_name).build_lut()
- elif patterns is not None:
- self.lut = LutBuilder(patterns=patterns).build_lut()
-
- def apply(self, image):
- """Run a single morphological operation on an image
-
- Returns a tuple of the number of changed pixels and the
- morphed image"""
- if self.lut is None:
- raise Exception("No operator loaded")
-
- if image.mode != "L":
- raise Exception("Image must be binary, meaning it must use mode L")
|
[-]
[+]
|
Deleted |
_service:tar_git:harbour-simplecrop-1.0+main.20210420100251.4.g6bfb428.tar.bz2/lib/arm64/PIL/ImageOps.py
^
|
@@ -1,551 +0,0 @@
-#
-# The Python Imaging Library.
-# $Id$
-#
-# standard image operations
-#
-# History:
-# 2001-10-20 fl Created
-# 2001-10-23 fl Added autocontrast operator
-# 2001-12-18 fl Added Kevin's fit operator
-# 2004-03-14 fl Fixed potential division by zero in equalize
-# 2005-05-05 fl Fixed equalize for low number of values
-#
-# Copyright (c) 2001-2004 by Secret Labs AB
-# Copyright (c) 2001-2004 by Fredrik Lundh
-#
-# See the README file for information on usage and redistribution.
-#
-
-import functools
-import operator
-
-from . import Image
-
-#
-# helpers
-
-
-def _border(border):
- if isinstance(border, tuple):
- if len(border) == 2:
- left, top = right, bottom = border
- elif len(border) == 4:
- left, top, right, bottom = border
- else:
- left = top = right = bottom = border
- return left, top, right, bottom
-
-
-def _color(color, mode):
- if isinstance(color, str):
- from . import ImageColor
-
- color = ImageColor.getcolor(color, mode)
- return color
-
-
-def _lut(image, lut):
- if image.mode == "P":
- # FIXME: apply to lookup table, not image data
- raise NotImplementedError("mode P support coming soon")
- elif image.mode in ("L", "RGB"):
- if image.mode == "RGB" and len(lut) == 256:
- lut = lut + lut + lut
- return image.point(lut)
- else:
- raise OSError("not supported for this image mode")
-
-
-#
-# actions
-
-
-def autocontrast(image, cutoff=0, ignore=None):
- """
- Maximize (normalize) image contrast. This function calculates a
- histogram of the input image, removes **cutoff** percent of the
- lightest and darkest pixels from the histogram, and remaps the image
- so that the darkest pixel becomes black (0), and the lightest
- becomes white (255).
-
- :param image: The image to process.
- :param cutoff: How many percent to cut off from the histogram.
- :param ignore: The background pixel value (use None for no background).
- :return: An image.
- """
- histogram = image.histogram()
- lut = []
- for layer in range(0, len(histogram), 256):
- h = histogram[layer : layer + 256]
- if ignore is not None:
- # get rid of outliers
- try:
- h[ignore] = 0
- except TypeError:
- # assume sequence
- for ix in ignore:
- h[ix] = 0
- if cutoff:
- # cut off pixels from both ends of the histogram
- # get number of pixels
- n = 0
- for ix in range(256):
- n = n + h[ix]
- # remove cutoff% pixels from the low end
- cut = n * cutoff // 100
- for lo in range(256):
- if cut > h[lo]:
- cut = cut - h[lo]
- h[lo] = 0
- else:
- h[lo] -= cut
- cut = 0
- if cut <= 0:
- break
- # remove cutoff% samples from the hi end
- cut = n * cutoff // 100
- for hi in range(255, -1, -1):
- if cut > h[hi]:
- cut = cut - h[hi]
- h[hi] = 0
- else:
- h[hi] -= cut
- cut = 0
- if cut <= 0:
- break
- # find lowest/highest samples after preprocessing
- for lo in range(256):
- if h[lo]:
- break
- for hi in range(255, -1, -1):
- if h[hi]:
- break
- if hi <= lo:
- # don't bother
- lut.extend(list(range(256)))
- else:
- scale = 255.0 / (hi - lo)
- offset = -lo * scale
- for ix in range(256):
- ix = int(ix * scale + offset)
- if ix < 0:
- ix = 0
- elif ix > 255:
- ix = 255
- lut.append(ix)
- return _lut(image, lut)
-
-
-def colorize(image, black, white, mid=None, blackpoint=0, whitepoint=255, midpoint=127):
- """
- Colorize grayscale image.
- This function calculates a color wedge which maps all black pixels in
- the source image to the first color and all white pixels to the
- second color. If **mid** is specified, it uses three-color mapping.
- The **black** and **white** arguments should be RGB tuples or color names;
- optionally you can use three-color mapping by also specifying **mid**.
- Mapping positions for any of the colors can be specified
- (e.g. **blackpoint**), where these parameters are the integer
- value corresponding to where the corresponding color should be mapped.
- These parameters must have logical order, such that
- **blackpoint** <= **midpoint** <= **whitepoint** (if **mid** is specified).
-
- :param image: The image to colorize.
- :param black: The color to use for black input pixels.
- :param white: The color to use for white input pixels.
- :param mid: The color to use for midtone input pixels.
- :param blackpoint: an int value [0, 255] for the black mapping.
- :param whitepoint: an int value [0, 255] for the white mapping.
- :param midpoint: an int value [0, 255] for the midtone mapping.
- :return: An image.
- """
-
- # Initial asserts
- assert image.mode == "L"
- if mid is None:
- assert 0 <= blackpoint <= whitepoint <= 255
- else:
- assert 0 <= blackpoint <= midpoint <= whitepoint <= 255
-
- # Define colors from arguments
- black = _color(black, "RGB")
- white = _color(white, "RGB")
- if mid is not None:
- mid = _color(mid, "RGB")
-
- # Empty lists for the mapping
- red = []
- green = []
- blue = []
-
- # Create the low-end values
- for i in range(0, blackpoint):
- red.append(black[0])
- green.append(black[1])
- blue.append(black[2])
-
- # Create the mapping (2-color)
- if mid is None:
-
- range_map = range(0, whitepoint - blackpoint)
-
- for i in range_map:
- red.append(black[0] + i * (white[0] - black[0]) // len(range_map))
- green.append(black[1] + i * (white[1] - black[1]) // len(range_map))
- blue.append(black[2] + i * (white[2] - black[2]) // len(range_map))
-
- # Create the mapping (3-color)
- else:
|
[-]
[+]
|
Deleted |
_service:tar_git:harbour-simplecrop-1.0+main.20210420100251.4.g6bfb428.tar.bz2/lib/arm64/PIL/ImagePalette.py
^
|
@@ -1,221 +0,0 @@
-#
-# The Python Imaging Library.
-# $Id$
-#
-# image palette object
-#
-# History:
-# 1996-03-11 fl Rewritten.
-# 1997-01-03 fl Up and running.
-# 1997-08-23 fl Added load hack
-# 2001-04-16 fl Fixed randint shadow bug in random()
-#
-# Copyright (c) 1997-2001 by Secret Labs AB
-# Copyright (c) 1996-1997 by Fredrik Lundh
-#
-# See the README file for information on usage and redistribution.
-#
-
-import array
-
-from . import GimpGradientFile, GimpPaletteFile, ImageColor, PaletteFile
-
-
-class ImagePalette:
- """
- Color palette for palette mapped images
-
- :param mode: The mode to use for the Palette. See:
- :ref:`concept-modes`. Defaults to "RGB"
- :param palette: An optional palette. If given, it must be a bytearray,
- an array or a list of ints between 0-255 and of length ``size``
- times the number of colors in ``mode``. The list must be aligned
- by channel (All R values must be contiguous in the list before G
- and B values.) Defaults to 0 through 255 per channel.
- :param size: An optional palette size. If given, it cannot be equal to
- or greater than 256. Defaults to 0.
- """
-
- def __init__(self, mode="RGB", palette=None, size=0):
- self.mode = mode
- self.rawmode = None # if set, palette contains raw data
- self.palette = palette or bytearray(range(256)) * len(self.mode)
- self.colors = {}
- self.dirty = None
- if (size == 0 and len(self.mode) * 256 != len(self.palette)) or (
- size != 0 and size != len(self.palette)
- ):
- raise ValueError("wrong palette size")
-
- def copy(self):
- new = ImagePalette()
-
- new.mode = self.mode
- new.rawmode = self.rawmode
- if self.palette is not None:
- new.palette = self.palette[:]
- new.colors = self.colors.copy()
- new.dirty = self.dirty
-
- return new
-
- def getdata(self):
- """
- Get palette contents in format suitable for the low-level
- ``im.putpalette`` primitive.
-
- .. warning:: This method is experimental.
- """
- if self.rawmode:
- return self.rawmode, self.palette
- return self.mode + ";L", self.tobytes()
-
- def tobytes(self):
- """Convert palette to bytes.
-
- .. warning:: This method is experimental.
- """
- if self.rawmode:
- raise ValueError("palette contains raw palette data")
- if isinstance(self.palette, bytes):
- return self.palette
- arr = array.array("B", self.palette)
- if hasattr(arr, "tobytes"):
- return arr.tobytes()
- return arr.tostring()
-
- # Declare tostring as an alias for tobytes
- tostring = tobytes
-
- def getcolor(self, color):
- """Given an rgb tuple, allocate palette entry.
-
- .. warning:: This method is experimental.
- """
- if self.rawmode:
- raise ValueError("palette contains raw palette data")
- if isinstance(color, tuple):
- try:
- return self.colors[color]
- except KeyError as e:
- # allocate new color slot
- if isinstance(self.palette, bytes):
- self.palette = bytearray(self.palette)
- index = len(self.colors)
- if index >= 256:
- raise ValueError("cannot allocate more than 256 colors") from e
- self.colors[color] = index
- self.palette[index] = color[0]
- self.palette[index + 256] = color[1]
- self.palette[index + 512] = color[2]
- self.dirty = 1
- return index
- else:
- raise ValueError("unknown color specifier: %r" % color)
-
- def save(self, fp):
- """Save palette to text file.
-
- .. warning:: This method is experimental.
- """
- if self.rawmode:
- raise ValueError("palette contains raw palette data")
- if isinstance(fp, str):
- fp = open(fp, "w")
- fp.write("# Palette\n")
- fp.write("# Mode: %s\n" % self.mode)
- for i in range(256):
- fp.write("%d" % i)
- for j in range(i * len(self.mode), (i + 1) * len(self.mode)):
- try:
- fp.write(" %d" % self.palette[j])
- except IndexError:
- fp.write(" 0")
- fp.write("\n")
- fp.close()
-
-
-# --------------------------------------------------------------------
-# Internal
-
-
-def raw(rawmode, data):
- palette = ImagePalette()
- palette.rawmode = rawmode
- palette.palette = data
- palette.dirty = 1
- return palette
-
-
-# --------------------------------------------------------------------
-# Factories
-
-
-def make_linear_lut(black, white):
- lut = []
- if black == 0:
- for i in range(256):
- lut.append(white * i // 255)
- else:
- raise NotImplementedError # FIXME
- return lut
-
-
-def make_gamma_lut(exp):
- lut = []
- for i in range(256):
- lut.append(int(((i / 255.0) ** exp) * 255.0 + 0.5))
- return lut
-
-
-def negative(mode="RGB"):
- palette = list(range(256))
- palette.reverse()
- return ImagePalette(mode, palette * len(mode))
-
-
-def random(mode="RGB"):
- from random import randint
-
- palette = []
- for i in range(256 * len(mode)):
- palette.append(randint(0, 255))
- return ImagePalette(mode, palette)
-
-
-def sepia(white="#fff0c0"):
- r, g, b = ImageColor.getrgb(white)
- r = make_linear_lut(0, r)
- g = make_linear_lut(0, g)
- b = make_linear_lut(0, b)
- return ImagePalette("RGB", r + g + b)
-
-
-def wedge(mode="RGB"):
- return ImagePalette(mode, list(range(256)) * len(mode))
-
-
-def load(filename):
-
|
[-]
[+]
|
Deleted |
_service:tar_git:harbour-simplecrop-1.0+main.20210420100251.4.g6bfb428.tar.bz2/lib/arm64/PIL/ImagePath.py
^
|
@@ -1,19 +0,0 @@
-#
-# The Python Imaging Library
-# $Id$
-#
-# path interface
-#
-# History:
-# 1996-11-04 fl Created
-# 2002-04-14 fl Added documentation stub class
-#
-# Copyright (c) Secret Labs AB 1997.
-# Copyright (c) Fredrik Lundh 1996.
-#
-# See the README file for information on usage and redistribution.
-#
-
-from . import Image
-
-Path = Image.core.path
|
[-]
[+]
|
Deleted |
_service:tar_git:harbour-simplecrop-1.0+main.20210420100251.4.g6bfb428.tar.bz2/lib/arm64/PIL/ImageQt.py
^
|
@@ -1,195 +0,0 @@
-#
-# The Python Imaging Library.
-# $Id$
-#
-# a simple Qt image interface.
-#
-# history:
-# 2006-06-03 fl: created
-# 2006-06-04 fl: inherit from QImage instead of wrapping it
-# 2006-06-05 fl: removed toimage helper; move string support to ImageQt
-# 2013-11-13 fl: add support for Qt5 (aurelien.ballier@cyclonit.com)
-#
-# Copyright (c) 2006 by Secret Labs AB
-# Copyright (c) 2006 by Fredrik Lundh
-#
-# See the README file for information on usage and redistribution.
-#
-
-import sys
-from io import BytesIO
-
-from . import Image
-from ._util import isPath
-
-qt_versions = [["5", "PyQt5"], ["side2", "PySide2"]]
-
-# If a version has already been imported, attempt it first
-qt_versions.sort(key=lambda qt_version: qt_version[1] in sys.modules, reverse=True)
-for qt_version, qt_module in qt_versions:
- try:
- if qt_module == "PyQt5":
- from PyQt5.QtGui import QImage, qRgba, QPixmap
- from PyQt5.QtCore import QBuffer, QIODevice
- elif qt_module == "PySide2":
- from PySide2.QtGui import QImage, qRgba, QPixmap
- from PySide2.QtCore import QBuffer, QIODevice
- except (ImportError, RuntimeError):
- continue
- qt_is_installed = True
- break
-else:
- qt_is_installed = False
- qt_version = None
-
-
-def rgb(r, g, b, a=255):
- """(Internal) Turns an RGB color into a Qt compatible color integer."""
- # use qRgb to pack the colors, and then turn the resulting long
- # into a negative integer with the same bitpattern.
- return qRgba(r, g, b, a) & 0xFFFFFFFF
-
-
-def fromqimage(im):
- """
- :param im: A PIL Image object, or a file name
- (given either as Python string or a PyQt string object)
- """
- buffer = QBuffer()
- buffer.open(QIODevice.ReadWrite)
- # preserve alpha channel with png
- # otherwise ppm is more friendly with Image.open
- if im.hasAlphaChannel():
- im.save(buffer, "png")
- else:
- im.save(buffer, "ppm")
-
- b = BytesIO()
- b.write(buffer.data())
- buffer.close()
- b.seek(0)
-
- return Image.open(b)
-
-
-def fromqpixmap(im):
- return fromqimage(im)
- # buffer = QBuffer()
- # buffer.open(QIODevice.ReadWrite)
- # # im.save(buffer)
- # # What if png doesn't support some image features like animation?
- # im.save(buffer, 'ppm')
- # bytes_io = BytesIO()
- # bytes_io.write(buffer.data())
- # buffer.close()
- # bytes_io.seek(0)
- # return Image.open(bytes_io)
-
-
-def align8to32(bytes, width, mode):
- """
- converts each scanline of data from 8 bit to 32 bit aligned
- """
-
- bits_per_pixel = {"1": 1, "L": 8, "P": 8}[mode]
-
- # calculate bytes per line and the extra padding if needed
- bits_per_line = bits_per_pixel * width
- full_bytes_per_line, remaining_bits_per_line = divmod(bits_per_line, 8)
- bytes_per_line = full_bytes_per_line + (1 if remaining_bits_per_line else 0)
-
- extra_padding = -bytes_per_line % 4
-
- # already 32 bit aligned by luck
- if not extra_padding:
- return bytes
-
- new_data = []
- for i in range(len(bytes) // bytes_per_line):
- new_data.append(
- bytes[i * bytes_per_line : (i + 1) * bytes_per_line]
- + b"\x00" * extra_padding
- )
-
- return b"".join(new_data)
-
-
-def _toqclass_helper(im):
- data = None
- colortable = None
-
- # handle filename, if given instead of image name
- if hasattr(im, "toUtf8"):
- # FIXME - is this really the best way to do this?
- im = str(im.toUtf8(), "utf-8")
- if isPath(im):
- im = Image.open(im)
-
- if im.mode == "1":
- format = QImage.Format_Mono
- elif im.mode == "L":
- format = QImage.Format_Indexed8
- colortable = []
- for i in range(256):
- colortable.append(rgb(i, i, i))
- elif im.mode == "P":
- format = QImage.Format_Indexed8
- colortable = []
- palette = im.getpalette()
- for i in range(0, len(palette), 3):
- colortable.append(rgb(*palette[i : i + 3]))
- elif im.mode == "RGB":
- data = im.tobytes("raw", "BGRX")
- format = QImage.Format_RGB32
- elif im.mode == "RGBA":
- data = im.tobytes("raw", "BGRA")
- format = QImage.Format_ARGB32
- else:
- raise ValueError("unsupported image mode %r" % im.mode)
-
- __data = data or align8to32(im.tobytes(), im.size[0], im.mode)
- return {"data": __data, "im": im, "format": format, "colortable": colortable}
-
-
-if qt_is_installed:
-
- class ImageQt(QImage):
- def __init__(self, im):
- """
- An PIL image wrapper for Qt. This is a subclass of PyQt's QImage
- class.
-
- :param im: A PIL Image object, or a file name (given either as
- Python string or a PyQt string object).
- """
- im_data = _toqclass_helper(im)
- # must keep a reference, or Qt will crash!
- # All QImage constructors that take data operate on an existing
- # buffer, so this buffer has to hang on for the life of the image.
- # Fixes https://github.com/python-pillow/Pillow/issues/1370
- self.__data = im_data["data"]
- super().__init__(
- self.__data,
- im_data["im"].size[0],
- im_data["im"].size[1],
- im_data["format"],
- )
- if im_data["colortable"]:
- self.setColorTable(im_data["colortable"])
-
-
-def toqimage(im):
- return ImageQt(im)
-
-
-def toqpixmap(im):
- # # This doesn't work. For now using a dumb approach.
- # im_data = _toqclass_helper(im)
- # result = QPixmap(im_data['im'].size[0], im_data['im'].size[1])
- # result.loadFromData(im_data['data'])
- # Fix some strange bug that causes
- if im.mode == "RGB":
- im = im.convert("RGBA")
-
- qimage = toqimage(im)
- return QPixmap.fromImage(qimage)
|
[-]
[+]
|
Deleted |
_service:tar_git:harbour-simplecrop-1.0+main.20210420100251.4.g6bfb428.tar.bz2/lib/arm64/PIL/ImageSequence.py
^
|
@@ -1,75 +0,0 @@
-#
-# The Python Imaging Library.
-# $Id$
-#
-# sequence support classes
-#
-# history:
-# 1997-02-20 fl Created
-#
-# Copyright (c) 1997 by Secret Labs AB.
-# Copyright (c) 1997 by Fredrik Lundh.
-#
-# See the README file for information on usage and redistribution.
-#
-
-##
-
-
-class Iterator:
- """
- This class implements an iterator object that can be used to loop
- over an image sequence.
-
- You can use the ``[]`` operator to access elements by index. This operator
- will raise an :py:exc:`IndexError` if you try to access a nonexistent
- frame.
-
- :param im: An image object.
- """
-
- def __init__(self, im):
- if not hasattr(im, "seek"):
- raise AttributeError("im must have seek method")
- self.im = im
- self.position = getattr(self.im, "_min_frame", 0)
-
- def __getitem__(self, ix):
- try:
- self.im.seek(ix)
- return self.im
- except EOFError as e:
- raise IndexError from e # end of sequence
-
- def __iter__(self):
- return self
-
- def __next__(self):
- try:
- self.im.seek(self.position)
- self.position += 1
- return self.im
- except EOFError as e:
- raise StopIteration from e
-
-
-def all_frames(im, func=None):
- """
- Applies a given function to all frames in an image or a list of images.
- The frames are returned as a list of separate images.
-
- :param im: An image, or a list of images.
- :param func: The function to apply to all of the image frames.
- :returns: A list of images.
- """
- if not isinstance(im, list):
- im = [im]
-
- ims = []
- for imSequence in im:
- current = imSequence.tell()
-
- ims += [im_frame.copy() for im_frame in Iterator(imSequence)]
-
- imSequence.seek(current)
- return [func(im) for im in ims] if func else ims
|
[-]
[+]
|
Deleted |
_service:tar_git:harbour-simplecrop-1.0+main.20210420100251.4.g6bfb428.tar.bz2/lib/arm64/PIL/ImageShow.py
^
|
@@ -1,238 +0,0 @@
-#
-# The Python Imaging Library.
-# $Id$
-#
-# im.show() drivers
-#
-# History:
-# 2008-04-06 fl Created
-#
-# Copyright (c) Secret Labs AB 2008.
-#
-# See the README file for information on usage and redistribution.
-#
-import os
-import shutil
-import subprocess
-import sys
-import tempfile
-from shlex import quote
-
-from PIL import Image
-
-_viewers = []
-
-
-def register(viewer, order=1):
- """
- The :py:func:`register` function is used to register additional viewers.
-
- :param viewer: The viewer to be registered.
- :param order:
- Zero or a negative integer to prepend this viewer to the list,
- a positive integer to append it.
- """
- try:
- if issubclass(viewer, Viewer):
- viewer = viewer()
- except TypeError:
- pass # raised if viewer wasn't a class
- if order > 0:
- _viewers.append(viewer)
- else:
- _viewers.insert(0, viewer)
-
-
-def show(image, title=None, **options):
- r"""
- Display a given image.
-
- :param image: An image object.
- :param title: Optional title. Not all viewers can display the title.
- :param \**options: Additional viewer options.
- :returns: ``True`` if a suitable viewer was found, ``False`` otherwise.
- """
- for viewer in _viewers:
- if viewer.show(image, title=title, **options):
- return 1
- return 0
-
-
-class Viewer:
- """Base class for viewers."""
-
- # main api
-
- def show(self, image, **options):
- """
- The main function for displaying an image.
- Converts the given image to the target format and displays it.
- """
-
- # save temporary image to disk
- if not (
- image.mode in ("1", "RGBA")
- or (self.format == "PNG" and image.mode in ("I;16", "LA"))
- ):
- base = Image.getmodebase(image.mode)
- if image.mode != base:
- image = image.convert(base)
-
- return self.show_image(image, **options)
-
- # hook methods
-
- format = None
- """The format to convert the image into."""
- options = {}
- """Additional options used to convert the image."""
-
- def get_format(self, image):
- """Return format name, or ``None`` to save as PGM/PPM."""
- return self.format
-
- def get_command(self, file, **options):
- """
- Returns the command used to display the file.
- Not implemented in the base class.
- """
- raise NotImplementedError
-
- def save_image(self, image):
- """Save to temporary file and return filename."""
- return image._dump(format=self.get_format(image), **self.options)
-
- def show_image(self, image, **options):
- """Display the given image."""
- return self.show_file(self.save_image(image), **options)
-
- def show_file(self, file, **options):
- """Display the given file."""
- os.system(self.get_command(file, **options))
- return 1
-
-
-# --------------------------------------------------------------------
-
-
-class WindowsViewer(Viewer):
- """The default viewer on Windows is the default system application for PNG files."""
-
- format = "PNG"
- options = {"compress_level": 1}
-
- def get_command(self, file, **options):
- return (
- 'start "Pillow" /WAIT "%s" '
- "&& ping -n 2 127.0.0.1 >NUL "
- '&& del /f "%s"' % (file, file)
- )
-
-
-if sys.platform == "win32":
- register(WindowsViewer)
-
-
-class MacViewer(Viewer):
- """The default viewer on MacOS using ``Preview.app``."""
-
- format = "PNG"
- options = {"compress_level": 1}
-
- def get_command(self, file, **options):
- # on darwin open returns immediately resulting in the temp
- # file removal while app is opening
- command = "open -a Preview.app"
- command = "({} {}; sleep 20; rm -f {})&".format(
- command, quote(file), quote(file)
- )
- return command
-
- def show_file(self, file, **options):
- """Display given file"""
- fd, path = tempfile.mkstemp()
- with os.fdopen(fd, "w") as f:
- f.write(file)
- with open(path, "r") as f:
- subprocess.Popen(
- ["im=$(cat); open -a Preview.app $im; sleep 20; rm -f $im"],
- shell=True,
- stdin=f,
- )
- os.remove(path)
- return 1
-
-
-if sys.platform == "darwin":
- register(MacViewer)
-
-
-class UnixViewer(Viewer):
- format = "PNG"
- options = {"compress_level": 1}
-
- def get_command(self, file, **options):
- command = self.get_command_ex(file, **options)[0]
- return "({} {}; rm -f {})&".format(command, quote(file), quote(file))
-
- def show_file(self, file, **options):
- """Display given file"""
- fd, path = tempfile.mkstemp()
- with os.fdopen(fd, "w") as f:
- f.write(file)
- with open(path, "r") as f:
- command = self.get_command_ex(file, **options)[0]
- subprocess.Popen(
- ["im=$(cat);" + command + " $im; rm -f $im"], shell=True, stdin=f
- )
- os.remove(path)
- return 1
-
-
-class DisplayViewer(UnixViewer):
- """The ImageMagick ``display`` command."""
-
- def get_command_ex(self, file, **options):
- command = executable = "display"
- return command, executable
-
-
|
[-]
[+]
|
Deleted |
_service:tar_git:harbour-simplecrop-1.0+main.20210420100251.4.g6bfb428.tar.bz2/lib/arm64/PIL/ImageStat.py
^
|
@@ -1,147 +0,0 @@
-#
-# The Python Imaging Library.
-# $Id$
-#
-# global image statistics
-#
-# History:
-# 1996-04-05 fl Created
-# 1997-05-21 fl Added mask; added rms, var, stddev attributes
-# 1997-08-05 fl Added median
-# 1998-07-05 hk Fixed integer overflow error
-#
-# Notes:
-# This class shows how to implement delayed evaluation of attributes.
-# To get a certain value, simply access the corresponding attribute.
-# The __getattr__ dispatcher takes care of the rest.
-#
-# Copyright (c) Secret Labs AB 1997.
-# Copyright (c) Fredrik Lundh 1996-97.
-#
-# See the README file for information on usage and redistribution.
-#
-
-import functools
-import math
-import operator
-
-
-class Stat:
- def __init__(self, image_or_list, mask=None):
- try:
- if mask:
- self.h = image_or_list.histogram(mask)
- else:
- self.h = image_or_list.histogram()
- except AttributeError:
- self.h = image_or_list # assume it to be a histogram list
- if not isinstance(self.h, list):
- raise TypeError("first argument must be image or list")
- self.bands = list(range(len(self.h) // 256))
-
- def __getattr__(self, id):
- """Calculate missing attribute"""
- if id[:4] == "_get":
- raise AttributeError(id)
- # calculate missing attribute
- v = getattr(self, "_get" + id)()
- setattr(self, id, v)
- return v
-
- def _getextrema(self):
- """Get min/max values for each band in the image"""
-
- def minmax(histogram):
- n = 255
- x = 0
- for i in range(256):
- if histogram[i]:
- n = min(n, i)
- x = max(x, i)
- return n, x # returns (255, 0) if there's no data in the histogram
-
- v = []
- for i in range(0, len(self.h), 256):
- v.append(minmax(self.h[i:]))
- return v
-
- def _getcount(self):
- """Get total number of pixels in each layer"""
-
- v = []
- for i in range(0, len(self.h), 256):
- v.append(functools.reduce(operator.add, self.h[i : i + 256]))
- return v
-
- def _getsum(self):
- """Get sum of all pixels in each layer"""
-
- v = []
- for i in range(0, len(self.h), 256):
- layerSum = 0.0
- for j in range(256):
- layerSum += j * self.h[i + j]
- v.append(layerSum)
- return v
-
- def _getsum2(self):
- """Get squared sum of all pixels in each layer"""
-
- v = []
- for i in range(0, len(self.h), 256):
- sum2 = 0.0
- for j in range(256):
- sum2 += (j ** 2) * float(self.h[i + j])
- v.append(sum2)
- return v
-
- def _getmean(self):
- """Get average pixel level for each layer"""
-
- v = []
- for i in self.bands:
- v.append(self.sum[i] / self.count[i])
- return v
-
- def _getmedian(self):
- """Get median pixel level for each layer"""
-
- v = []
- for i in self.bands:
- s = 0
- half = self.count[i] // 2
- b = i * 256
- for j in range(256):
- s = s + self.h[b + j]
- if s > half:
- break
- v.append(j)
- return v
-
- def _getrms(self):
- """Get RMS for each layer"""
-
- v = []
- for i in self.bands:
- v.append(math.sqrt(self.sum2[i] / self.count[i]))
- return v
-
- def _getvar(self):
- """Get variance for each layer"""
-
- v = []
- for i in self.bands:
- n = self.count[i]
- v.append((self.sum2[i] - (self.sum[i] ** 2.0) / n) / n)
- return v
-
- def _getstddev(self):
- """Get standard deviation for each layer"""
-
- v = []
- for i in self.bands:
- v.append(math.sqrt(self.var[i]))
- return v
-
-
-Global = Stat # compatibility
|
[-]
[+]
|
Deleted |
_service:tar_git:harbour-simplecrop-1.0+main.20210420100251.4.g6bfb428.tar.bz2/lib/arm64/PIL/ImageTk.py
^
|
@@ -1,300 +0,0 @@
-#
-# The Python Imaging Library.
-# $Id$
-#
-# a Tk display interface
-#
-# History:
-# 96-04-08 fl Created
-# 96-09-06 fl Added getimage method
-# 96-11-01 fl Rewritten, removed image attribute and crop method
-# 97-05-09 fl Use PyImagingPaste method instead of image type
-# 97-05-12 fl Minor tweaks to match the IFUNC95 interface
-# 97-05-17 fl Support the "pilbitmap" booster patch
-# 97-06-05 fl Added file= and data= argument to image constructors
-# 98-03-09 fl Added width and height methods to Image classes
-# 98-07-02 fl Use default mode for "P" images without palette attribute
-# 98-07-02 fl Explicitly destroy Tkinter image objects
-# 99-07-24 fl Support multiple Tk interpreters (from Greg Couch)
-# 99-07-26 fl Automatically hook into Tkinter (if possible)
-# 99-08-15 fl Hook uses _imagingtk instead of _imaging
-#
-# Copyright (c) 1997-1999 by Secret Labs AB
-# Copyright (c) 1996-1997 by Fredrik Lundh
-#
-# See the README file for information on usage and redistribution.
-#
-
-import tkinter
-from io import BytesIO
-
-from . import Image
-
-# --------------------------------------------------------------------
-# Check for Tkinter interface hooks
-
-_pilbitmap_ok = None
-
-
-def _pilbitmap_check():
- global _pilbitmap_ok
- if _pilbitmap_ok is None:
- try:
- im = Image.new("1", (1, 1))
- tkinter.BitmapImage(data="PIL:%d" % im.im.id)
- _pilbitmap_ok = 1
- except tkinter.TclError:
- _pilbitmap_ok = 0
- return _pilbitmap_ok
-
-
-def _get_image_from_kw(kw):
- source = None
- if "file" in kw:
- source = kw.pop("file")
- elif "data" in kw:
- source = BytesIO(kw.pop("data"))
- if source:
- return Image.open(source)
-
-
-# --------------------------------------------------------------------
-# PhotoImage
-
-
-class PhotoImage:
- """
- A Tkinter-compatible photo image. This can be used
- everywhere Tkinter expects an image object. If the image is an RGBA
- image, pixels having alpha 0 are treated as transparent.
-
- The constructor takes either a PIL image, or a mode and a size.
- Alternatively, you can use the **file** or **data** options to initialize
- the photo image object.
-
- :param image: Either a PIL image, or a mode string. If a mode string is
- used, a size must also be given.
- :param size: If the first argument is a mode string, this defines the size
- of the image.
- :keyword file: A filename to load the image from (using
- ``Image.open(file)``).
- :keyword data: An 8-bit string containing image data (as loaded from an
- image file).
- """
-
- def __init__(self, image=None, size=None, **kw):
-
- # Tk compatibility: file or data
- if image is None:
- image = _get_image_from_kw(kw)
-
- if hasattr(image, "mode") and hasattr(image, "size"):
- # got an image instead of a mode
- mode = image.mode
- if mode == "P":
- # palette mapped data
- image.load()
- try:
- mode = image.palette.mode
- except AttributeError:
- mode = "RGB" # default
- size = image.size
- kw["width"], kw["height"] = size
- else:
- mode = image
- image = None
-
- if mode not in ["1", "L", "RGB", "RGBA"]:
- mode = Image.getmodebase(mode)
-
- self.__mode = mode
- self.__size = size
- self.__photo = tkinter.PhotoImage(**kw)
- self.tk = self.__photo.tk
- if image:
- self.paste(image)
-
- def __del__(self):
- name = self.__photo.name
- self.__photo.name = None
- try:
- self.__photo.tk.call("image", "delete", name)
- except Exception:
- pass # ignore internal errors
-
- def __str__(self):
- """
- Get the Tkinter photo image identifier. This method is automatically
- called by Tkinter whenever a PhotoImage object is passed to a Tkinter
- method.
-
- :return: A Tkinter photo image identifier (a string).
- """
- return str(self.__photo)
-
- def width(self):
- """
- Get the width of the image.
-
- :return: The width, in pixels.
- """
- return self.__size[0]
-
- def height(self):
- """
- Get the height of the image.
-
- :return: The height, in pixels.
- """
- return self.__size[1]
-
- def paste(self, im, box=None):
- """
- Paste a PIL image into the photo image. Note that this can
- be very slow if the photo image is displayed.
-
- :param im: A PIL image. The size must match the target region. If the
- mode does not match, the image is converted to the mode of
- the bitmap image.
- :param box: A 4-tuple defining the left, upper, right, and lower pixel
- coordinate. See :ref:`coordinate-system`. If None is given
- instead of a tuple, all of the image is assumed.
- """
-
- # convert to blittable
- im.load()
- image = im.im
- if image.isblock() and im.mode == self.__mode:
- block = image
- else:
- block = image.new_block(self.__mode, im.size)
- image.convert2(block, image) # convert directly between buffers
-
- tk = self.__photo.tk
-
- try:
- tk.call("PyImagingPhoto", self.__photo, block.id)
- except tkinter.TclError:
- # activate Tkinter hook
- try:
- from . import _imagingtk
-
- try:
- if hasattr(tk, "interp"):
- # Required for PyPy, which always has CFFI installed
- from cffi import FFI
-
- ffi = FFI()
-
- # PyPy is using an FFI CDATA element
- # (Pdb) self.tk.interp
- # <cdata 'Tcl_Interp *' 0x3061b50>
- _imagingtk.tkinit(int(ffi.cast("uintptr_t", tk.interp)), 1)
- else:
- _imagingtk.tkinit(tk.interpaddr(), 1)
- except AttributeError:
- _imagingtk.tkinit(id(tk), 0)
- tk.call("PyImagingPhoto", self.__photo, block.id)
- except (ImportError, AttributeError, tkinter.TclError):
- raise # configuration problem; cannot attach to Tkinter
|
[-]
[+]
|
Deleted |
_service:tar_git:harbour-simplecrop-1.0+main.20210420100251.4.g6bfb428.tar.bz2/lib/arm64/PIL/ImageTransform.py
^
|
@@ -1,102 +0,0 @@
-#
-# The Python Imaging Library.
-# $Id$
-#
-# transform wrappers
-#
-# History:
-# 2002-04-08 fl Created
-#
-# Copyright (c) 2002 by Secret Labs AB
-# Copyright (c) 2002 by Fredrik Lundh
-#
-# See the README file for information on usage and redistribution.
-#
-
-from . import Image
-
-
-class Transform(Image.ImageTransformHandler):
- def __init__(self, data):
- self.data = data
-
- def getdata(self):
- return self.method, self.data
-
- def transform(self, size, image, **options):
- # can be overridden
- method, data = self.getdata()
- return image.transform(size, method, data, **options)
-
-
-class AffineTransform(Transform):
- """
- Define an affine image transform.
-
- This function takes a 6-tuple (a, b, c, d, e, f) which contain the first
- two rows from an affine transform matrix. For each pixel (x, y) in the
- output image, the new value is taken from a position (a x + b y + c,
- d x + e y + f) in the input image, rounded to nearest pixel.
-
- This function can be used to scale, translate, rotate, and shear the
- original image.
-
- See :py:meth:`~PIL.Image.Image.transform`
-
- :param matrix: A 6-tuple (a, b, c, d, e, f) containing the first two rows
- from an affine transform matrix.
- """
-
- method = Image.AFFINE
-
-
-class ExtentTransform(Transform):
- """
- Define a transform to extract a subregion from an image.
-
- Maps a rectangle (defined by two corners) from the image to a rectangle of
- the given size. The resulting image will contain data sampled from between
- the corners, such that (x0, y0) in the input image will end up at (0,0) in
- the output image, and (x1, y1) at size.
-
- This method can be used to crop, stretch, shrink, or mirror an arbitrary
- rectangle in the current image. It is slightly slower than crop, but about
- as fast as a corresponding resize operation.
-
- See :py:meth:`~PIL.Image.Image.transform`
-
- :param bbox: A 4-tuple (x0, y0, x1, y1) which specifies two points in the
- input image's coordinate system. See :ref:`coordinate-system`.
- """
-
- method = Image.EXTENT
-
-
-class QuadTransform(Transform):
- """
- Define a quad image transform.
-
- Maps a quadrilateral (a region defined by four corners) from the image to a
- rectangle of the given size.
-
- See :py:meth:`~PIL.Image.Image.transform`
-
- :param xy: An 8-tuple (x0, y0, x1, y1, x2, y2, x3, y3) which contain the
- upper left, lower left, lower right, and upper right corner of the
- source quadrilateral.
- """
-
- method = Image.QUAD
-
-
-class MeshTransform(Transform):
- """
- Define a mesh image transform. A mesh transform consists of one or more
- individual quad transforms.
-
- See :py:meth:`~PIL.Image.Image.transform`
-
- :param data: A list of (bbox, quad) tuples.
- """
-
- method = Image.MESH
|
[-]
[+]
|
Deleted |
_service:tar_git:harbour-simplecrop-1.0+main.20210420100251.4.g6bfb428.tar.bz2/lib/arm64/PIL/ImageWin.py
^
|
@@ -1,230 +0,0 @@
-#
-# The Python Imaging Library.
-# $Id$
-#
-# a Windows DIB display interface
-#
-# History:
-# 1996-05-20 fl Created
-# 1996-09-20 fl Fixed subregion exposure
-# 1997-09-21 fl Added draw primitive (for tzPrint)
-# 2003-05-21 fl Added experimental Window/ImageWindow classes
-# 2003-09-05 fl Added fromstring/tostring methods
-#
-# Copyright (c) Secret Labs AB 1997-2003.
-# Copyright (c) Fredrik Lundh 1996-2003.
-#
-# See the README file for information on usage and redistribution.
-#
-
-from . import Image
-
-
-class HDC:
- """
- Wraps an HDC integer. The resulting object can be passed to the
- :py:meth:`~PIL.ImageWin.Dib.draw` and :py:meth:`~PIL.ImageWin.Dib.expose`
- methods.
- """
-
- def __init__(self, dc):
- self.dc = dc
-
- def __int__(self):
- return self.dc
-
-
-class HWND:
- """
- Wraps an HWND integer. The resulting object can be passed to the
- :py:meth:`~PIL.ImageWin.Dib.draw` and :py:meth:`~PIL.ImageWin.Dib.expose`
- methods, instead of a DC.
- """
-
- def __init__(self, wnd):
- self.wnd = wnd
-
- def __int__(self):
- return self.wnd
-
-
-class Dib:
- """
- A Windows bitmap with the given mode and size. The mode can be one of "1",
- "L", "P", or "RGB".
-
- If the display requires a palette, this constructor creates a suitable
- palette and associates it with the image. For an "L" image, 128 greylevels
- are allocated. For an "RGB" image, a 6x6x6 colour cube is used, together
- with 20 greylevels.
-
- To make sure that palettes work properly under Windows, you must call the
- **palette** method upon certain events from Windows.
-
- :param image: Either a PIL image, or a mode string. If a mode string is
- used, a size must also be given. The mode can be one of "1",
- "L", "P", or "RGB".
- :param size: If the first argument is a mode string, this
- defines the size of the image.
- """
-
- def __init__(self, image, size=None):
- if hasattr(image, "mode") and hasattr(image, "size"):
- mode = image.mode
- size = image.size
- else:
- mode = image
- image = None
- if mode not in ["1", "L", "P", "RGB"]:
- mode = Image.getmodebase(mode)
- self.image = Image.core.display(mode, size)
- self.mode = mode
- self.size = size
- if image:
- self.paste(image)
-
- def expose(self, handle):
- """
- Copy the bitmap contents to a device context.
-
- :param handle: Device context (HDC), cast to a Python integer, or an
- HDC or HWND instance. In PythonWin, you can use the
- :py:meth:`CDC.GetHandleAttrib` to get a suitable handle.
- """
- if isinstance(handle, HWND):
- dc = self.image.getdc(handle)
- try:
- result = self.image.expose(dc)
- finally:
- self.image.releasedc(handle, dc)
- else:
- result = self.image.expose(handle)
- return result
-
- def draw(self, handle, dst, src=None):
- """
- Same as expose, but allows you to specify where to draw the image, and
- what part of it to draw.
-
- The destination and source areas are given as 4-tuple rectangles. If
- the source is omitted, the entire image is copied. If the source and
- the destination have different sizes, the image is resized as
- necessary.
- """
- if not src:
- src = (0, 0) + self.size
- if isinstance(handle, HWND):
- dc = self.image.getdc(handle)
- try:
- result = self.image.draw(dc, dst, src)
- finally:
- self.image.releasedc(handle, dc)
- else:
- result = self.image.draw(handle, dst, src)
- return result
-
- def query_palette(self, handle):
- """
- Installs the palette associated with the image in the given device
- context.
-
- This method should be called upon **QUERYNEWPALETTE** and
- **PALETTECHANGED** events from Windows. If this method returns a
- non-zero value, one or more display palette entries were changed, and
- the image should be redrawn.
-
- :param handle: Device context (HDC), cast to a Python integer, or an
- HDC or HWND instance.
- :return: A true value if one or more entries were changed (this
- indicates that the image should be redrawn).
- """
- if isinstance(handle, HWND):
- handle = self.image.getdc(handle)
- try:
- result = self.image.query_palette(handle)
- finally:
- self.image.releasedc(handle, handle)
- else:
- result = self.image.query_palette(handle)
- return result
-
- def paste(self, im, box=None):
- """
- Paste a PIL image into the bitmap image.
-
- :param im: A PIL image. The size must match the target region.
- If the mode does not match, the image is converted to the
- mode of the bitmap image.
- :param box: A 4-tuple defining the left, upper, right, and
- lower pixel coordinate. See :ref:`coordinate-system`. If
- None is given instead of a tuple, all of the image is
- assumed.
- """
- im.load()
- if self.mode != im.mode:
- im = im.convert(self.mode)
- if box:
- self.image.paste(im.im, box)
- else:
- self.image.paste(im.im)
-
- def frombytes(self, buffer):
- """
- Load display memory contents from byte data.
-
- :param buffer: A buffer containing display data (usually
- data returned from :py:func:`~PIL.ImageWin.Dib.tobytes`)
- """
- return self.image.frombytes(buffer)
-
- def tobytes(self):
- """
- Copy display memory contents to bytes object.
-
- :return: A bytes object containing display data.
- """
- return self.image.tobytes()
-
-
-class Window:
- """Create a Window with the given title size."""
-
- def __init__(self, title="PIL", width=None, height=None):
- self.hwnd = Image.core.createwindow(
- title, self.__dispatcher, width or 0, height or 0
- )
-
- def __dispatcher(self, action, *args):
- return getattr(self, "ui_handle_" + action)(*args)
-
|
[-]
[+]
|
Deleted |
_service:tar_git:harbour-simplecrop-1.0+main.20210420100251.4.g6bfb428.tar.bz2/lib/arm64/PIL/ImtImagePlugin.py
^
|
@@ -1,93 +0,0 @@
-#
-# The Python Imaging Library.
-# $Id$
-#
-# IM Tools support for PIL
-#
-# history:
-# 1996-05-27 fl Created (read 8-bit images only)
-# 2001-02-17 fl Use 're' instead of 'regex' (Python 2.1) (0.2)
-#
-# Copyright (c) Secret Labs AB 1997-2001.
-# Copyright (c) Fredrik Lundh 1996-2001.
-#
-# See the README file for information on usage and redistribution.
-#
-
-
-import re
-
-from . import Image, ImageFile
-
-#
-# --------------------------------------------------------------------
-
-field = re.compile(br"([a-z]*) ([^ \r\n]*)")
-
-
-##
-# Image plugin for IM Tools images.
-
-
-class ImtImageFile(ImageFile.ImageFile):
-
- format = "IMT"
- format_description = "IM Tools"
-
- def _open(self):
-
- # Quick rejection: if there's not a LF among the first
- # 100 bytes, this is (probably) not a text header.
-
- if b"\n" not in self.fp.read(100):
- raise SyntaxError("not an IM file")
- self.fp.seek(0)
-
- xsize = ysize = 0
-
- while True:
-
- s = self.fp.read(1)
- if not s:
- break
-
- if s == b"\x0C":
-
- # image data begins
- self.tile = [
- ("raw", (0, 0) + self.size, self.fp.tell(), (self.mode, 0, 1))
- ]
-
- break
-
- else:
-
- # read key/value pair
- # FIXME: dangerous, may read whole file
- s = s + self.fp.readline()
- if len(s) == 1 or len(s) > 100:
- break
- if s[0] == ord(b"*"):
- continue # comment
-
- m = field.match(s)
- if not m:
- break
- k, v = m.group(1, 2)
- if k == "width":
- xsize = int(v)
- self._size = xsize, ysize
- elif k == "height":
- ysize = int(v)
- self._size = xsize, ysize
- elif k == "pixel" and v == "n8":
- self.mode = "L"
-
-
-#
-# --------------------------------------------------------------------
-
-Image.register_open(ImtImageFile.format, ImtImageFile)
-
-#
-# no extension registered (".im" is simply too common)
|
[-]
[+]
|
Deleted |
_service:tar_git:harbour-simplecrop-1.0+main.20210420100251.4.g6bfb428.tar.bz2/lib/arm64/PIL/IptcImagePlugin.py
^
|
@@ -1,226 +0,0 @@
-#
-# The Python Imaging Library.
-# $Id$
-#
-# IPTC/NAA file handling
-#
-# history:
-# 1995-10-01 fl Created
-# 1998-03-09 fl Cleaned up and added to PIL
-# 2002-06-18 fl Added getiptcinfo helper
-#
-# Copyright (c) Secret Labs AB 1997-2002.
-# Copyright (c) Fredrik Lundh 1995.
-#
-# See the README file for information on usage and redistribution.
-#
-import os
-import tempfile
-
-from . import Image, ImageFile
-from ._binary import i8, i16be as i16, i32be as i32, o8
-
-COMPRESSION = {1: "raw", 5: "jpeg"}
-
-PAD = o8(0) * 4
-
-
-#
-# Helpers
-
-
-def i(c):
- return i32((PAD + c)[-4:])
-
-
-def dump(c):
- for i in c:
- print("%02x" % i8(i), end=" ")
- print()
-
-
-##
-# Image plugin for IPTC/NAA datastreams. To read IPTC/NAA fields
-# from TIFF and JPEG files, use the <b>getiptcinfo</b> function.
-
-
-class IptcImageFile(ImageFile.ImageFile):
-
- format = "IPTC"
- format_description = "IPTC/NAA"
-
- def getint(self, key):
- return i(self.info[key])
-
- def field(self):
- #
- # get a IPTC field header
- s = self.fp.read(5)
- if not len(s):
- return None, 0
-
- tag = i8(s[1]), i8(s[2])
-
- # syntax
- if i8(s[0]) != 0x1C or tag[0] < 1 or tag[0] > 9:
- raise SyntaxError("invalid IPTC/NAA file")
-
- # field size
- size = i8(s[3])
- if size > 132:
- raise OSError("illegal field length in IPTC/NAA file")
- elif size == 128:
- size = 0
- elif size > 128:
- size = i(self.fp.read(size - 128))
- else:
- size = i16(s[3:])
-
- return tag, size
-
- def _open(self):
-
- # load descriptive fields
- while True:
- offset = self.fp.tell()
- tag, size = self.field()
- if not tag or tag == (8, 10):
- break
- if size:
- tagdata = self.fp.read(size)
- else:
- tagdata = None
- if tag in self.info:
- if isinstance(self.info[tag], list):
- self.info[tag].append(tagdata)
- else:
- self.info[tag] = [self.info[tag], tagdata]
- else:
- self.info[tag] = tagdata
-
- # mode
- layers = i8(self.info[(3, 60)][0])
- component = i8(self.info[(3, 60)][1])
- if (3, 65) in self.info:
- id = i8(self.info[(3, 65)][0]) - 1
- else:
- id = 0
- if layers == 1 and not component:
- self.mode = "L"
- elif layers == 3 and component:
- self.mode = "RGB"[id]
- elif layers == 4 and component:
- self.mode = "CMYK"[id]
-
- # size
- self._size = self.getint((3, 20)), self.getint((3, 30))
-
- # compression
- try:
- compression = COMPRESSION[self.getint((3, 120))]
- except KeyError as e:
- raise OSError("Unknown IPTC image compression") from e
-
- # tile
- if tag == (8, 10):
- self.tile = [
- ("iptc", (compression, offset), (0, 0, self.size[0], self.size[1]))
- ]
-
- def load(self):
-
- if len(self.tile) != 1 or self.tile[0][0] != "iptc":
- return ImageFile.ImageFile.load(self)
-
- type, tile, box = self.tile[0]
-
- encoding, offset = tile
-
- self.fp.seek(offset)
-
- # Copy image data to temporary file
- o_fd, outfile = tempfile.mkstemp(text=False)
- o = os.fdopen(o_fd)
- if encoding == "raw":
- # To simplify access to the extracted file,
- # prepend a PPM header
- o.write("P5\n%d %d\n255\n" % self.size)
- while True:
- type, size = self.field()
- if type != (8, 10):
- break
- while size > 0:
- s = self.fp.read(min(size, 8192))
- if not s:
- break
- o.write(s)
- size -= len(s)
- o.close()
-
- try:
- with Image.open(outfile) as _im:
- _im.load()
- self.im = _im.im
- finally:
- try:
- os.unlink(outfile)
- except OSError:
- pass
-
-
-Image.register_open(IptcImageFile.format, IptcImageFile)
-
-Image.register_extension(IptcImageFile.format, ".iim")
-
-
-def getiptcinfo(im):
- """
- Get IPTC information from TIFF, JPEG, or IPTC file.
-
- :param im: An image containing IPTC data.
- :returns: A dictionary containing IPTC information, or None if
- no IPTC information block was found.
- """
- from . import TiffImagePlugin, JpegImagePlugin
- import io
-
- data = None
-
- if isinstance(im, IptcImageFile):
- # return info dictionary right away
- return im.info
-
- elif isinstance(im, JpegImagePlugin.JpegImageFile):
- # extract the IPTC/NAA resource
- photoshop = im.info.get("photoshop")
- if photoshop:
- data = photoshop.get(0x0404)
-
- elif isinstance(im, TiffImagePlugin.TiffImageFile):
|
[-]
[+]
|
Deleted |
_service:tar_git:harbour-simplecrop-1.0+main.20210420100251.4.g6bfb428.tar.bz2/lib/arm64/PIL/Jpeg2KImagePlugin.py
^
|
@@ -1,314 +0,0 @@
-#
-# The Python Imaging Library
-# $Id$
-#
-# JPEG2000 file handling
-#
-# History:
-# 2014-03-12 ajh Created
-#
-# Copyright (c) 2014 Coriolis Systems Limited
-# Copyright (c) 2014 Alastair Houghton
-#
-# See the README file for information on usage and redistribution.
-#
-import io
-import os
-import struct
-
-from . import Image, ImageFile
-
-
-def _parse_codestream(fp):
- """Parse the JPEG 2000 codestream to extract the size and component
- count from the SIZ marker segment, returning a PIL (size, mode) tuple."""
-
- hdr = fp.read(2)
- lsiz = struct.unpack(">H", hdr)[0]
- siz = hdr + fp.read(lsiz - 2)
- lsiz, rsiz, xsiz, ysiz, xosiz, yosiz, _, _, _, _, csiz = struct.unpack_from(
- ">HHIIIIIIIIH", siz
- )
- ssiz = [None] * csiz
- xrsiz = [None] * csiz
- yrsiz = [None] * csiz
- for i in range(csiz):
- ssiz[i], xrsiz[i], yrsiz[i] = struct.unpack_from(">BBB", siz, 36 + 3 * i)
-
- size = (xsiz - xosiz, ysiz - yosiz)
- if csiz == 1:
- if (yrsiz[0] & 0x7F) > 8:
- mode = "I;16"
- else:
- mode = "L"
- elif csiz == 2:
- mode = "LA"
- elif csiz == 3:
- mode = "RGB"
- elif csiz == 4:
- mode = "RGBA"
- else:
- mode = None
-
- return (size, mode)
-
-
-def _parse_jp2_header(fp):
- """Parse the JP2 header box to extract size, component count and
- color space information, returning a (size, mode, mimetype) tuple."""
-
- # Find the JP2 header box
- header = None
- mimetype = None
- while True:
- lbox, tbox = struct.unpack(">I4s", fp.read(8))
- if lbox == 1:
- lbox = struct.unpack(">Q", fp.read(8))[0]
- hlen = 16
- else:
- hlen = 8
-
- if lbox < hlen:
- raise SyntaxError("Invalid JP2 header length")
-
- if tbox == b"jp2h":
- header = fp.read(lbox - hlen)
- break
- elif tbox == b"ftyp":
- if fp.read(4) == b"jpx ":
- mimetype = "image/jpx"
- fp.seek(lbox - hlen - 4, os.SEEK_CUR)
- else:
- fp.seek(lbox - hlen, os.SEEK_CUR)
-
- if header is None:
- raise SyntaxError("could not find JP2 header")
-
- size = None
- mode = None
- bpc = None
- nc = None
-
- hio = io.BytesIO(header)
- while True:
- lbox, tbox = struct.unpack(">I4s", hio.read(8))
- if lbox == 1:
- lbox = struct.unpack(">Q", hio.read(8))[0]
- hlen = 16
- else:
- hlen = 8
-
- content = hio.read(lbox - hlen)
-
- if tbox == b"ihdr":
- height, width, nc, bpc, c, unkc, ipr = struct.unpack(">IIHBBBB", content)
- size = (width, height)
- if unkc:
- if nc == 1 and (bpc & 0x7F) > 8:
- mode = "I;16"
- elif nc == 1:
- mode = "L"
- elif nc == 2:
- mode = "LA"
- elif nc == 3:
- mode = "RGB"
- elif nc == 4:
- mode = "RGBA"
- break
- elif tbox == b"colr":
- meth, prec, approx = struct.unpack_from(">BBB", content)
- if meth == 1:
- cs = struct.unpack_from(">I", content, 3)[0]
- if cs == 16: # sRGB
- if nc == 1 and (bpc & 0x7F) > 8:
- mode = "I;16"
- elif nc == 1:
- mode = "L"
- elif nc == 3:
- mode = "RGB"
- elif nc == 4:
- mode = "RGBA"
- break
- elif cs == 17: # grayscale
- if nc == 1 and (bpc & 0x7F) > 8:
- mode = "I;16"
- elif nc == 1:
- mode = "L"
- elif nc == 2:
- mode = "LA"
- break
- elif cs == 18: # sYCC
- if nc == 3:
- mode = "RGB"
- elif nc == 4:
- mode = "RGBA"
- break
-
- if size is None or mode is None:
- raise SyntaxError("Malformed jp2 header")
-
- return (size, mode, mimetype)
-
-
-##
-# Image plugin for JPEG2000 images.
-
-
-class Jpeg2KImageFile(ImageFile.ImageFile):
- format = "JPEG2000"
- format_description = "JPEG 2000 (ISO 15444)"
-
- def _open(self):
- sig = self.fp.read(4)
- if sig == b"\xff\x4f\xff\x51":
- self.codec = "j2k"
- self._size, self.mode = _parse_codestream(self.fp)
- else:
- sig = sig + self.fp.read(8)
-
- if sig == b"\x00\x00\x00\x0cjP \x0d\x0a\x87\x0a":
- self.codec = "jp2"
- header = _parse_jp2_header(self.fp)
- self._size, self.mode, self.custom_mimetype = header
- else:
- raise SyntaxError("not a JPEG 2000 file")
-
- if self.size is None or self.mode is None:
- raise SyntaxError("unable to determine size/mode")
-
- self._reduce = 0
- self.layers = 0
-
- fd = -1
- length = -1
-
- try:
- fd = self.fp.fileno()
- length = os.fstat(fd).st_size
- except Exception:
- fd = -1
- try:
- pos = self.fp.tell()
- self.fp.seek(0, io.SEEK_END)
- length = self.fp.tell()
- self.fp.seek(pos)
- except Exception:
- length = -1
-
- self.tile = [
- (
|
[-]
[+]
|
Deleted |
_service:tar_git:harbour-simplecrop-1.0+main.20210420100251.4.g6bfb428.tar.bz2/lib/arm64/PIL/JpegImagePlugin.py
^
|
@@ -1,809 +0,0 @@
-#
-# The Python Imaging Library.
-# $Id$
-#
-# JPEG (JFIF) file handling
-#
-# See "Digital Compression and Coding of Continuous-Tone Still Images,
-# Part 1, Requirements and Guidelines" (CCITT T.81 / ISO 10918-1)
-#
-# History:
-# 1995-09-09 fl Created
-# 1995-09-13 fl Added full parser
-# 1996-03-25 fl Added hack to use the IJG command line utilities
-# 1996-05-05 fl Workaround Photoshop 2.5 CMYK polarity bug
-# 1996-05-28 fl Added draft support, JFIF version (0.1)
-# 1996-12-30 fl Added encoder options, added progression property (0.2)
-# 1997-08-27 fl Save mode 1 images as BW (0.3)
-# 1998-07-12 fl Added YCbCr to draft and save methods (0.4)
-# 1998-10-19 fl Don't hang on files using 16-bit DQT's (0.4.1)
-# 2001-04-16 fl Extract DPI settings from JFIF files (0.4.2)
-# 2002-07-01 fl Skip pad bytes before markers; identify Exif files (0.4.3)
-# 2003-04-25 fl Added experimental EXIF decoder (0.5)
-# 2003-06-06 fl Added experimental EXIF GPSinfo decoder
-# 2003-09-13 fl Extract COM markers
-# 2009-09-06 fl Added icc_profile support (from Florian Hoech)
-# 2009-03-06 fl Changed CMYK handling; always use Adobe polarity (0.6)
-# 2009-03-08 fl Added subsampling support (from Justin Huff).
-#
-# Copyright (c) 1997-2003 by Secret Labs AB.
-# Copyright (c) 1995-1996 by Fredrik Lundh.
-#
-# See the README file for information on usage and redistribution.
-#
-import array
-import io
-import os
-import struct
-import subprocess
-import tempfile
-import warnings
-
-from . import Image, ImageFile, TiffImagePlugin
-from ._binary import i8, i16be as i16, i32be as i32, o8
-from .JpegPresets import presets
-
-#
-# Parser
-
-
-def Skip(self, marker):
- n = i16(self.fp.read(2)) - 2
- ImageFile._safe_read(self.fp, n)
-
-
-def APP(self, marker):
- #
- # Application marker. Store these in the APP dictionary.
- # Also look for well-known application markers.
-
- n = i16(self.fp.read(2)) - 2
- s = ImageFile._safe_read(self.fp, n)
-
- app = "APP%d" % (marker & 15)
-
- self.app[app] = s # compatibility
- self.applist.append((app, s))
-
- if marker == 0xFFE0 and s[:4] == b"JFIF":
- # extract JFIF information
- self.info["jfif"] = version = i16(s, 5) # version
- self.info["jfif_version"] = divmod(version, 256)
- # extract JFIF properties
- try:
- jfif_unit = i8(s[7])
- jfif_density = i16(s, 8), i16(s, 10)
- except Exception:
- pass
- else:
- if jfif_unit == 1:
- self.info["dpi"] = jfif_density
- self.info["jfif_unit"] = jfif_unit
- self.info["jfif_density"] = jfif_density
- elif marker == 0xFFE1 and s[:5] == b"Exif\0":
- if "exif" not in self.info:
- # extract EXIF information (incomplete)
- self.info["exif"] = s # FIXME: value will change
- elif marker == 0xFFE2 and s[:5] == b"FPXR\0":
- # extract FlashPix information (incomplete)
- self.info["flashpix"] = s # FIXME: value will change
- elif marker == 0xFFE2 and s[:12] == b"ICC_PROFILE\0":
- # Since an ICC profile can be larger than the maximum size of
- # a JPEG marker (64K), we need provisions to split it into
- # multiple markers. The format defined by the ICC specifies
- # one or more APP2 markers containing the following data:
- # Identifying string ASCII "ICC_PROFILE\0" (12 bytes)
- # Marker sequence number 1, 2, etc (1 byte)
- # Number of markers Total of APP2's used (1 byte)
- # Profile data (remainder of APP2 data)
- # Decoders should use the marker sequence numbers to
- # reassemble the profile, rather than assuming that the APP2
- # markers appear in the correct sequence.
- self.icclist.append(s)
- elif marker == 0xFFED and s[:14] == b"Photoshop 3.0\x00":
- # parse the image resource block
- offset = 14
- photoshop = self.info.setdefault("photoshop", {})
- while s[offset : offset + 4] == b"8BIM":
- try:
- offset += 4
- # resource code
- code = i16(s, offset)
- offset += 2
- # resource name (usually empty)
- name_len = i8(s[offset])
- # name = s[offset+1:offset+1+name_len]
- offset += 1 + name_len
- offset += offset & 1 # align
- # resource data block
- size = i32(s, offset)
- offset += 4
- data = s[offset : offset + size]
- if code == 0x03ED: # ResolutionInfo
- data = {
- "XResolution": i32(data[:4]) / 65536,
- "DisplayedUnitsX": i16(data[4:8]),
- "YResolution": i32(data[8:12]) / 65536,
- "DisplayedUnitsY": i16(data[12:]),
- }
- photoshop[code] = data
- offset += size
- offset += offset & 1 # align
- except struct.error:
- break # insufficient data
-
- elif marker == 0xFFEE and s[:5] == b"Adobe":
- self.info["adobe"] = i16(s, 5)
- # extract Adobe custom properties
- try:
- adobe_transform = i8(s[1])
- except Exception:
- pass
- else:
- self.info["adobe_transform"] = adobe_transform
- elif marker == 0xFFE2 and s[:4] == b"MPF\0":
- # extract MPO information
- self.info["mp"] = s[4:]
- # offset is current location minus buffer size
- # plus constant header size
- self.info["mpoffset"] = self.fp.tell() - n + 4
-
- # If DPI isn't in JPEG header, fetch from EXIF
- if "dpi" not in self.info and "exif" in self.info:
- try:
- exif = self.getexif()
- resolution_unit = exif[0x0128]
- x_resolution = exif[0x011A]
- try:
- dpi = float(x_resolution[0]) / x_resolution[1]
- except TypeError:
- dpi = x_resolution
- if resolution_unit == 3: # cm
- # 1 dpcm = 2.54 dpi
- dpi *= 2.54
- self.info["dpi"] = int(dpi + 0.5), int(dpi + 0.5)
- except (KeyError, SyntaxError, ValueError, ZeroDivisionError):
- # SyntaxError for invalid/unreadable EXIF
- # KeyError for dpi not included
- # ZeroDivisionError for invalid dpi rational value
- # ValueError for x_resolution[0] being an invalid float
- self.info["dpi"] = 72, 72
-
-
-def COM(self, marker):
- #
- # Comment marker. Store these in the APP dictionary.
- n = i16(self.fp.read(2)) - 2
- s = ImageFile._safe_read(self.fp, n)
-
- self.info["comment"] = s
- self.app["COM"] = s # compatibility
- self.applist.append(("COM", s))
-
-
-def SOF(self, marker):
- #
- # Start of frame marker. Defines the size and mode of the
- # image. JPEG is colour blind, so we use some simple
- # heuristics to map the number of layers to an appropriate
- # mode. Note that this could be made a bit brighter, by
- # looking for JFIF and Adobe APP markers.
-
- n = i16(self.fp.read(2)) - 2
- s = ImageFile._safe_read(self.fp, n)
- self._size = i16(s[3:]), i16(s[1:])
-
- self.bits = i8(s[0])
- if self.bits != 8:
- raise SyntaxError("cannot handle %d-bit layers" % self.bits)
-
|
[-]
[+]
|
Deleted |
_service:tar_git:harbour-simplecrop-1.0+main.20210420100251.4.g6bfb428.tar.bz2/lib/arm64/PIL/JpegPresets.py
^
|
@@ -1,248 +0,0 @@
-"""
-JPEG quality settings equivalent to the Photoshop settings.
-Can be used when saving JPEG files.
-
-The following presets are available by default:
-``web_low``, ``web_medium``, ``web_high``, ``web_very_high``, ``web_maximum``,
-``low``, ``medium``, ``high``, ``maximum``.
-More presets can be added to the :py:data:`presets` dict if needed.
-
-To apply the preset, specify::
-
- quality="preset_name"
-
-To apply only the quantization table::
-
- qtables="preset_name"
-
-To apply only the subsampling setting::
-
- subsampling="preset_name"
-
-Example::
-
- im.save("image_name.jpg", quality="web_high")
-
-Subsampling
------------
-
-Subsampling is the practice of encoding images by implementing less resolution
-for chroma information than for luma information.
-(ref.: https://en.wikipedia.org/wiki/Chroma_subsampling)
-
-Possible subsampling values are 0, 1 and 2 that correspond to 4:4:4, 4:2:2 and
-4:2:0.
-
-You can get the subsampling of a JPEG with the
-`JpegImagePlugin.get_sampling(im)` function.
-
-In JPEG compressed data a JPEG marker is used instead of an EXIF tag.
-(ref.: https://www.exiv2.org/tags.html)
-
-
-Quantization tables
--------------------
-
-They are values use by the DCT (Discrete cosine transform) to remove
-*unnecessary* information from the image (the lossy part of the compression).
-(ref.: https://en.wikipedia.org/wiki/Quantization_matrix#Quantization_matrices,
-https://en.wikipedia.org/wiki/JPEG#Quantization)
-
-You can get the quantization tables of a JPEG with::
-
- im.quantization
-
-This will return a dict with a number of arrays. You can pass this dict
-directly as the qtables argument when saving a JPEG.
-
-The tables format between im.quantization and quantization in presets differ in
-3 ways:
-
-1. The base container of the preset is a list with sublists instead of dict.
- dict[0] -> list[0], dict[1] -> list[1], ...
-2. Each table in a preset is a list instead of an array.
-3. The zigzag order is remove in the preset (needed by libjpeg >= 6a).
-
-You can convert the dict format to the preset format with the
-`JpegImagePlugin.convert_dict_qtables(dict_qtables)` function.
-
-Libjpeg ref.:
-https://web.archive.org/web/20120328125543/http://www.jpegcameras.com/libjpeg/libjpeg-3.html
-
-"""
-
-# fmt: off
-presets = {
- 'web_low': {'subsampling': 2, # "4:2:0"
- 'quantization': [
- [20, 16, 25, 39, 50, 46, 62, 68,
- 16, 18, 23, 38, 38, 53, 65, 68,
- 25, 23, 31, 38, 53, 65, 68, 68,
- 39, 38, 38, 53, 65, 68, 68, 68,
- 50, 38, 53, 65, 68, 68, 68, 68,
- 46, 53, 65, 68, 68, 68, 68, 68,
- 62, 65, 68, 68, 68, 68, 68, 68,
- 68, 68, 68, 68, 68, 68, 68, 68],
- [21, 25, 32, 38, 54, 68, 68, 68,
- 25, 28, 24, 38, 54, 68, 68, 68,
- 32, 24, 32, 43, 66, 68, 68, 68,
- 38, 38, 43, 53, 68, 68, 68, 68,
- 54, 54, 66, 68, 68, 68, 68, 68,
- 68, 68, 68, 68, 68, 68, 68, 68,
- 68, 68, 68, 68, 68, 68, 68, 68,
- 68, 68, 68, 68, 68, 68, 68, 68]
- ]},
- 'web_medium': {'subsampling': 2, # "4:2:0"
- 'quantization': [
- [16, 11, 11, 16, 23, 27, 31, 30,
- 11, 12, 12, 15, 20, 23, 23, 30,
- 11, 12, 13, 16, 23, 26, 35, 47,
- 16, 15, 16, 23, 26, 37, 47, 64,
- 23, 20, 23, 26, 39, 51, 64, 64,
- 27, 23, 26, 37, 51, 64, 64, 64,
- 31, 23, 35, 47, 64, 64, 64, 64,
- 30, 30, 47, 64, 64, 64, 64, 64],
- [17, 15, 17, 21, 20, 26, 38, 48,
- 15, 19, 18, 17, 20, 26, 35, 43,
- 17, 18, 20, 22, 26, 30, 46, 53,
- 21, 17, 22, 28, 30, 39, 53, 64,
- 20, 20, 26, 30, 39, 48, 64, 64,
- 26, 26, 30, 39, 48, 63, 64, 64,
- 38, 35, 46, 53, 64, 64, 64, 64,
- 48, 43, 53, 64, 64, 64, 64, 64]
- ]},
- 'web_high': {'subsampling': 0, # "4:4:4"
- 'quantization': [
- [6, 4, 4, 6, 9, 11, 12, 16,
- 4, 5, 5, 6, 8, 10, 12, 12,
- 4, 5, 5, 6, 10, 12, 14, 19,
- 6, 6, 6, 11, 12, 15, 19, 28,
- 9, 8, 10, 12, 16, 20, 27, 31,
- 11, 10, 12, 15, 20, 27, 31, 31,
- 12, 12, 14, 19, 27, 31, 31, 31,
- 16, 12, 19, 28, 31, 31, 31, 31],
- [7, 7, 13, 24, 26, 31, 31, 31,
- 7, 12, 16, 21, 31, 31, 31, 31,
- 13, 16, 17, 31, 31, 31, 31, 31,
- 24, 21, 31, 31, 31, 31, 31, 31,
- 26, 31, 31, 31, 31, 31, 31, 31,
- 31, 31, 31, 31, 31, 31, 31, 31,
- 31, 31, 31, 31, 31, 31, 31, 31,
- 31, 31, 31, 31, 31, 31, 31, 31]
- ]},
- 'web_very_high': {'subsampling': 0, # "4:4:4"
- 'quantization': [
- [2, 2, 2, 2, 3, 4, 5, 6,
- 2, 2, 2, 2, 3, 4, 5, 6,
- 2, 2, 2, 2, 4, 5, 7, 9,
- 2, 2, 2, 4, 5, 7, 9, 12,
- 3, 3, 4, 5, 8, 10, 12, 12,
- 4, 4, 5, 7, 10, 12, 12, 12,
- 5, 5, 7, 9, 12, 12, 12, 12,
- 6, 6, 9, 12, 12, 12, 12, 12],
- [3, 3, 5, 9, 13, 15, 15, 15,
- 3, 4, 6, 11, 14, 12, 12, 12,
- 5, 6, 9, 14, 12, 12, 12, 12,
- 9, 11, 14, 12, 12, 12, 12, 12,
- 13, 14, 12, 12, 12, 12, 12, 12,
- 15, 12, 12, 12, 12, 12, 12, 12,
- 15, 12, 12, 12, 12, 12, 12, 12,
- 15, 12, 12, 12, 12, 12, 12, 12]
- ]},
- 'web_maximum': {'subsampling': 0, # "4:4:4"
- 'quantization': [
- [1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 2,
- 1, 1, 1, 1, 1, 1, 2, 2,
- 1, 1, 1, 1, 1, 2, 2, 3,
- 1, 1, 1, 1, 2, 2, 3, 3,
- 1, 1, 1, 2, 2, 3, 3, 3,
- 1, 1, 2, 2, 3, 3, 3, 3],
- [1, 1, 1, 2, 2, 3, 3, 3,
- 1, 1, 1, 2, 3, 3, 3, 3,
- 1, 1, 1, 3, 3, 3, 3, 3,
- 2, 2, 3, 3, 3, 3, 3, 3,
- 2, 3, 3, 3, 3, 3, 3, 3,
- 3, 3, 3, 3, 3, 3, 3, 3,
- 3, 3, 3, 3, 3, 3, 3, 3,
- 3, 3, 3, 3, 3, 3, 3, 3]
- ]},
- 'low': {'subsampling': 2, # "4:2:0"
- 'quantization': [
- [18, 14, 14, 21, 30, 35, 34, 17,
- 14, 16, 16, 19, 26, 23, 12, 12,
- 14, 16, 17, 21, 23, 12, 12, 12,
- 21, 19, 21, 23, 12, 12, 12, 12,
- 30, 26, 23, 12, 12, 12, 12, 12,
- 35, 23, 12, 12, 12, 12, 12, 12,
- 34, 12, 12, 12, 12, 12, 12, 12,
- 17, 12, 12, 12, 12, 12, 12, 12],
- [20, 19, 22, 27, 20, 20, 17, 17,
- 19, 25, 23, 14, 14, 12, 12, 12,
- 22, 23, 14, 14, 12, 12, 12, 12,
- 27, 14, 14, 12, 12, 12, 12, 12,
- 20, 14, 12, 12, 12, 12, 12, 12,
- 20, 12, 12, 12, 12, 12, 12, 12,
- 17, 12, 12, 12, 12, 12, 12, 12,
- 17, 12, 12, 12, 12, 12, 12, 12]
- ]},
- 'medium': {'subsampling': 2, # "4:2:0"
- 'quantization': [
- [12, 8, 8, 12, 17, 21, 24, 17,
- 8, 9, 9, 11, 15, 19, 12, 12,
- 8, 9, 10, 12, 19, 12, 12, 12,
- 12, 11, 12, 21, 12, 12, 12, 12,
- 17, 15, 19, 12, 12, 12, 12, 12,
- 21, 19, 12, 12, 12, 12, 12, 12,
- 24, 12, 12, 12, 12, 12, 12, 12,
- 17, 12, 12, 12, 12, 12, 12, 12],
|
[-]
[+]
|
Deleted |
_service:tar_git:harbour-simplecrop-1.0+main.20210420100251.4.g6bfb428.tar.bz2/lib/arm64/PIL/McIdasImagePlugin.py
^
|
@@ -1,75 +0,0 @@
-#
-# The Python Imaging Library.
-# $Id$
-#
-# Basic McIdas support for PIL
-#
-# History:
-# 1997-05-05 fl Created (8-bit images only)
-# 2009-03-08 fl Added 16/32-bit support.
-#
-# Thanks to Richard Jones and Craig Swank for specs and samples.
-#
-# Copyright (c) Secret Labs AB 1997.
-# Copyright (c) Fredrik Lundh 1997.
-#
-# See the README file for information on usage and redistribution.
-#
-
-import struct
-
-from . import Image, ImageFile
-
-
-def _accept(s):
- return s[:8] == b"\x00\x00\x00\x00\x00\x00\x00\x04"
-
-
-##
-# Image plugin for McIdas area images.
-
-
-class McIdasImageFile(ImageFile.ImageFile):
-
- format = "MCIDAS"
- format_description = "McIdas area file"
-
- def _open(self):
-
- # parse area file directory
- s = self.fp.read(256)
- if not _accept(s) or len(s) != 256:
- raise SyntaxError("not an McIdas area file")
-
- self.area_descriptor_raw = s
- self.area_descriptor = w = [0] + list(struct.unpack("!64i", s))
-
- # get mode
- if w[11] == 1:
- mode = rawmode = "L"
- elif w[11] == 2:
- # FIXME: add memory map support
- mode = "I"
- rawmode = "I;16B"
- elif w[11] == 4:
- # FIXME: add memory map support
- mode = "I"
- rawmode = "I;32B"
- else:
- raise SyntaxError("unsupported McIdas format")
-
- self.mode = mode
- self._size = w[10], w[9]
-
- offset = w[34] + w[15]
- stride = w[15] + w[10] * w[11] * w[14]
-
- self.tile = [("raw", (0, 0) + self.size, offset, (rawmode, stride, 1))]
-
-
-# --------------------------------------------------------------------
-# registry
-
-Image.register_open(McIdasImageFile.format, McIdasImageFile, _accept)
-
-# no default extension
|
[-]
[+]
|
Deleted |
_service:tar_git:harbour-simplecrop-1.0+main.20210420100251.4.g6bfb428.tar.bz2/lib/arm64/PIL/MicImagePlugin.py
^
|
@@ -1,107 +0,0 @@
-#
-# The Python Imaging Library.
-# $Id$
-#
-# Microsoft Image Composer support for PIL
-#
-# Notes:
-# uses TiffImagePlugin.py to read the actual image streams
-#
-# History:
-# 97-01-20 fl Created
-#
-# Copyright (c) Secret Labs AB 1997.
-# Copyright (c) Fredrik Lundh 1997.
-#
-# See the README file for information on usage and redistribution.
-#
-
-
-import olefile
-
-from . import Image, TiffImagePlugin
-
-#
-# --------------------------------------------------------------------
-
-
-def _accept(prefix):
- return prefix[:8] == olefile.MAGIC
-
-
-##
-# Image plugin for Microsoft's Image Composer file format.
-
-
-class MicImageFile(TiffImagePlugin.TiffImageFile):
-
- format = "MIC"
- format_description = "Microsoft Image Composer"
- _close_exclusive_fp_after_loading = False
-
- def _open(self):
-
- # read the OLE directory and see if this is a likely
- # to be a Microsoft Image Composer file
-
- try:
- self.ole = olefile.OleFileIO(self.fp)
- except OSError as e:
- raise SyntaxError("not an MIC file; invalid OLE file") from e
-
- # find ACI subfiles with Image members (maybe not the
- # best way to identify MIC files, but what the... ;-)
-
- self.images = []
- for path in self.ole.listdir():
- if path[1:] and path[0][-4:] == ".ACI" and path[1] == "Image":
- self.images.append(path)
-
- # if we didn't find any images, this is probably not
- # an MIC file.
- if not self.images:
- raise SyntaxError("not an MIC file; no image entries")
-
- self.__fp = self.fp
- self.frame = None
- self._n_frames = len(self.images)
- self.is_animated = self._n_frames > 1
-
- if len(self.images) > 1:
- self.category = Image.CONTAINER
-
- self.seek(0)
-
- def seek(self, frame):
- if not self._seek_check(frame):
- return
- try:
- filename = self.images[frame]
- except IndexError as e:
- raise EOFError("no such frame") from e
-
- self.fp = self.ole.openstream(filename)
-
- TiffImagePlugin.TiffImageFile._open(self)
-
- self.frame = frame
-
- def tell(self):
- return self.frame
-
- def _close__fp(self):
- try:
- if self.__fp != self.fp:
- self.__fp.close()
- except AttributeError:
- pass
- finally:
- self.__fp = None
-
-
-#
-# --------------------------------------------------------------------
-
-Image.register_open(MicImageFile.format, MicImageFile, _accept)
-
-Image.register_extension(MicImageFile.format, ".mic")
|
[-]
[+]
|
Deleted |
_service:tar_git:harbour-simplecrop-1.0+main.20210420100251.4.g6bfb428.tar.bz2/lib/arm64/PIL/MpegImagePlugin.py
^
|
@@ -1,83 +0,0 @@
-#
-# The Python Imaging Library.
-# $Id$
-#
-# MPEG file handling
-#
-# History:
-# 95-09-09 fl Created
-#
-# Copyright (c) Secret Labs AB 1997.
-# Copyright (c) Fredrik Lundh 1995.
-#
-# See the README file for information on usage and redistribution.
-#
-
-
-from . import Image, ImageFile
-from ._binary import i8
-
-#
-# Bitstream parser
-
-
-class BitStream:
- def __init__(self, fp):
- self.fp = fp
- self.bits = 0
- self.bitbuffer = 0
-
- def next(self):
- return i8(self.fp.read(1))
-
- def peek(self, bits):
- while self.bits < bits:
- c = self.next()
- if c < 0:
- self.bits = 0
- continue
- self.bitbuffer = (self.bitbuffer << 8) + c
- self.bits += 8
- return self.bitbuffer >> (self.bits - bits) & (1 << bits) - 1
-
- def skip(self, bits):
- while self.bits < bits:
- self.bitbuffer = (self.bitbuffer << 8) + i8(self.fp.read(1))
- self.bits += 8
- self.bits = self.bits - bits
-
- def read(self, bits):
- v = self.peek(bits)
- self.bits = self.bits - bits
- return v
-
-
-##
-# Image plugin for MPEG streams. This plugin can identify a stream,
-# but it cannot read it.
-
-
-class MpegImageFile(ImageFile.ImageFile):
-
- format = "MPEG"
- format_description = "MPEG"
-
- def _open(self):
-
- s = BitStream(self.fp)
-
- if s.read(32) != 0x1B3:
- raise SyntaxError("not an MPEG file")
-
- self.mode = "RGB"
- self._size = s.read(12), s.read(12)
-
-
-# --------------------------------------------------------------------
-# Registry stuff
-
-Image.register_open(MpegImageFile.format, MpegImageFile)
-
-Image.register_extensions(MpegImageFile.format, [".mpg", ".mpeg"])
-
-Image.register_mime(MpegImageFile.format, "video/mpeg")
|
[-]
[+]
|
Deleted |
_service:tar_git:harbour-simplecrop-1.0+main.20210420100251.4.g6bfb428.tar.bz2/lib/arm64/PIL/MpoImagePlugin.py
^
|
@@ -1,134 +0,0 @@
-#
-# The Python Imaging Library.
-# $Id$
-#
-# MPO file handling
-#
-# See "Multi-Picture Format" (CIPA DC-007-Translation 2009, Standard of the
-# Camera & Imaging Products Association)
-#
-# The multi-picture object combines multiple JPEG images (with a modified EXIF
-# data format) into a single file. While it can theoretically be used much like
-# a GIF animation, it is commonly used to represent 3D photographs and is (as
-# of this writing) the most commonly used format by 3D cameras.
-#
-# History:
-# 2014-03-13 Feneric Created
-#
-# See the README file for information on usage and redistribution.
-#
-
-from . import Image, ImageFile, JpegImagePlugin
-from ._binary import i16be as i16
-
-
-def _accept(prefix):
- return JpegImagePlugin._accept(prefix)
-
-
-def _save(im, fp, filename):
- # Note that we can only save the current frame at present
- return JpegImagePlugin._save(im, fp, filename)
-
-
-##
-# Image plugin for MPO images.
-
-
-class MpoImageFile(JpegImagePlugin.JpegImageFile):
-
- format = "MPO"
- format_description = "MPO (CIPA DC-007)"
- _close_exclusive_fp_after_loading = False
-
- def _open(self):
- self.fp.seek(0) # prep the fp in order to pass the JPEG test
- JpegImagePlugin.JpegImageFile._open(self)
- self._after_jpeg_open()
-
- def _after_jpeg_open(self, mpheader=None):
- self.mpinfo = mpheader if mpheader is not None else self._getmp()
- self.n_frames = self.mpinfo[0xB001]
- self.__mpoffsets = [
- mpent["DataOffset"] + self.info["mpoffset"] for mpent in self.mpinfo[0xB002]
- ]
- self.__mpoffsets[0] = 0
- # Note that the following assertion will only be invalid if something
- # gets broken within JpegImagePlugin.
- assert self.n_frames == len(self.__mpoffsets)
- del self.info["mpoffset"] # no longer needed
- self.is_animated = self.n_frames > 1
- self.__fp = self.fp # FIXME: hack
- self.__fp.seek(self.__mpoffsets[0]) # get ready to read first frame
- self.__frame = 0
- self.offset = 0
- # for now we can only handle reading and individual frame extraction
- self.readonly = 1
-
- def load_seek(self, pos):
- self.__fp.seek(pos)
-
- def seek(self, frame):
- if not self._seek_check(frame):
- return
- self.fp = self.__fp
- self.offset = self.__mpoffsets[frame]
-
- self.fp.seek(self.offset + 2) # skip SOI marker
- segment = self.fp.read(2)
- if not segment:
- raise ValueError("No data found for frame")
- if i16(segment) == 0xFFE1: # APP1
- n = i16(self.fp.read(2)) - 2
- self.info["exif"] = ImageFile._safe_read(self.fp, n)
-
- exif = self.getexif()
- if 40962 in exif and 40963 in exif:
- self._size = (exif[40962], exif[40963])
- elif "exif" in self.info:
- del self.info["exif"]
-
- self.tile = [("jpeg", (0, 0) + self.size, self.offset, (self.mode, ""))]
- self.__frame = frame
-
- def tell(self):
- return self.__frame
-
- def _close__fp(self):
- try:
- if self.__fp != self.fp:
- self.__fp.close()
- except AttributeError:
- pass
- finally:
- self.__fp = None
-
- @staticmethod
- def adopt(jpeg_instance, mpheader=None):
- """
- Transform the instance of JpegImageFile into
- an instance of MpoImageFile.
- After the call, the JpegImageFile is extended
- to be an MpoImageFile.
-
- This is essentially useful when opening a JPEG
- file that reveals itself as an MPO, to avoid
- double call to _open.
- """
- jpeg_instance.__class__ = MpoImageFile
- jpeg_instance._after_jpeg_open(mpheader)
- return jpeg_instance
-
-
-# ---------------------------------------------------------------------
-# Registry stuff
-
-# Note that since MPO shares a factory with JPEG, we do not need to do a
-# separate registration for it here.
-# Image.register_open(MpoImageFile.format,
-# JpegImagePlugin.jpeg_factory, _accept)
-Image.register_save(MpoImageFile.format, _save)
-
-Image.register_extension(MpoImageFile.format, ".mpo")
-
-Image.register_mime(MpoImageFile.format, "image/mpo")
|
[-]
[+]
|
Deleted |
_service:tar_git:harbour-simplecrop-1.0+main.20210420100251.4.g6bfb428.tar.bz2/lib/arm64/PIL/MspImagePlugin.py
^
|
@@ -1,193 +0,0 @@
-#
-# The Python Imaging Library.
-#
-# MSP file handling
-#
-# This is the format used by the Paint program in Windows 1 and 2.
-#
-# History:
-# 95-09-05 fl Created
-# 97-01-03 fl Read/write MSP images
-# 17-02-21 es Fixed RLE interpretation
-#
-# Copyright (c) Secret Labs AB 1997.
-# Copyright (c) Fredrik Lundh 1995-97.
-# Copyright (c) Eric Soroos 2017.
-#
-# See the README file for information on usage and redistribution.
-#
-# More info on this format: https://archive.org/details/gg243631
-# Page 313:
-# Figure 205. Windows Paint Version 1: "DanM" Format
-# Figure 206. Windows Paint Version 2: "LinS" Format. Used in Windows V2.03
-#
-# See also: http://www.fileformat.info/format/mspaint/egff.htm
-
-import io
-import struct
-
-from . import Image, ImageFile
-from ._binary import i8, i16le as i16, o16le as o16
-
-#
-# read MSP files
-
-
-def _accept(prefix):
- return prefix[:4] in [b"DanM", b"LinS"]
-
-
-##
-# Image plugin for Windows MSP images. This plugin supports both
-# uncompressed (Windows 1.0).
-
-
-class MspImageFile(ImageFile.ImageFile):
-
- format = "MSP"
- format_description = "Windows Paint"
-
- def _open(self):
-
- # Header
- s = self.fp.read(32)
- if not _accept(s):
- raise SyntaxError("not an MSP file")
-
- # Header checksum
- checksum = 0
- for i in range(0, 32, 2):
- checksum = checksum ^ i16(s[i : i + 2])
- if checksum != 0:
- raise SyntaxError("bad MSP checksum")
-
- self.mode = "1"
- self._size = i16(s[4:]), i16(s[6:])
-
- if s[:4] == b"DanM":
- self.tile = [("raw", (0, 0) + self.size, 32, ("1", 0, 1))]
- else:
- self.tile = [("MSP", (0, 0) + self.size, 32, None)]
-
-
-class MspDecoder(ImageFile.PyDecoder):
- # The algo for the MSP decoder is from
- # http://www.fileformat.info/format/mspaint/egff.htm
- # cc-by-attribution -- That page references is taken from the
- # Encyclopedia of Graphics File Formats and is licensed by
- # O'Reilly under the Creative Common/Attribution license
- #
- # For RLE encoded files, the 32byte header is followed by a scan
- # line map, encoded as one 16bit word of encoded byte length per
- # line.
- #
- # NOTE: the encoded length of the line can be 0. This was not
- # handled in the previous version of this encoder, and there's no
- # mention of how to handle it in the documentation. From the few
- # examples I've seen, I've assumed that it is a fill of the
- # background color, in this case, white.
- #
- #
- # Pseudocode of the decoder:
- # Read a BYTE value as the RunType
- # If the RunType value is zero
- # Read next byte as the RunCount
- # Read the next byte as the RunValue
- # Write the RunValue byte RunCount times
- # If the RunType value is non-zero
- # Use this value as the RunCount
- # Read and write the next RunCount bytes literally
- #
- # e.g.:
- # 0x00 03 ff 05 00 01 02 03 04
- # would yield the bytes:
- # 0xff ff ff 00 01 02 03 04
- #
- # which are then interpreted as a bit packed mode '1' image
-
- _pulls_fd = True
-
- def decode(self, buffer):
-
- img = io.BytesIO()
- blank_line = bytearray((0xFF,) * ((self.state.xsize + 7) // 8))
- try:
- self.fd.seek(32)
- rowmap = struct.unpack_from(
- "<%dH" % (self.state.ysize), self.fd.read(self.state.ysize * 2)
- )
- except struct.error as e:
- raise OSError("Truncated MSP file in row map") from e
-
- for x, rowlen in enumerate(rowmap):
- try:
- if rowlen == 0:
- img.write(blank_line)
- continue
- row = self.fd.read(rowlen)
- if len(row) != rowlen:
- raise OSError(
- "Truncated MSP file, expected %d bytes on row %s", (rowlen, x)
- )
- idx = 0
- while idx < rowlen:
- runtype = i8(row[idx])
- idx += 1
- if runtype == 0:
- (runcount, runval) = struct.unpack_from("Bc", row, idx)
- img.write(runval * runcount)
- idx += 2
- else:
- runcount = runtype
- img.write(row[idx : idx + runcount])
- idx += runcount
-
- except struct.error as e:
- raise OSError("Corrupted MSP file in row %d" % x) from e
-
- self.set_as_raw(img.getvalue(), ("1", 0, 1))
-
- return 0, 0
-
-
-Image.register_decoder("MSP", MspDecoder)
-
-
-#
-# write MSP files (uncompressed only)
-
-
-def _save(im, fp, filename):
-
- if im.mode != "1":
- raise OSError("cannot write mode %s as MSP" % im.mode)
-
- # create MSP header
- header = [0] * 16
-
- header[0], header[1] = i16(b"Da"), i16(b"nM") # version 1
- header[2], header[3] = im.size
- header[4], header[5] = 1, 1
- header[6], header[7] = 1, 1
- header[8], header[9] = im.size
-
- checksum = 0
- for h in header:
- checksum = checksum ^ h
- header[12] = checksum # FIXME: is this the right field?
-
- # header
- for h in header:
- fp.write(o16(h))
-
- # image body
- ImageFile._save(im, fp, [("raw", (0, 0) + im.size, 32, ("1", 0, 1))])
-
-
-#
-# registry
-
-Image.register_open(MspImageFile.format, MspImageFile, _accept)
-Image.register_save(MspImageFile.format, _save)
-
-Image.register_extension(MspImageFile.format, ".msp")
|
[-]
[+]
|
Deleted |
_service:tar_git:harbour-simplecrop-1.0+main.20210420100251.4.g6bfb428.tar.bz2/lib/arm64/PIL/PSDraw.py
^
|
@@ -1,237 +0,0 @@
-#
-# The Python Imaging Library
-# $Id$
-#
-# simple postscript graphics interface
-#
-# History:
-# 1996-04-20 fl Created
-# 1999-01-10 fl Added gsave/grestore to image method
-# 2005-05-04 fl Fixed floating point issue in image (from Eric Etheridge)
-#
-# Copyright (c) 1997-2005 by Secret Labs AB. All rights reserved.
-# Copyright (c) 1996 by Fredrik Lundh.
-#
-# See the README file for information on usage and redistribution.
-#
-
-import sys
-
-from . import EpsImagePlugin
-
-##
-# Simple Postscript graphics interface.
-
-
-class PSDraw:
- """
- Sets up printing to the given file. If **fp** is omitted,
- :py:attr:`sys.stdout` is assumed.
- """
-
- def __init__(self, fp=None):
- if not fp:
- fp = sys.stdout
- self.fp = fp
-
- def _fp_write(self, to_write):
- if self.fp == sys.stdout:
- self.fp.write(to_write)
- else:
- self.fp.write(bytes(to_write, "UTF-8"))
-
- def begin_document(self, id=None):
- """Set up printing of a document. (Write Postscript DSC header.)"""
- # FIXME: incomplete
- self._fp_write(
- "%!PS-Adobe-3.0\n"
- "save\n"
- "/showpage { } def\n"
- "%%EndComments\n"
- "%%BeginDocument\n"
- )
- # self._fp_write(ERROR_PS) # debugging!
- self._fp_write(EDROFF_PS)
- self._fp_write(VDI_PS)
- self._fp_write("%%EndProlog\n")
- self.isofont = {}
-
- def end_document(self):
- """Ends printing. (Write Postscript DSC footer.)"""
- self._fp_write("%%EndDocument\nrestore showpage\n%%End\n")
- if hasattr(self.fp, "flush"):
- self.fp.flush()
-
- def setfont(self, font, size):
- """
- Selects which font to use.
-
- :param font: A Postscript font name
- :param size: Size in points.
- """
- if font not in self.isofont:
- # reencode font
- self._fp_write("/PSDraw-{} ISOLatin1Encoding /{} E\n".format(font, font))
- self.isofont[font] = 1
- # rough
- self._fp_write("/F0 %d /PSDraw-%s F\n" % (size, font))
-
- def line(self, xy0, xy1):
- """
- Draws a line between the two points. Coordinates are given in
- Postscript point coordinates (72 points per inch, (0, 0) is the lower
- left corner of the page).
- """
- xy = xy0 + xy1
- self._fp_write("%d %d %d %d Vl\n" % xy)
-
- def rectangle(self, box):
- """
- Draws a rectangle.
-
- :param box: A 4-tuple of integers whose order and function is currently
- undocumented.
-
- Hint: the tuple is passed into this format string:
-
- .. code-block:: python
-
- %d %d M %d %d 0 Vr\n
- """
- self._fp_write("%d %d M %d %d 0 Vr\n" % box)
-
- def text(self, xy, text):
- """
- Draws text at the given position. You must use
- :py:meth:`~PIL.PSDraw.PSDraw.setfont` before calling this method.
- """
- text = "\\(".join(text.split("("))
- text = "\\)".join(text.split(")"))
- xy = xy + (text,)
- self._fp_write("%d %d M (%s) S\n" % xy)
-
- def image(self, box, im, dpi=None):
- """Draw a PIL image, centered in the given box."""
- # default resolution depends on mode
- if not dpi:
- if im.mode == "1":
- dpi = 200 # fax
- else:
- dpi = 100 # greyscale
- # image size (on paper)
- x = im.size[0] * 72 / dpi
- y = im.size[1] * 72 / dpi
- # max allowed size
- xmax = float(box[2] - box[0])
- ymax = float(box[3] - box[1])
- if x > xmax:
- y = y * xmax / x
- x = xmax
- if y > ymax:
- x = x * ymax / y
- y = ymax
- dx = (xmax - x) / 2 + box[0]
- dy = (ymax - y) / 2 + box[1]
- self._fp_write("gsave\n{:f} {:f} translate\n".format(dx, dy))
- if (x, y) != im.size:
- # EpsImagePlugin._save prints the image at (0,0,xsize,ysize)
- sx = x / im.size[0]
- sy = y / im.size[1]
- self._fp_write("{:f} {:f} scale\n".format(sx, sy))
- EpsImagePlugin._save(im, self.fp, None, 0)
- self._fp_write("\ngrestore\n")
-
-
-# --------------------------------------------------------------------
-# Postscript driver
-
-#
-# EDROFF.PS -- Postscript driver for Edroff 2
-#
-# History:
-# 94-01-25 fl: created (edroff 2.04)
-#
-# Copyright (c) Fredrik Lundh 1994.
-#
-
-
-EDROFF_PS = """\
-/S { show } bind def
-/P { moveto show } bind def
-/M { moveto } bind def
-/X { 0 rmoveto } bind def
-/Y { 0 exch rmoveto } bind def
-/E { findfont
- dup maxlength dict begin
- {
- 1 index /FID ne { def } { pop pop } ifelse
- } forall
- /Encoding exch def
- dup /FontName exch def
- currentdict end definefont pop
-} bind def
-/F { findfont exch scalefont dup setfont
- [ exch /setfont cvx ] cvx bind def
-} bind def
-"""
-
-#
-# VDI.PS -- Postscript driver for VDI meta commands
-#
-# History:
-# 94-01-25 fl: created (edroff 2.04)
-#
-# Copyright (c) Fredrik Lundh 1994.
-#
-
-VDI_PS = """\
-/Vm { moveto } bind def
-/Va { newpath arcn stroke } bind def
-/Vl { moveto lineto stroke } bind def
-/Vc { newpath 0 360 arc closepath } bind def
-/Vr { exch dup 0 rlineto
- exch dup neg 0 exch rlineto
- exch neg 0 rlineto
- 0 exch rlineto
- 100 div setgray fill 0 setgray } bind def
-/Tm matrix def
-/Ve { Tm currentmatrix pop
- translate scale newpath 0 0 .5 0 360 arc closepath
|
[-]
[+]
|
Deleted |
_service:tar_git:harbour-simplecrop-1.0+main.20210420100251.4.g6bfb428.tar.bz2/lib/arm64/PIL/PaletteFile.py
^
|
@@ -1,53 +0,0 @@
-#
-# Python Imaging Library
-# $Id$
-#
-# stuff to read simple, teragon-style palette files
-#
-# History:
-# 97-08-23 fl Created
-#
-# Copyright (c) Secret Labs AB 1997.
-# Copyright (c) Fredrik Lundh 1997.
-#
-# See the README file for information on usage and redistribution.
-#
-
-from ._binary import o8
-
-
-class PaletteFile:
- """File handler for Teragon-style palette files."""
-
- rawmode = "RGB"
-
- def __init__(self, fp):
-
- self.palette = [(i, i, i) for i in range(256)]
-
- while True:
-
- s = fp.readline()
-
- if not s:
- break
- if s[0:1] == b"#":
- continue
- if len(s) > 100:
- raise SyntaxError("bad palette file")
-
- v = [int(x) for x in s.split()]
- try:
- [i, r, g, b] = v
- except ValueError:
- [i, r] = v
- g = b = r
-
- if 0 <= i <= 255:
- self.palette[i] = o8(r) + o8(g) + o8(b)
-
- self.palette = b"".join(self.palette)
-
- def getpalette(self):
-
- return self.palette, self.rawmode
|
[-]
[+]
|
Deleted |
_service:tar_git:harbour-simplecrop-1.0+main.20210420100251.4.g6bfb428.tar.bz2/lib/arm64/PIL/PalmImagePlugin.py
^
|
@@ -1,226 +0,0 @@
-#
-# The Python Imaging Library.
-# $Id$
-#
-
-##
-# Image plugin for Palm pixmap images (output only).
-##
-
-from . import Image, ImageFile
-from ._binary import o8, o16be as o16b
-
-# fmt: off
-_Palm8BitColormapValues = (
- (255, 255, 255), (255, 204, 255), (255, 153, 255), (255, 102, 255),
- (255, 51, 255), (255, 0, 255), (255, 255, 204), (255, 204, 204),
- (255, 153, 204), (255, 102, 204), (255, 51, 204), (255, 0, 204),
- (255, 255, 153), (255, 204, 153), (255, 153, 153), (255, 102, 153),
- (255, 51, 153), (255, 0, 153), (204, 255, 255), (204, 204, 255),
- (204, 153, 255), (204, 102, 255), (204, 51, 255), (204, 0, 255),
- (204, 255, 204), (204, 204, 204), (204, 153, 204), (204, 102, 204),
- (204, 51, 204), (204, 0, 204), (204, 255, 153), (204, 204, 153),
- (204, 153, 153), (204, 102, 153), (204, 51, 153), (204, 0, 153),
- (153, 255, 255), (153, 204, 255), (153, 153, 255), (153, 102, 255),
- (153, 51, 255), (153, 0, 255), (153, 255, 204), (153, 204, 204),
- (153, 153, 204), (153, 102, 204), (153, 51, 204), (153, 0, 204),
- (153, 255, 153), (153, 204, 153), (153, 153, 153), (153, 102, 153),
- (153, 51, 153), (153, 0, 153), (102, 255, 255), (102, 204, 255),
- (102, 153, 255), (102, 102, 255), (102, 51, 255), (102, 0, 255),
- (102, 255, 204), (102, 204, 204), (102, 153, 204), (102, 102, 204),
- (102, 51, 204), (102, 0, 204), (102, 255, 153), (102, 204, 153),
- (102, 153, 153), (102, 102, 153), (102, 51, 153), (102, 0, 153),
- (51, 255, 255), (51, 204, 255), (51, 153, 255), (51, 102, 255),
- (51, 51, 255), (51, 0, 255), (51, 255, 204), (51, 204, 204),
- (51, 153, 204), (51, 102, 204), (51, 51, 204), (51, 0, 204),
- (51, 255, 153), (51, 204, 153), (51, 153, 153), (51, 102, 153),
- (51, 51, 153), (51, 0, 153), (0, 255, 255), (0, 204, 255),
- (0, 153, 255), (0, 102, 255), (0, 51, 255), (0, 0, 255),
- (0, 255, 204), (0, 204, 204), (0, 153, 204), (0, 102, 204),
- (0, 51, 204), (0, 0, 204), (0, 255, 153), (0, 204, 153),
- (0, 153, 153), (0, 102, 153), (0, 51, 153), (0, 0, 153),
- (255, 255, 102), (255, 204, 102), (255, 153, 102), (255, 102, 102),
- (255, 51, 102), (255, 0, 102), (255, 255, 51), (255, 204, 51),
- (255, 153, 51), (255, 102, 51), (255, 51, 51), (255, 0, 51),
- (255, 255, 0), (255, 204, 0), (255, 153, 0), (255, 102, 0),
- (255, 51, 0), (255, 0, 0), (204, 255, 102), (204, 204, 102),
- (204, 153, 102), (204, 102, 102), (204, 51, 102), (204, 0, 102),
- (204, 255, 51), (204, 204, 51), (204, 153, 51), (204, 102, 51),
- (204, 51, 51), (204, 0, 51), (204, 255, 0), (204, 204, 0),
- (204, 153, 0), (204, 102, 0), (204, 51, 0), (204, 0, 0),
- (153, 255, 102), (153, 204, 102), (153, 153, 102), (153, 102, 102),
- (153, 51, 102), (153, 0, 102), (153, 255, 51), (153, 204, 51),
- (153, 153, 51), (153, 102, 51), (153, 51, 51), (153, 0, 51),
- (153, 255, 0), (153, 204, 0), (153, 153, 0), (153, 102, 0),
- (153, 51, 0), (153, 0, 0), (102, 255, 102), (102, 204, 102),
- (102, 153, 102), (102, 102, 102), (102, 51, 102), (102, 0, 102),
- (102, 255, 51), (102, 204, 51), (102, 153, 51), (102, 102, 51),
- (102, 51, 51), (102, 0, 51), (102, 255, 0), (102, 204, 0),
- (102, 153, 0), (102, 102, 0), (102, 51, 0), (102, 0, 0),
- (51, 255, 102), (51, 204, 102), (51, 153, 102), (51, 102, 102),
- (51, 51, 102), (51, 0, 102), (51, 255, 51), (51, 204, 51),
- (51, 153, 51), (51, 102, 51), (51, 51, 51), (51, 0, 51),
- (51, 255, 0), (51, 204, 0), (51, 153, 0), (51, 102, 0),
- (51, 51, 0), (51, 0, 0), (0, 255, 102), (0, 204, 102),
- (0, 153, 102), (0, 102, 102), (0, 51, 102), (0, 0, 102),
- (0, 255, 51), (0, 204, 51), (0, 153, 51), (0, 102, 51),
- (0, 51, 51), (0, 0, 51), (0, 255, 0), (0, 204, 0),
- (0, 153, 0), (0, 102, 0), (0, 51, 0), (17, 17, 17),
- (34, 34, 34), (68, 68, 68), (85, 85, 85), (119, 119, 119),
- (136, 136, 136), (170, 170, 170), (187, 187, 187), (221, 221, 221),
- (238, 238, 238), (192, 192, 192), (128, 0, 0), (128, 0, 128),
- (0, 128, 0), (0, 128, 128), (0, 0, 0), (0, 0, 0),
- (0, 0, 0), (0, 0, 0), (0, 0, 0), (0, 0, 0),
- (0, 0, 0), (0, 0, 0), (0, 0, 0), (0, 0, 0),
- (0, 0, 0), (0, 0, 0), (0, 0, 0), (0, 0, 0),
- (0, 0, 0), (0, 0, 0), (0, 0, 0), (0, 0, 0),
- (0, 0, 0), (0, 0, 0), (0, 0, 0), (0, 0, 0),
- (0, 0, 0), (0, 0, 0), (0, 0, 0), (0, 0, 0))
-# fmt: on
-
-
-# so build a prototype image to be used for palette resampling
-def build_prototype_image():
- image = Image.new("L", (1, len(_Palm8BitColormapValues)))
- image.putdata(list(range(len(_Palm8BitColormapValues))))
- palettedata = ()
- for colormapValue in _Palm8BitColormapValues:
- palettedata += colormapValue
- palettedata += (0, 0, 0) * (256 - len(_Palm8BitColormapValues))
- image.putpalette(palettedata)
- return image
-
-
-Palm8BitColormapImage = build_prototype_image()
-
-# OK, we now have in Palm8BitColormapImage,
-# a "P"-mode image with the right palette
-#
-# --------------------------------------------------------------------
-
-_FLAGS = {"custom-colormap": 0x4000, "is-compressed": 0x8000, "has-transparent": 0x2000}
-
-_COMPRESSION_TYPES = {"none": 0xFF, "rle": 0x01, "scanline": 0x00}
-
-
-#
-# --------------------------------------------------------------------
-
-##
-# (Internal) Image save plugin for the Palm format.
-
-
-def _save(im, fp, filename):
-
- if im.mode == "P":
-
- # we assume this is a color Palm image with the standard colormap,
- # unless the "info" dict has a "custom-colormap" field
-
- rawmode = "P"
- bpp = 8
- version = 1
-
- elif im.mode == "L":
- if im.encoderinfo.get("bpp") in (1, 2, 4):
- # this is 8-bit grayscale, so we shift it to get the high-order bits,
- # and invert it because
- # Palm does greyscale from white (0) to black (1)
- bpp = im.encoderinfo["bpp"]
- im = im.point(
- lambda x, shift=8 - bpp, maxval=(1 << bpp) - 1: maxval - (x >> shift)
- )
- elif im.info.get("bpp") in (1, 2, 4):
- # here we assume that even though the inherent mode is 8-bit grayscale,
- # only the lower bpp bits are significant.
- # We invert them to match the Palm.
- bpp = im.info["bpp"]
- im = im.point(lambda x, maxval=(1 << bpp) - 1: maxval - (x & maxval))
- else:
- raise OSError("cannot write mode %s as Palm" % im.mode)
-
- # we ignore the palette here
- im.mode = "P"
- rawmode = "P;" + str(bpp)
- version = 1
-
- elif im.mode == "1":
-
- # monochrome -- write it inverted, as is the Palm standard
- rawmode = "1;I"
- bpp = 1
- version = 0
-
- else:
-
- raise OSError("cannot write mode %s as Palm" % im.mode)
-
- #
- # make sure image data is available
- im.load()
-
- # write header
-
- cols = im.size[0]
- rows = im.size[1]
-
- rowbytes = int((cols + (16 // bpp - 1)) / (16 // bpp)) * 2
- transparent_index = 0
- compression_type = _COMPRESSION_TYPES["none"]
-
- flags = 0
- if im.mode == "P" and "custom-colormap" in im.info:
- flags = flags & _FLAGS["custom-colormap"]
- colormapsize = 4 * 256 + 2
- colormapmode = im.palette.mode
- colormap = im.getdata().getpalette()
- else:
- colormapsize = 0
-
- if "offset" in im.info:
- offset = (rowbytes * rows + 16 + 3 + colormapsize) // 4
- else:
- offset = 0
-
- fp.write(o16b(cols) + o16b(rows) + o16b(rowbytes) + o16b(flags))
- fp.write(o8(bpp))
- fp.write(o8(version))
- fp.write(o16b(offset))
- fp.write(o8(transparent_index))
- fp.write(o8(compression_type))
- fp.write(o16b(0)) # reserved by Palm
-
- # now write colormap if necessary
-
- if colormapsize > 0:
- fp.write(o16b(256))
- for i in range(256):
- fp.write(o8(i))
- if colormapmode == "RGB":
|
[-]
[+]
|
Deleted |
_service:tar_git:harbour-simplecrop-1.0+main.20210420100251.4.g6bfb428.tar.bz2/lib/arm64/PIL/PcdImagePlugin.py
^
|
@@ -1,64 +0,0 @@
-#
-# The Python Imaging Library.
-# $Id$
-#
-# PCD file handling
-#
-# History:
-# 96-05-10 fl Created
-# 96-05-27 fl Added draft mode (128x192, 256x384)
-#
-# Copyright (c) Secret Labs AB 1997.
-# Copyright (c) Fredrik Lundh 1996.
-#
-# See the README file for information on usage and redistribution.
-#
-
-
-from . import Image, ImageFile
-from ._binary import i8
-
-##
-# Image plugin for PhotoCD images. This plugin only reads the 768x512
-# image from the file; higher resolutions are encoded in a proprietary
-# encoding.
-
-
-class PcdImageFile(ImageFile.ImageFile):
-
- format = "PCD"
- format_description = "Kodak PhotoCD"
-
- def _open(self):
-
- # rough
- self.fp.seek(2048)
- s = self.fp.read(2048)
-
- if s[:4] != b"PCD_":
- raise SyntaxError("not a PCD file")
-
- orientation = i8(s[1538]) & 3
- self.tile_post_rotate = None
- if orientation == 1:
- self.tile_post_rotate = 90
- elif orientation == 3:
- self.tile_post_rotate = -90
-
- self.mode = "RGB"
- self._size = 768, 512 # FIXME: not correct for rotated images!
- self.tile = [("pcd", (0, 0) + self.size, 96 * 2048, None)]
-
- def load_end(self):
- if self.tile_post_rotate:
- # Handle rotated PCDs
- self.im = self.im.rotate(self.tile_post_rotate)
- self._size = self.im.size
-
-
-#
-# registry
-
-Image.register_open(PcdImageFile.format, PcdImageFile)
-
-Image.register_extension(PcdImageFile.format, ".pcd")
|
[-]
[+]
|
Deleted |
_service:tar_git:harbour-simplecrop-1.0+main.20210420100251.4.g6bfb428.tar.bz2/lib/arm64/PIL/PcfFontFile.py
^
|
@@ -1,244 +0,0 @@
-#
-# THIS IS WORK IN PROGRESS
-#
-# The Python Imaging Library
-# $Id$
-#
-# portable compiled font file parser
-#
-# history:
-# 1997-08-19 fl created
-# 2003-09-13 fl fixed loading of unicode fonts
-#
-# Copyright (c) 1997-2003 by Secret Labs AB.
-# Copyright (c) 1997-2003 by Fredrik Lundh.
-#
-# See the README file for information on usage and redistribution.
-#
-
-import io
-
-from . import FontFile, Image
-from ._binary import i8, i16be as b16, i16le as l16, i32be as b32, i32le as l32
-
-# --------------------------------------------------------------------
-# declarations
-
-PCF_MAGIC = 0x70636601 # "\x01fcp"
-
-PCF_PROPERTIES = 1 << 0
-PCF_ACCELERATORS = 1 << 1
-PCF_METRICS = 1 << 2
-PCF_BITMAPS = 1 << 3
-PCF_INK_METRICS = 1 << 4
-PCF_BDF_ENCODINGS = 1 << 5
-PCF_SWIDTHS = 1 << 6
-PCF_GLYPH_NAMES = 1 << 7
-PCF_BDF_ACCELERATORS = 1 << 8
-
-BYTES_PER_ROW = [
- lambda bits: ((bits + 7) >> 3),
- lambda bits: ((bits + 15) >> 3) & ~1,
- lambda bits: ((bits + 31) >> 3) & ~3,
- lambda bits: ((bits + 63) >> 3) & ~7,
-]
-
-
-def sz(s, o):
- return s[o : s.index(b"\0", o)]
-
-
-class PcfFontFile(FontFile.FontFile):
- """Font file plugin for the X11 PCF format."""
-
- name = "name"
-
- def __init__(self, fp, charset_encoding="iso8859-1"):
-
- self.charset_encoding = charset_encoding
-
- magic = l32(fp.read(4))
- if magic != PCF_MAGIC:
- raise SyntaxError("not a PCF file")
-
- super().__init__()
-
- count = l32(fp.read(4))
- self.toc = {}
- for i in range(count):
- type = l32(fp.read(4))
- self.toc[type] = l32(fp.read(4)), l32(fp.read(4)), l32(fp.read(4))
-
- self.fp = fp
-
- self.info = self._load_properties()
-
- metrics = self._load_metrics()
- bitmaps = self._load_bitmaps(metrics)
- encoding = self._load_encoding()
-
- #
- # create glyph structure
-
- for ch in range(256):
- ix = encoding[ch]
- if ix is not None:
- x, y, l, r, w, a, d, f = metrics[ix]
- glyph = (w, 0), (l, d - y, x + l, d), (0, 0, x, y), bitmaps[ix]
- self.glyph[ch] = glyph
-
- def _getformat(self, tag):
-
- format, size, offset = self.toc[tag]
-
- fp = self.fp
- fp.seek(offset)
-
- format = l32(fp.read(4))
-
- if format & 4:
- i16, i32 = b16, b32
- else:
- i16, i32 = l16, l32
-
- return fp, format, i16, i32
-
- def _load_properties(self):
-
- #
- # font properties
-
- properties = {}
-
- fp, format, i16, i32 = self._getformat(PCF_PROPERTIES)
-
- nprops = i32(fp.read(4))
-
- # read property description
- p = []
- for i in range(nprops):
- p.append((i32(fp.read(4)), i8(fp.read(1)), i32(fp.read(4))))
- if nprops & 3:
- fp.seek(4 - (nprops & 3), io.SEEK_CUR) # pad
-
- data = fp.read(i32(fp.read(4)))
-
- for k, s, v in p:
- k = sz(data, k)
- if s:
- v = sz(data, v)
- properties[k] = v
-
- return properties
-
- def _load_metrics(self):
-
- #
- # font metrics
-
- metrics = []
-
- fp, format, i16, i32 = self._getformat(PCF_METRICS)
-
- append = metrics.append
-
- if (format & 0xFF00) == 0x100:
-
- # "compressed" metrics
- for i in range(i16(fp.read(2))):
- left = i8(fp.read(1)) - 128
- right = i8(fp.read(1)) - 128
- width = i8(fp.read(1)) - 128
- ascent = i8(fp.read(1)) - 128
- descent = i8(fp.read(1)) - 128
- xsize = right - left
- ysize = ascent + descent
- append((xsize, ysize, left, right, width, ascent, descent, 0))
-
- else:
-
- # "jumbo" metrics
- for i in range(i32(fp.read(4))):
- left = i16(fp.read(2))
- right = i16(fp.read(2))
- width = i16(fp.read(2))
- ascent = i16(fp.read(2))
- descent = i16(fp.read(2))
- attributes = i16(fp.read(2))
- xsize = right - left
- ysize = ascent + descent
- append((xsize, ysize, left, right, width, ascent, descent, attributes))
-
- return metrics
-
- def _load_bitmaps(self, metrics):
-
- #
- # bitmap data
-
- bitmaps = []
-
- fp, format, i16, i32 = self._getformat(PCF_BITMAPS)
-
- nbitmaps = i32(fp.read(4))
-
- if nbitmaps != len(metrics):
- raise OSError("Wrong number of bitmaps")
-
- offsets = []
- for i in range(nbitmaps):
- offsets.append(i32(fp.read(4)))
-
- bitmapSizes = []
- for i in range(4):
- bitmapSizes.append(i32(fp.read(4)))
-
- # byteorder = format & 4 # non-zero => MSB
- bitorder = format & 8 # non-zero => MSB
- padindex = format & 3
-
|
[-]
[+]
|
Deleted |
_service:tar_git:harbour-simplecrop-1.0+main.20210420100251.4.g6bfb428.tar.bz2/lib/arm64/PIL/PcxImagePlugin.py
^
|
@@ -1,206 +0,0 @@
-#
-# The Python Imaging Library.
-# $Id$
-#
-# PCX file handling
-#
-# This format was originally used by ZSoft's popular PaintBrush
-# program for the IBM PC. It is also supported by many MS-DOS and
-# Windows applications, including the Windows PaintBrush program in
-# Windows 3.
-#
-# history:
-# 1995-09-01 fl Created
-# 1996-05-20 fl Fixed RGB support
-# 1997-01-03 fl Fixed 2-bit and 4-bit support
-# 1999-02-03 fl Fixed 8-bit support (broken in 1.0b1)
-# 1999-02-07 fl Added write support
-# 2002-06-09 fl Made 2-bit and 4-bit support a bit more robust
-# 2002-07-30 fl Seek from to current position, not beginning of file
-# 2003-06-03 fl Extract DPI settings (info["dpi"])
-#
-# Copyright (c) 1997-2003 by Secret Labs AB.
-# Copyright (c) 1995-2003 by Fredrik Lundh.
-#
-# See the README file for information on usage and redistribution.
-#
-
-import io
-import logging
-
-from . import Image, ImageFile, ImagePalette
-from ._binary import i8, i16le as i16, o8, o16le as o16
-
-logger = logging.getLogger(__name__)
-
-
-def _accept(prefix):
- return i8(prefix[0]) == 10 and i8(prefix[1]) in [0, 2, 3, 5]
-
-
-##
-# Image plugin for Paintbrush images.
-
-
-class PcxImageFile(ImageFile.ImageFile):
-
- format = "PCX"
- format_description = "Paintbrush"
-
- def _open(self):
-
- # header
- s = self.fp.read(128)
- if not _accept(s):
- raise SyntaxError("not a PCX file")
-
- # image
- bbox = i16(s, 4), i16(s, 6), i16(s, 8) + 1, i16(s, 10) + 1
- if bbox[2] <= bbox[0] or bbox[3] <= bbox[1]:
- raise SyntaxError("bad PCX image size")
- logger.debug("BBox: %s %s %s %s", *bbox)
-
- # format
- version = i8(s[1])
- bits = i8(s[3])
- planes = i8(s[65])
- stride = i16(s, 66)
- logger.debug(
- "PCX version %s, bits %s, planes %s, stride %s",
- version,
- bits,
- planes,
- stride,
- )
-
- self.info["dpi"] = i16(s, 12), i16(s, 14)
-
- if bits == 1 and planes == 1:
- mode = rawmode = "1"
-
- elif bits == 1 and planes in (2, 4):
- mode = "P"
- rawmode = "P;%dL" % planes
- self.palette = ImagePalette.raw("RGB", s[16:64])
-
- elif version == 5 and bits == 8 and planes == 1:
- mode = rawmode = "L"
- # FIXME: hey, this doesn't work with the incremental loader !!!
- self.fp.seek(-769, io.SEEK_END)
- s = self.fp.read(769)
- if len(s) == 769 and i8(s[0]) == 12:
- # check if the palette is linear greyscale
- for i in range(256):
- if s[i * 3 + 1 : i * 3 + 4] != o8(i) * 3:
- mode = rawmode = "P"
- break
- if mode == "P":
- self.palette = ImagePalette.raw("RGB", s[1:])
- self.fp.seek(128)
-
- elif version == 5 and bits == 8 and planes == 3:
- mode = "RGB"
- rawmode = "RGB;L"
-
- else:
- raise OSError("unknown PCX mode")
-
- self.mode = mode
- self._size = bbox[2] - bbox[0], bbox[3] - bbox[1]
-
- bbox = (0, 0) + self.size
- logger.debug("size: %sx%s", *self.size)
-
- self.tile = [("pcx", bbox, self.fp.tell(), (rawmode, planes * stride))]
-
-
-# --------------------------------------------------------------------
-# save PCX files
-
-
-SAVE = {
- # mode: (version, bits, planes, raw mode)
- "1": (2, 1, 1, "1"),
- "L": (5, 8, 1, "L"),
- "P": (5, 8, 1, "P"),
- "RGB": (5, 8, 3, "RGB;L"),
-}
-
-
-def _save(im, fp, filename):
-
- try:
- version, bits, planes, rawmode = SAVE[im.mode]
- except KeyError as e:
- raise ValueError("Cannot save %s images as PCX" % im.mode) from e
-
- # bytes per plane
- stride = (im.size[0] * bits + 7) // 8
- # stride should be even
- stride += stride % 2
- # Stride needs to be kept in sync with the PcxEncode.c version.
- # Ideally it should be passed in in the state, but the bytes value
- # gets overwritten.
-
- logger.debug(
- "PcxImagePlugin._save: xwidth: %d, bits: %d, stride: %d",
- im.size[0],
- bits,
- stride,
- )
-
- # under windows, we could determine the current screen size with
- # "Image.core.display_mode()[1]", but I think that's overkill...
-
- screen = im.size
-
- dpi = 100, 100
-
- # PCX header
- fp.write(
- o8(10)
- + o8(version)
- + o8(1)
- + o8(bits)
- + o16(0)
- + o16(0)
- + o16(im.size[0] - 1)
- + o16(im.size[1] - 1)
- + o16(dpi[0])
- + o16(dpi[1])
- + b"\0" * 24
- + b"\xFF" * 24
- + b"\0"
- + o8(planes)
- + o16(stride)
- + o16(1)
- + o16(screen[0])
- + o16(screen[1])
- + b"\0" * 54
- )
-
- assert fp.tell() == 128
-
- ImageFile._save(im, fp, [("pcx", (0, 0) + im.size, 0, (rawmode, bits * planes))])
-
- if im.mode == "P":
- # colour palette
- fp.write(o8(12))
- fp.write(im.im.getpalette("RGB", "RGB")) # 768 bytes
- elif im.mode == "L":
- # greyscale palette
- fp.write(o8(12))
- for i in range(256):
- fp.write(o8(i) * 3)
-
-
-# --------------------------------------------------------------------
-# registry
-
|
[-]
[+]
|
Deleted |
_service:tar_git:harbour-simplecrop-1.0+main.20210420100251.4.g6bfb428.tar.bz2/lib/arm64/PIL/PdfImagePlugin.py
^
|
@@ -1,243 +0,0 @@
-#
-# The Python Imaging Library.
-# $Id$
-#
-# PDF (Acrobat) file handling
-#
-# History:
-# 1996-07-16 fl Created
-# 1997-01-18 fl Fixed header
-# 2004-02-21 fl Fixes for 1/L/CMYK images, etc.
-# 2004-02-24 fl Fixes for 1 and P images.
-#
-# Copyright (c) 1997-2004 by Secret Labs AB. All rights reserved.
-# Copyright (c) 1996-1997 by Fredrik Lundh.
-#
-# See the README file for information on usage and redistribution.
-#
-
-##
-# Image plugin for PDF images (output only).
-##
-
-import io
-import os
-import time
-
-from . import Image, ImageFile, ImageSequence, PdfParser, __version__
-
-#
-# --------------------------------------------------------------------
-
-# object ids:
-# 1. catalogue
-# 2. pages
-# 3. image
-# 4. page
-# 5. page contents
-
-
-def _save_all(im, fp, filename):
- _save(im, fp, filename, save_all=True)
-
-
-##
-# (Internal) Image save plugin for the PDF format.
-
-
-def _save(im, fp, filename, save_all=False):
- is_appending = im.encoderinfo.get("append", False)
- if is_appending:
- existing_pdf = PdfParser.PdfParser(f=fp, filename=filename, mode="r+b")
- else:
- existing_pdf = PdfParser.PdfParser(f=fp, filename=filename, mode="w+b")
-
- resolution = im.encoderinfo.get("resolution", 72.0)
-
- info = {
- "title": None
- if is_appending
- else os.path.splitext(os.path.basename(filename))[0],
- "author": None,
- "subject": None,
- "keywords": None,
- "creator": None,
- "producer": None,
- "creationDate": None if is_appending else time.gmtime(),
- "modDate": None if is_appending else time.gmtime(),
- }
- for k, default in info.items():
- v = im.encoderinfo.get(k) if k in im.encoderinfo else default
- if v:
- existing_pdf.info[k[0].upper() + k[1:]] = v
-
- #
- # make sure image data is available
- im.load()
-
- existing_pdf.start_writing()
- existing_pdf.write_header()
- existing_pdf.write_comment("created by Pillow {} PDF driver".format(__version__))
-
- #
- # pages
- ims = [im]
- if save_all:
- append_images = im.encoderinfo.get("append_images", [])
- for append_im in append_images:
- append_im.encoderinfo = im.encoderinfo.copy()
- ims.append(append_im)
- numberOfPages = 0
- image_refs = []
- page_refs = []
- contents_refs = []
- for im in ims:
- im_numberOfPages = 1
- if save_all:
- try:
- im_numberOfPages = im.n_frames
- except AttributeError:
- # Image format does not have n_frames.
- # It is a single frame image
- pass
- numberOfPages += im_numberOfPages
- for i in range(im_numberOfPages):
- image_refs.append(existing_pdf.next_object_id(0))
- page_refs.append(existing_pdf.next_object_id(0))
- contents_refs.append(existing_pdf.next_object_id(0))
- existing_pdf.pages.append(page_refs[-1])
-
- #
- # catalog and list of pages
- existing_pdf.write_catalog()
-
- pageNumber = 0
- for imSequence in ims:
- im_pages = ImageSequence.Iterator(imSequence) if save_all else [imSequence]
- for im in im_pages:
- # FIXME: Should replace ASCIIHexDecode with RunLengthDecode
- # (packbits) or LZWDecode (tiff/lzw compression). Note that
- # PDF 1.2 also supports Flatedecode (zip compression).
-
- bits = 8
- params = None
-
- if im.mode == "1":
- filter = "ASCIIHexDecode"
- colorspace = PdfParser.PdfName("DeviceGray")
- procset = "ImageB" # grayscale
- bits = 1
- elif im.mode == "L":
- filter = "DCTDecode"
- # params = "<< /Predictor 15 /Columns %d >>" % (width-2)
- colorspace = PdfParser.PdfName("DeviceGray")
- procset = "ImageB" # grayscale
- elif im.mode == "P":
- filter = "ASCIIHexDecode"
- palette = im.im.getpalette("RGB")
- colorspace = [
- PdfParser.PdfName("Indexed"),
- PdfParser.PdfName("DeviceRGB"),
- 255,
- PdfParser.PdfBinary(palette),
- ]
- procset = "ImageI" # indexed color
- elif im.mode == "RGB":
- filter = "DCTDecode"
- colorspace = PdfParser.PdfName("DeviceRGB")
- procset = "ImageC" # color images
- elif im.mode == "CMYK":
- filter = "DCTDecode"
- colorspace = PdfParser.PdfName("DeviceCMYK")
- procset = "ImageC" # color images
- else:
- raise ValueError("cannot save mode %s" % im.mode)
-
- #
- # image
-
- op = io.BytesIO()
-
- if filter == "ASCIIHexDecode":
- if bits == 1:
- # FIXME: the hex encoder doesn't support packed 1-bit
- # images; do things the hard way...
- data = im.tobytes("raw", "1")
- im = Image.new("L", im.size)
- im.putdata(data)
- ImageFile._save(im, op, [("hex", (0, 0) + im.size, 0, im.mode)])
- elif filter == "DCTDecode":
- Image.SAVE["JPEG"](im, op, filename)
- elif filter == "FlateDecode":
- ImageFile._save(im, op, [("zip", (0, 0) + im.size, 0, im.mode)])
- elif filter == "RunLengthDecode":
- ImageFile._save(im, op, [("packbits", (0, 0) + im.size, 0, im.mode)])
- else:
- raise ValueError("unsupported PDF filter (%s)" % filter)
-
- #
- # Get image characteristics
-
- width, height = im.size
-
- existing_pdf.write_obj(
- image_refs[pageNumber],
- stream=op.getvalue(),
- Type=PdfParser.PdfName("XObject"),
- Subtype=PdfParser.PdfName("Image"),
- Width=width, # * 72.0 / resolution,
- Height=height, # * 72.0 / resolution,
- Filter=PdfParser.PdfName(filter),
- BitsPerComponent=bits,
- DecodeParams=params,
- ColorSpace=colorspace,
- )
-
- #
- # page
-
- existing_pdf.write_page(
|
[-]
[+]
|
Deleted |
_service:tar_git:harbour-simplecrop-1.0+main.20210420100251.4.g6bfb428.tar.bz2/lib/arm64/PIL/PdfParser.py
^
|
@@ -1,995 +0,0 @@
-import calendar
-import codecs
-import collections
-import mmap
-import os
-import re
-import time
-import zlib
-
-
-# see 7.9.2.2 Text String Type on page 86 and D.3 PDFDocEncoding Character Set
-# on page 656
-def encode_text(s):
- return codecs.BOM_UTF16_BE + s.encode("utf_16_be")
-
-
-PDFDocEncoding = {
- 0x16: "\u0017",
- 0x18: "\u02D8",
- 0x19: "\u02C7",
- 0x1A: "\u02C6",
- 0x1B: "\u02D9",
- 0x1C: "\u02DD",
- 0x1D: "\u02DB",
- 0x1E: "\u02DA",
- 0x1F: "\u02DC",
- 0x80: "\u2022",
- 0x81: "\u2020",
- 0x82: "\u2021",
- 0x83: "\u2026",
- 0x84: "\u2014",
- 0x85: "\u2013",
- 0x86: "\u0192",
- 0x87: "\u2044",
- 0x88: "\u2039",
- 0x89: "\u203A",
- 0x8A: "\u2212",
- 0x8B: "\u2030",
- 0x8C: "\u201E",
- 0x8D: "\u201C",
- 0x8E: "\u201D",
- 0x8F: "\u2018",
- 0x90: "\u2019",
- 0x91: "\u201A",
- 0x92: "\u2122",
- 0x93: "\uFB01",
- 0x94: "\uFB02",
- 0x95: "\u0141",
- 0x96: "\u0152",
- 0x97: "\u0160",
- 0x98: "\u0178",
- 0x99: "\u017D",
- 0x9A: "\u0131",
- 0x9B: "\u0142",
- 0x9C: "\u0153",
- 0x9D: "\u0161",
- 0x9E: "\u017E",
- 0xA0: "\u20AC",
-}
-
-
-def decode_text(b):
- if b[: len(codecs.BOM_UTF16_BE)] == codecs.BOM_UTF16_BE:
- return b[len(codecs.BOM_UTF16_BE) :].decode("utf_16_be")
- else:
- return "".join(PDFDocEncoding.get(byte, chr(byte)) for byte in b)
-
-
-class PdfFormatError(RuntimeError):
- """An error that probably indicates a syntactic or semantic error in the
- PDF file structure"""
-
- pass
-
-
-def check_format_condition(condition, error_message):
- if not condition:
- raise PdfFormatError(error_message)
-
-
-class IndirectReference(
- collections.namedtuple("IndirectReferenceTuple", ["object_id", "generation"])
-):
- def __str__(self):
- return "%s %s R" % self
-
- def __bytes__(self):
- return self.__str__().encode("us-ascii")
-
- def __eq__(self, other):
- return (
- other.__class__ is self.__class__
- and other.object_id == self.object_id
- and other.generation == self.generation
- )
-
- def __ne__(self, other):
- return not (self == other)
-
- def __hash__(self):
- return hash((self.object_id, self.generation))
-
-
-class IndirectObjectDef(IndirectReference):
- def __str__(self):
- return "%s %s obj" % self
-
-
-class XrefTable:
- def __init__(self):
- self.existing_entries = {} # object ID => (offset, generation)
- self.new_entries = {} # object ID => (offset, generation)
- self.deleted_entries = {0: 65536} # object ID => generation
- self.reading_finished = False
-
- def __setitem__(self, key, value):
- if self.reading_finished:
- self.new_entries[key] = value
- else:
- self.existing_entries[key] = value
- if key in self.deleted_entries:
- del self.deleted_entries[key]
-
- def __getitem__(self, key):
- try:
- return self.new_entries[key]
- except KeyError:
- return self.existing_entries[key]
-
- def __delitem__(self, key):
- if key in self.new_entries:
- generation = self.new_entries[key][1] + 1
- del self.new_entries[key]
- self.deleted_entries[key] = generation
- elif key in self.existing_entries:
- generation = self.existing_entries[key][1] + 1
- self.deleted_entries[key] = generation
- elif key in self.deleted_entries:
- generation = self.deleted_entries[key]
- else:
- raise IndexError(
- "object ID " + str(key) + " cannot be deleted because it doesn't exist"
- )
-
- def __contains__(self, key):
- return key in self.existing_entries or key in self.new_entries
-
- def __len__(self):
- return len(
- set(self.existing_entries.keys())
- | set(self.new_entries.keys())
- | set(self.deleted_entries.keys())
- )
-
- def keys(self):
- return (
- set(self.existing_entries.keys()) - set(self.deleted_entries.keys())
- ) | set(self.new_entries.keys())
-
- def write(self, f):
- keys = sorted(set(self.new_entries.keys()) | set(self.deleted_entries.keys()))
- deleted_keys = sorted(set(self.deleted_entries.keys()))
- startxref = f.tell()
- f.write(b"xref\n")
- while keys:
- # find a contiguous sequence of object IDs
- prev = None
- for index, key in enumerate(keys):
- if prev is None or prev + 1 == key:
- prev = key
- else:
- contiguous_keys = keys[:index]
- keys = keys[index:]
- break
- else:
- contiguous_keys = keys
- keys = None
- f.write(b"%d %d\n" % (contiguous_keys[0], len(contiguous_keys)))
- for object_id in contiguous_keys:
- if object_id in self.new_entries:
- f.write(b"%010d %05d n \n" % self.new_entries[object_id])
- else:
- this_deleted_object_id = deleted_keys.pop(0)
- check_format_condition(
- object_id == this_deleted_object_id,
- "expected the next deleted object ID to be %s, instead found %s"
- % (object_id, this_deleted_object_id),
- )
- try:
- next_in_linked_list = deleted_keys[0]
- except IndexError:
- next_in_linked_list = 0
- f.write(
- b"%010d %05d f \n"
- % (next_in_linked_list, self.deleted_entries[object_id])
- )
- return startxref
-
-
|
[-]
[+]
|
Deleted |
_service:tar_git:harbour-simplecrop-1.0+main.20210420100251.4.g6bfb428.tar.bz2/lib/arm64/PIL/PixarImagePlugin.py
^
|
@@ -1,70 +0,0 @@
-#
-# The Python Imaging Library.
-# $Id$
-#
-# PIXAR raster support for PIL
-#
-# history:
-# 97-01-29 fl Created
-#
-# notes:
-# This is incomplete; it is based on a few samples created with
-# Photoshop 2.5 and 3.0, and a summary description provided by
-# Greg Coats <gcoats@labiris.er.usgs.gov>. Hopefully, "L" and
-# "RGBA" support will be added in future versions.
-#
-# Copyright (c) Secret Labs AB 1997.
-# Copyright (c) Fredrik Lundh 1997.
-#
-# See the README file for information on usage and redistribution.
-#
-
-from . import Image, ImageFile
-from ._binary import i16le as i16
-
-#
-# helpers
-
-
-def _accept(prefix):
- return prefix[:4] == b"\200\350\000\000"
-
-
-##
-# Image plugin for PIXAR raster images.
-
-
-class PixarImageFile(ImageFile.ImageFile):
-
- format = "PIXAR"
- format_description = "PIXAR raster image"
-
- def _open(self):
-
- # assuming a 4-byte magic label
- s = self.fp.read(4)
- if not _accept(s):
- raise SyntaxError("not a PIXAR file")
-
- # read rest of header
- s = s + self.fp.read(508)
-
- self._size = i16(s[418:420]), i16(s[416:418])
-
- # get channel/depth descriptions
- mode = i16(s[424:426]), i16(s[426:428])
-
- if mode == (14, 2):
- self.mode = "RGB"
- # FIXME: to be continued...
-
- # create tile descriptor (assuming "dumped")
- self.tile = [("raw", (0, 0) + self.size, 1024, (self.mode, 0, 1))]
-
-
-#
-# --------------------------------------------------------------------
-
-Image.register_open(PixarImageFile.format, PixarImageFile, _accept)
-
-Image.register_extension(PixarImageFile.format, ".pxr")
|
[-]
[+]
|
Deleted |
_service:tar_git:harbour-simplecrop-1.0+main.20210420100251.4.g6bfb428.tar.bz2/lib/arm64/PIL/PngImagePlugin.py
^
|
@@ -1,1333 +0,0 @@
-#
-# The Python Imaging Library.
-# $Id$
-#
-# PNG support code
-#
-# See "PNG (Portable Network Graphics) Specification, version 1.0;
-# W3C Recommendation", 1996-10-01, Thomas Boutell (ed.).
-#
-# history:
-# 1996-05-06 fl Created (couldn't resist it)
-# 1996-12-14 fl Upgraded, added read and verify support (0.2)
-# 1996-12-15 fl Separate PNG stream parser
-# 1996-12-29 fl Added write support, added getchunks
-# 1996-12-30 fl Eliminated circular references in decoder (0.3)
-# 1998-07-12 fl Read/write 16-bit images as mode I (0.4)
-# 2001-02-08 fl Added transparency support (from Zircon) (0.5)
-# 2001-04-16 fl Don't close data source in "open" method (0.6)
-# 2004-02-24 fl Don't even pretend to support interlaced files (0.7)
-# 2004-08-31 fl Do basic sanity check on chunk identifiers (0.8)
-# 2004-09-20 fl Added PngInfo chunk container
-# 2004-12-18 fl Added DPI read support (based on code by Niki Spahiev)
-# 2008-08-13 fl Added tRNS support for RGB images
-# 2009-03-06 fl Support for preserving ICC profiles (by Florian Hoech)
-# 2009-03-08 fl Added zTXT support (from Lowell Alleman)
-# 2009-03-29 fl Read interlaced PNG files (from Conrado Porto Lopes Gouvua)
-#
-# Copyright (c) 1997-2009 by Secret Labs AB
-# Copyright (c) 1996 by Fredrik Lundh
-#
-# See the README file for information on usage and redistribution.
-#
-
-import itertools
-import logging
-import re
-import struct
-import warnings
-import zlib
-
-from . import Image, ImageChops, ImageFile, ImagePalette, ImageSequence
-from ._binary import i8, i16be as i16, i32be as i32, o8, o16be as o16, o32be as o32
-
-logger = logging.getLogger(__name__)
-
-is_cid = re.compile(br"\w\w\w\w").match
-
-
-_MAGIC = b"\211PNG\r\n\032\n"
-
-
-_MODES = {
- # supported bits/color combinations, and corresponding modes/rawmodes
- # Greyscale
- (1, 0): ("1", "1"),
- (2, 0): ("L", "L;2"),
- (4, 0): ("L", "L;4"),
- (8, 0): ("L", "L"),
- (16, 0): ("I", "I;16B"),
- # Truecolour
- (8, 2): ("RGB", "RGB"),
- (16, 2): ("RGB", "RGB;16B"),
- # Indexed-colour
- (1, 3): ("P", "P;1"),
- (2, 3): ("P", "P;2"),
- (4, 3): ("P", "P;4"),
- (8, 3): ("P", "P"),
- # Greyscale with alpha
- (8, 4): ("LA", "LA"),
- (16, 4): ("RGBA", "LA;16B"), # LA;16B->LA not yet available
- # Truecolour with alpha
- (8, 6): ("RGBA", "RGBA"),
- (16, 6): ("RGBA", "RGBA;16B"),
-}
-
-
-_simple_palette = re.compile(b"^\xff*\x00\xff*$")
-
-# Maximum decompressed size for a iTXt or zTXt chunk.
-# Eliminates decompression bombs where compressed chunks can expand 1000x
-MAX_TEXT_CHUNK = ImageFile.SAFEBLOCK
-# Set the maximum total text chunk size.
-MAX_TEXT_MEMORY = 64 * MAX_TEXT_CHUNK
-
-
-# APNG frame disposal modes
-APNG_DISPOSE_OP_NONE = 0
-APNG_DISPOSE_OP_BACKGROUND = 1
-APNG_DISPOSE_OP_PREVIOUS = 2
-
-# APNG frame blend modes
-APNG_BLEND_OP_SOURCE = 0
-APNG_BLEND_OP_OVER = 1
-
-
-def _safe_zlib_decompress(s):
- dobj = zlib.decompressobj()
- plaintext = dobj.decompress(s, MAX_TEXT_CHUNK)
- if dobj.unconsumed_tail:
- raise ValueError("Decompressed Data Too Large")
- return plaintext
-
-
-def _crc32(data, seed=0):
- return zlib.crc32(data, seed) & 0xFFFFFFFF
-
-
-# --------------------------------------------------------------------
-# Support classes. Suitable for PNG and related formats like MNG etc.
-
-
-class ChunkStream:
- def __init__(self, fp):
-
- self.fp = fp
- self.queue = []
-
- def read(self):
- """Fetch a new chunk. Returns header information."""
- cid = None
-
- if self.queue:
- cid, pos, length = self.queue.pop()
- self.fp.seek(pos)
- else:
- s = self.fp.read(8)
- cid = s[4:]
- pos = self.fp.tell()
- length = i32(s)
-
- if not is_cid(cid):
- if not ImageFile.LOAD_TRUNCATED_IMAGES:
- raise SyntaxError("broken PNG file (chunk %s)" % repr(cid))
-
- return cid, pos, length
-
- def __enter__(self):
- return self
-
- def __exit__(self, *args):
- self.close()
-
- def close(self):
- self.queue = self.crc = self.fp = None
-
- def push(self, cid, pos, length):
-
- self.queue.append((cid, pos, length))
-
- def call(self, cid, pos, length):
- """Call the appropriate chunk handler"""
-
- logger.debug("STREAM %r %s %s", cid, pos, length)
- return getattr(self, "chunk_" + cid.decode("ascii"))(pos, length)
-
- def crc(self, cid, data):
- """Read and verify checksum"""
-
- # Skip CRC checks for ancillary chunks if allowed to load truncated
- # images
- # 5th byte of first char is 1 [specs, section 5.4]
- if ImageFile.LOAD_TRUNCATED_IMAGES and (i8(cid[0]) >> 5 & 1):
- self.crc_skip(cid, data)
- return
-
- try:
- crc1 = _crc32(data, _crc32(cid))
- crc2 = i32(self.fp.read(4))
- if crc1 != crc2:
- raise SyntaxError("broken PNG file (bad header checksum in %r)" % cid)
- except struct.error as e:
- raise SyntaxError(
- "broken PNG file (incomplete checksum in %r)" % cid
- ) from e
-
- def crc_skip(self, cid, data):
- """Read checksum. Used if the C module is not present"""
-
- self.fp.read(4)
-
- def verify(self, endchunk=b"IEND"):
-
- # Simple approach; just calculate checksum for all remaining
- # blocks. Must be called directly after open.
-
- cids = []
-
- while True:
- try:
- cid, pos, length = self.read()
- except struct.error as e:
- raise OSError("truncated PNG file") from e
-
- if cid == endchunk:
- break
- self.crc(cid, ImageFile._safe_read(self.fp, length))
- cids.append(cid)
-
- return cids
|
[-]
[+]
|
Deleted |
_service:tar_git:harbour-simplecrop-1.0+main.20210420100251.4.g6bfb428.tar.bz2/lib/arm64/PIL/PpmImagePlugin.py
^
|
@@ -1,164 +0,0 @@
-#
-# The Python Imaging Library.
-# $Id$
-#
-# PPM support for PIL
-#
-# History:
-# 96-03-24 fl Created
-# 98-03-06 fl Write RGBA images (as RGB, that is)
-#
-# Copyright (c) Secret Labs AB 1997-98.
-# Copyright (c) Fredrik Lundh 1996.
-#
-# See the README file for information on usage and redistribution.
-#
-
-
-from . import Image, ImageFile
-
-#
-# --------------------------------------------------------------------
-
-b_whitespace = b"\x20\x09\x0a\x0b\x0c\x0d"
-
-MODES = {
- # standard
- b"P4": "1",
- b"P5": "L",
- b"P6": "RGB",
- # extensions
- b"P0CMYK": "CMYK",
- # PIL extensions (for test purposes only)
- b"PyP": "P",
- b"PyRGBA": "RGBA",
- b"PyCMYK": "CMYK",
-}
-
-
-def _accept(prefix):
- return prefix[0:1] == b"P" and prefix[1] in b"0456y"
-
-
-##
-# Image plugin for PBM, PGM, and PPM images.
-
-
-class PpmImageFile(ImageFile.ImageFile):
-
- format = "PPM"
- format_description = "Pbmplus image"
-
- def _token(self, s=b""):
- while True: # read until next whitespace
- c = self.fp.read(1)
- if not c or c in b_whitespace:
- break
- if c > b"\x79":
- raise ValueError("Expected ASCII value, found binary")
- s = s + c
- if len(s) > 9:
- raise ValueError("Expected int, got > 9 digits")
- return s
-
- def _open(self):
-
- # check magic
- s = self.fp.read(1)
- if s != b"P":
- raise SyntaxError("not a PPM file")
- magic_number = self._token(s)
- mode = MODES[magic_number]
-
- self.custom_mimetype = {
- b"P4": "image/x-portable-bitmap",
- b"P5": "image/x-portable-graymap",
- b"P6": "image/x-portable-pixmap",
- }.get(magic_number)
-
- if mode == "1":
- self.mode = "1"
- rawmode = "1;I"
- else:
- self.mode = rawmode = mode
-
- for ix in range(3):
- while True:
- while True:
- s = self.fp.read(1)
- if s not in b_whitespace:
- break
- if s == b"":
- raise ValueError("File does not extend beyond magic number")
- if s != b"#":
- break
- s = self.fp.readline()
- s = int(self._token(s))
- if ix == 0:
- xsize = s
- elif ix == 1:
- ysize = s
- if mode == "1":
- break
- elif ix == 2:
- # maxgrey
- if s > 255:
- if not mode == "L":
- raise ValueError("Too many colors for band: %s" % s)
- if s < 2 ** 16:
- self.mode = "I"
- rawmode = "I;16B"
- else:
- self.mode = "I"
- rawmode = "I;32B"
-
- self._size = xsize, ysize
- self.tile = [("raw", (0, 0, xsize, ysize), self.fp.tell(), (rawmode, 0, 1))]
-
-
-#
-# --------------------------------------------------------------------
-
-
-def _save(im, fp, filename):
- if im.mode == "1":
- rawmode, head = "1;I", b"P4"
- elif im.mode == "L":
- rawmode, head = "L", b"P5"
- elif im.mode == "I":
- if im.getextrema()[1] < 2 ** 16:
- rawmode, head = "I;16B", b"P5"
- else:
- rawmode, head = "I;32B", b"P5"
- elif im.mode == "RGB":
- rawmode, head = "RGB", b"P6"
- elif im.mode == "RGBA":
- rawmode, head = "RGB", b"P6"
- else:
- raise OSError("cannot write mode %s as PPM" % im.mode)
- fp.write(head + ("\n%d %d\n" % im.size).encode("ascii"))
- if head == b"P6":
- fp.write(b"255\n")
- if head == b"P5":
- if rawmode == "L":
- fp.write(b"255\n")
- elif rawmode == "I;16B":
- fp.write(b"65535\n")
- elif rawmode == "I;32B":
- fp.write(b"2147483648\n")
- ImageFile._save(im, fp, [("raw", (0, 0) + im.size, 0, (rawmode, 0, 1))])
-
- # ALTERNATIVE: save via builtin debug function
- # im._dump(filename)
-
-
-#
-# --------------------------------------------------------------------
-
-
-Image.register_open(PpmImageFile.format, PpmImageFile, _accept)
-Image.register_save(PpmImageFile.format, _save)
-
-Image.register_extensions(PpmImageFile.format, [".pbm", ".pgm", ".ppm", ".pnm"])
-
-Image.register_mime(PpmImageFile.format, "image/x-portable-anymap")
|
[-]
[+]
|
Deleted |
_service:tar_git:harbour-simplecrop-1.0+main.20210420100251.4.g6bfb428.tar.bz2/lib/arm64/PIL/PsdImagePlugin.py
^
|
@@ -1,309 +0,0 @@
-#
-# The Python Imaging Library
-# $Id$
-#
-# Adobe PSD 2.5/3.0 file handling
-#
-# History:
-# 1995-09-01 fl Created
-# 1997-01-03 fl Read most PSD images
-# 1997-01-18 fl Fixed P and CMYK support
-# 2001-10-21 fl Added seek/tell support (for layers)
-#
-# Copyright (c) 1997-2001 by Secret Labs AB.
-# Copyright (c) 1995-2001 by Fredrik Lundh
-#
-# See the README file for information on usage and redistribution.
-#
-
-import io
-
-from . import Image, ImageFile, ImagePalette
-from ._binary import i8, i16be as i16, i32be as i32
-
-MODES = {
- # (photoshop mode, bits) -> (pil mode, required channels)
- (0, 1): ("1", 1),
- (0, 8): ("L", 1),
- (1, 8): ("L", 1),
- (2, 8): ("P", 1),
- (3, 8): ("RGB", 3),
- (4, 8): ("CMYK", 4),
- (7, 8): ("L", 1), # FIXME: multilayer
- (8, 8): ("L", 1), # duotone
- (9, 8): ("LAB", 3),
-}
-
-
-# --------------------------------------------------------------------.
-# read PSD images
-
-
-def _accept(prefix):
- return prefix[:4] == b"8BPS"
-
-
-##
-# Image plugin for Photoshop images.
-
-
-class PsdImageFile(ImageFile.ImageFile):
-
- format = "PSD"
- format_description = "Adobe Photoshop"
- _close_exclusive_fp_after_loading = False
-
- def _open(self):
-
- read = self.fp.read
-
- #
- # header
-
- s = read(26)
- if not _accept(s) or i16(s[4:]) != 1:
- raise SyntaxError("not a PSD file")
-
- psd_bits = i16(s[22:])
- psd_channels = i16(s[12:])
- psd_mode = i16(s[24:])
-
- mode, channels = MODES[(psd_mode, psd_bits)]
-
- if channels > psd_channels:
- raise OSError("not enough channels")
-
- self.mode = mode
- self._size = i32(s[18:]), i32(s[14:])
-
- #
- # color mode data
-
- size = i32(read(4))
- if size:
- data = read(size)
- if mode == "P" and size == 768:
- self.palette = ImagePalette.raw("RGB;L", data)
-
- #
- # image resources
-
- self.resources = []
-
- size = i32(read(4))
- if size:
- # load resources
- end = self.fp.tell() + size
- while self.fp.tell() < end:
- read(4) # signature
- id = i16(read(2))
- name = read(i8(read(1)))
- if not (len(name) & 1):
- read(1) # padding
- data = read(i32(read(4)))
- if len(data) & 1:
- read(1) # padding
- self.resources.append((id, name, data))
- if id == 1039: # ICC profile
- self.info["icc_profile"] = data
-
- #
- # layer and mask information
-
- self.layers = []
-
- size = i32(read(4))
- if size:
- end = self.fp.tell() + size
- size = i32(read(4))
- if size:
- self.layers = _layerinfo(self.fp)
- self.fp.seek(end)
- self.n_frames = len(self.layers)
- self.is_animated = self.n_frames > 1
-
- #
- # image descriptor
-
- self.tile = _maketile(self.fp, mode, (0, 0) + self.size, channels)
-
- # keep the file open
- self.__fp = self.fp
- self.frame = 1
- self._min_frame = 1
-
- def seek(self, layer):
- if not self._seek_check(layer):
- return
-
- # seek to given layer (1..max)
- try:
- name, mode, bbox, tile = self.layers[layer - 1]
- self.mode = mode
- self.tile = tile
- self.frame = layer
- self.fp = self.__fp
- return name, bbox
- except IndexError as e:
- raise EOFError("no such layer") from e
-
- def tell(self):
- # return layer number (0=image, 1..max=layers)
- return self.frame
-
- def load_prepare(self):
- # create image memory if necessary
- if not self.im or self.im.mode != self.mode or self.im.size != self.size:
- self.im = Image.core.fill(self.mode, self.size, 0)
- # create palette (optional)
- if self.mode == "P":
- Image.Image.load(self)
-
- def _close__fp(self):
- try:
- if self.__fp != self.fp:
- self.__fp.close()
- except AttributeError:
- pass
- finally:
- self.__fp = None
-
-
-def _layerinfo(file):
- # read layerinfo block
- layers = []
- read = file.read
- for i in range(abs(i16(read(2)))):
-
- # bounding box
- y0 = i32(read(4))
- x0 = i32(read(4))
- y1 = i32(read(4))
- x1 = i32(read(4))
-
- # image info
- info = []
- mode = []
- types = list(range(i16(read(2))))
- if len(types) > 4:
- continue
-
- for i in types:
- type = i16(read(2))
-
- if type == 65535:
- m = "A"
- else:
- m = "RGBA"[type]
-
- mode.append(m)
|
[-]
[+]
|
Deleted |
_service:tar_git:harbour-simplecrop-1.0+main.20210420100251.4.g6bfb428.tar.bz2/lib/arm64/PIL/PyAccess.py
^
|
@@ -1,352 +0,0 @@
-#
-# The Python Imaging Library
-# Pillow fork
-#
-# Python implementation of the PixelAccess Object
-#
-# Copyright (c) 1997-2009 by Secret Labs AB. All rights reserved.
-# Copyright (c) 1995-2009 by Fredrik Lundh.
-# Copyright (c) 2013 Eric Soroos
-#
-# See the README file for information on usage and redistribution
-#
-
-# Notes:
-#
-# * Implements the pixel access object following Access.
-# * Does not implement the line functions, as they don't appear to be used
-# * Taking only the tuple form, which is used from python.
-# * Fill.c uses the integer form, but it's still going to use the old
-# Access.c implementation.
-#
-
-import logging
-import sys
-
-try:
- from cffi import FFI
-
- defs = """
- struct Pixel_RGBA {
- unsigned char r,g,b,a;
- };
- struct Pixel_I16 {
- unsigned char l,r;
- };
- """
- ffi = FFI()
- ffi.cdef(defs)
-except ImportError as ex:
- # Allow error import for doc purposes, but error out when accessing
- # anything in core.
- from ._util import deferred_error
-
- FFI = ffi = deferred_error(ex)
-
-logger = logging.getLogger(__name__)
-
-
-class PyAccess:
- def __init__(self, img, readonly=False):
- vals = dict(img.im.unsafe_ptrs)
- self.readonly = readonly
- self.image8 = ffi.cast("unsigned char **", vals["image8"])
- self.image32 = ffi.cast("int **", vals["image32"])
- self.image = ffi.cast("unsigned char **", vals["image"])
- self.xsize, self.ysize = img.im.size
-
- # Keep pointer to im object to prevent dereferencing.
- self._im = img.im
- if self._im.mode == "P":
- self._palette = img.palette
-
- # Debugging is polluting test traces, only useful here
- # when hacking on PyAccess
- # logger.debug("%s", vals)
- self._post_init()
-
- def _post_init(self):
- pass
-
- def __setitem__(self, xy, color):
- """
- Modifies the pixel at x,y. The color is given as a single
- numerical value for single band images, and a tuple for
- multi-band images
-
- :param xy: The pixel coordinate, given as (x, y). See
- :ref:`coordinate-system`.
- :param color: The pixel value.
- """
- if self.readonly:
- raise ValueError("Attempt to putpixel a read only image")
- (x, y) = xy
- if x < 0:
- x = self.xsize + x
- if y < 0:
- y = self.ysize + y
- (x, y) = self.check_xy((x, y))
-
- if (
- self._im.mode == "P"
- and isinstance(color, (list, tuple))
- and len(color) in [3, 4]
- ):
- # RGB or RGBA value for a P image
- color = self._palette.getcolor(color)
-
- return self.set_pixel(x, y, color)
-
- def __getitem__(self, xy):
- """
- Returns the pixel at x,y. The pixel is returned as a single
- value for single band images or a tuple for multiple band
- images
-
- :param xy: The pixel coordinate, given as (x, y). See
- :ref:`coordinate-system`.
- :returns: a pixel value for single band images, a tuple of
- pixel values for multiband images.
- """
- (x, y) = xy
- if x < 0:
- x = self.xsize + x
- if y < 0:
- y = self.ysize + y
- (x, y) = self.check_xy((x, y))
- return self.get_pixel(x, y)
-
- putpixel = __setitem__
- getpixel = __getitem__
-
- def check_xy(self, xy):
- (x, y) = xy
- if not (0 <= x < self.xsize and 0 <= y < self.ysize):
- raise ValueError("pixel location out of range")
- return xy
-
-
-class _PyAccess32_2(PyAccess):
- """ PA, LA, stored in first and last bytes of a 32 bit word """
-
- def _post_init(self, *args, **kwargs):
- self.pixels = ffi.cast("struct Pixel_RGBA **", self.image32)
-
- def get_pixel(self, x, y):
- pixel = self.pixels[y][x]
- return (pixel.r, pixel.a)
-
- def set_pixel(self, x, y, color):
- pixel = self.pixels[y][x]
- # tuple
- pixel.r = min(color[0], 255)
- pixel.a = min(color[1], 255)
-
-
-class _PyAccess32_3(PyAccess):
- """ RGB and friends, stored in the first three bytes of a 32 bit word """
-
- def _post_init(self, *args, **kwargs):
- self.pixels = ffi.cast("struct Pixel_RGBA **", self.image32)
-
- def get_pixel(self, x, y):
- pixel = self.pixels[y][x]
- return (pixel.r, pixel.g, pixel.b)
-
- def set_pixel(self, x, y, color):
- pixel = self.pixels[y][x]
- # tuple
- pixel.r = min(color[0], 255)
- pixel.g = min(color[1], 255)
- pixel.b = min(color[2], 255)
- pixel.a = 255
-
-
-class _PyAccess32_4(PyAccess):
- """ RGBA etc, all 4 bytes of a 32 bit word """
-
- def _post_init(self, *args, **kwargs):
- self.pixels = ffi.cast("struct Pixel_RGBA **", self.image32)
-
- def get_pixel(self, x, y):
- pixel = self.pixels[y][x]
- return (pixel.r, pixel.g, pixel.b, pixel.a)
-
- def set_pixel(self, x, y, color):
- pixel = self.pixels[y][x]
- # tuple
- pixel.r = min(color[0], 255)
- pixel.g = min(color[1], 255)
- pixel.b = min(color[2], 255)
- pixel.a = min(color[3], 255)
-
-
-class _PyAccess8(PyAccess):
- """ 1, L, P, 8 bit images stored as uint8 """
-
- def _post_init(self, *args, **kwargs):
- self.pixels = self.image8
-
- def get_pixel(self, x, y):
- return self.pixels[y][x]
-
- def set_pixel(self, x, y, color):
- try:
- # integer
- self.pixels[y][x] = min(color, 255)
- except TypeError:
- # tuple
- self.pixels[y][x] = min(color[0], 255)
|
[-]
[+]
|
Deleted |
_service:tar_git:harbour-simplecrop-1.0+main.20210420100251.4.g6bfb428.tar.bz2/lib/arm64/PIL/SgiImagePlugin.py
^
|
@@ -1,230 +0,0 @@
-#
-# The Python Imaging Library.
-# $Id$
-#
-# SGI image file handling
-#
-# See "The SGI Image File Format (Draft version 0.97)", Paul Haeberli.
-# <ftp://ftp.sgi.com/graphics/SGIIMAGESPEC>
-#
-#
-# History:
-# 2017-22-07 mb Add RLE decompression
-# 2016-16-10 mb Add save method without compression
-# 1995-09-10 fl Created
-#
-# Copyright (c) 2016 by Mickael Bonfill.
-# Copyright (c) 2008 by Karsten Hiddemann.
-# Copyright (c) 1997 by Secret Labs AB.
-# Copyright (c) 1995 by Fredrik Lundh.
-#
-# See the README file for information on usage and redistribution.
-#
-
-
-import os
-import struct
-
-from . import Image, ImageFile
-from ._binary import i8, i16be as i16, o8
-
-
-def _accept(prefix):
- return len(prefix) >= 2 and i16(prefix) == 474
-
-
-MODES = {
- (1, 1, 1): "L",
- (1, 2, 1): "L",
- (2, 1, 1): "L;16B",
- (2, 2, 1): "L;16B",
- (1, 3, 3): "RGB",
- (2, 3, 3): "RGB;16B",
- (1, 3, 4): "RGBA",
- (2, 3, 4): "RGBA;16B",
-}
-
-
-##
-# Image plugin for SGI images.
-class SgiImageFile(ImageFile.ImageFile):
-
- format = "SGI"
- format_description = "SGI Image File Format"
-
- def _open(self):
-
- # HEAD
- headlen = 512
- s = self.fp.read(headlen)
-
- if not _accept(s):
- raise ValueError("Not an SGI image file")
-
- # compression : verbatim or RLE
- compression = i8(s[2])
-
- # bpc : 1 or 2 bytes (8bits or 16bits)
- bpc = i8(s[3])
-
- # dimension : 1, 2 or 3 (depending on xsize, ysize and zsize)
- dimension = i16(s[4:])
-
- # xsize : width
- xsize = i16(s[6:])
-
- # ysize : height
- ysize = i16(s[8:])
-
- # zsize : channels count
- zsize = i16(s[10:])
-
- # layout
- layout = bpc, dimension, zsize
-
- # determine mode from bits/zsize
- rawmode = ""
- try:
- rawmode = MODES[layout]
- except KeyError:
- pass
-
- if rawmode == "":
- raise ValueError("Unsupported SGI image mode")
-
- self._size = xsize, ysize
- self.mode = rawmode.split(";")[0]
- if self.mode == "RGB":
- self.custom_mimetype = "image/rgb"
-
- # orientation -1 : scanlines begins at the bottom-left corner
- orientation = -1
-
- # decoder info
- if compression == 0:
- pagesize = xsize * ysize * bpc
- if bpc == 2:
- self.tile = [
- ("SGI16", (0, 0) + self.size, headlen, (self.mode, 0, orientation))
- ]
- else:
- self.tile = []
- offset = headlen
- for layer in self.mode:
- self.tile.append(
- ("raw", (0, 0) + self.size, offset, (layer, 0, orientation))
- )
- offset += pagesize
- elif compression == 1:
- self.tile = [
- ("sgi_rle", (0, 0) + self.size, headlen, (rawmode, orientation, bpc))
- ]
-
-
-def _save(im, fp, filename):
- if im.mode != "RGB" and im.mode != "RGBA" and im.mode != "L":
- raise ValueError("Unsupported SGI image mode")
-
- # Get the keyword arguments
- info = im.encoderinfo
-
- # Byte-per-pixel precision, 1 = 8bits per pixel
- bpc = info.get("bpc", 1)
-
- if bpc not in (1, 2):
- raise ValueError("Unsupported number of bytes per pixel")
-
- # Flip the image, since the origin of SGI file is the bottom-left corner
- orientation = -1
- # Define the file as SGI File Format
- magicNumber = 474
- # Run-Length Encoding Compression - Unsupported at this time
- rle = 0
-
- # Number of dimensions (x,y,z)
- dim = 3
- # X Dimension = width / Y Dimension = height
- x, y = im.size
- if im.mode == "L" and y == 1:
- dim = 1
- elif im.mode == "L":
- dim = 2
- # Z Dimension: Number of channels
- z = len(im.mode)
-
- if dim == 1 or dim == 2:
- z = 1
-
- # assert we've got the right number of bands.
- if len(im.getbands()) != z:
- raise ValueError(
- "incorrect number of bands in SGI write: {} vs {}".format(
- z, len(im.getbands())
- )
- )
-
- # Minimum Byte value
- pinmin = 0
- # Maximum Byte value (255 = 8bits per pixel)
- pinmax = 255
- # Image name (79 characters max, truncated below in write)
- imgName = os.path.splitext(os.path.basename(filename))[0]
- imgName = imgName.encode("ascii", "ignore")
- # Standard representation of pixel in the file
- colormap = 0
- fp.write(struct.pack(">h", magicNumber))
- fp.write(o8(rle))
- fp.write(o8(bpc))
- fp.write(struct.pack(">H", dim))
- fp.write(struct.pack(">H", x))
- fp.write(struct.pack(">H", y))
- fp.write(struct.pack(">H", z))
- fp.write(struct.pack(">l", pinmin))
- fp.write(struct.pack(">l", pinmax))
- fp.write(struct.pack("4s", b"")) # dummy
- fp.write(struct.pack("79s", imgName)) # truncates to 79 chars
- fp.write(struct.pack("s", b"")) # force null byte after imgname
- fp.write(struct.pack(">l", colormap))
- fp.write(struct.pack("404s", b"")) # dummy
-
- rawmode = "L"
- if bpc == 2:
- rawmode = "L;16B"
-
- for channel in im.split():
- fp.write(channel.tobytes("raw", rawmode, 0, orientation))
-
- fp.close()
-
-
|
[-]
[+]
|
Deleted |
_service:tar_git:harbour-simplecrop-1.0+main.20210420100251.4.g6bfb428.tar.bz2/lib/arm64/PIL/SpiderImagePlugin.py
^
|
@@ -1,324 +0,0 @@
-#
-# The Python Imaging Library.
-#
-# SPIDER image file handling
-#
-# History:
-# 2004-08-02 Created BB
-# 2006-03-02 added save method
-# 2006-03-13 added support for stack images
-#
-# Copyright (c) 2004 by Health Research Inc. (HRI) RENSSELAER, NY 12144.
-# Copyright (c) 2004 by William Baxter.
-# Copyright (c) 2004 by Secret Labs AB.
-# Copyright (c) 2004 by Fredrik Lundh.
-#
-
-##
-# Image plugin for the Spider image format. This format is is used
-# by the SPIDER software, in processing image data from electron
-# microscopy and tomography.
-##
-
-#
-# SpiderImagePlugin.py
-#
-# The Spider image format is used by SPIDER software, in processing
-# image data from electron microscopy and tomography.
-#
-# Spider home page:
-# https://spider.wadsworth.org/spider_doc/spider/docs/spider.html
-#
-# Details about the Spider image format:
-# https://spider.wadsworth.org/spider_doc/spider/docs/image_doc.html
-#
-import os
-import struct
-import sys
-
-from PIL import Image, ImageFile
-
-
-def isInt(f):
- try:
- i = int(f)
- if f - i == 0:
- return 1
- else:
- return 0
- except (ValueError, OverflowError):
- return 0
-
-
-iforms = [1, 3, -11, -12, -21, -22]
-
-
-# There is no magic number to identify Spider files, so just check a
-# series of header locations to see if they have reasonable values.
-# Returns no. of bytes in the header, if it is a valid Spider header,
-# otherwise returns 0
-
-
-def isSpiderHeader(t):
- h = (99,) + t # add 1 value so can use spider header index start=1
- # header values 1,2,5,12,13,22,23 should be integers
- for i in [1, 2, 5, 12, 13, 22, 23]:
- if not isInt(h[i]):
- return 0
- # check iform
- iform = int(h[5])
- if iform not in iforms:
- return 0
- # check other header values
- labrec = int(h[13]) # no. records in file header
- labbyt = int(h[22]) # total no. of bytes in header
- lenbyt = int(h[23]) # record length in bytes
- if labbyt != (labrec * lenbyt):
- return 0
- # looks like a valid header
- return labbyt
-
-
-def isSpiderImage(filename):
- with open(filename, "rb") as fp:
- f = fp.read(92) # read 23 * 4 bytes
- t = struct.unpack(">23f", f) # try big-endian first
- hdrlen = isSpiderHeader(t)
- if hdrlen == 0:
- t = struct.unpack("<23f", f) # little-endian
- hdrlen = isSpiderHeader(t)
- return hdrlen
-
-
-class SpiderImageFile(ImageFile.ImageFile):
-
- format = "SPIDER"
- format_description = "Spider 2D image"
- _close_exclusive_fp_after_loading = False
-
- def _open(self):
- # check header
- n = 27 * 4 # read 27 float values
- f = self.fp.read(n)
-
- try:
- self.bigendian = 1
- t = struct.unpack(">27f", f) # try big-endian first
- hdrlen = isSpiderHeader(t)
- if hdrlen == 0:
- self.bigendian = 0
- t = struct.unpack("<27f", f) # little-endian
- hdrlen = isSpiderHeader(t)
- if hdrlen == 0:
- raise SyntaxError("not a valid Spider file")
- except struct.error as e:
- raise SyntaxError("not a valid Spider file") from e
-
- h = (99,) + t # add 1 value : spider header index starts at 1
- iform = int(h[5])
- if iform != 1:
- raise SyntaxError("not a Spider 2D image")
-
- self._size = int(h[12]), int(h[2]) # size in pixels (width, height)
- self.istack = int(h[24])
- self.imgnumber = int(h[27])
-
- if self.istack == 0 and self.imgnumber == 0:
- # stk=0, img=0: a regular 2D image
- offset = hdrlen
- self._nimages = 1
- elif self.istack > 0 and self.imgnumber == 0:
- # stk>0, img=0: Opening the stack for the first time
- self.imgbytes = int(h[12]) * int(h[2]) * 4
- self.hdrlen = hdrlen
- self._nimages = int(h[26])
- # Point to the first image in the stack
- offset = hdrlen * 2
- self.imgnumber = 1
- elif self.istack == 0 and self.imgnumber > 0:
- # stk=0, img>0: an image within the stack
- offset = hdrlen + self.stkoffset
- self.istack = 2 # So Image knows it's still a stack
- else:
- raise SyntaxError("inconsistent stack header values")
-
- if self.bigendian:
- self.rawmode = "F;32BF"
- else:
- self.rawmode = "F;32F"
- self.mode = "F"
-
- self.tile = [("raw", (0, 0) + self.size, offset, (self.rawmode, 0, 1))]
- self.__fp = self.fp # FIXME: hack
-
- @property
- def n_frames(self):
- return self._nimages
-
- @property
- def is_animated(self):
- return self._nimages > 1
-
- # 1st image index is zero (although SPIDER imgnumber starts at 1)
- def tell(self):
- if self.imgnumber < 1:
- return 0
- else:
- return self.imgnumber - 1
-
- def seek(self, frame):
- if self.istack == 0:
- raise EOFError("attempt to seek in a non-stack file")
- if not self._seek_check(frame):
- return
- self.stkoffset = self.hdrlen + frame * (self.hdrlen + self.imgbytes)
- self.fp = self.__fp
- self.fp.seek(self.stkoffset)
- self._open()
-
- # returns a byte image after rescaling to 0..255
- def convert2byte(self, depth=255):
- (minimum, maximum) = self.getextrema()
- m = 1
- if maximum != minimum:
- m = depth / (maximum - minimum)
- b = -m * minimum
- return self.point(lambda i, m=m, b=b: i * m + b).convert("L")
-
- # returns a ImageTk.PhotoImage object, after rescaling to 0..255
- def tkPhotoImage(self):
- from PIL import ImageTk
-
- return ImageTk.PhotoImage(self.convert2byte(), palette=256)
-
- def _close__fp(self):
- try:
- if self.__fp != self.fp:
- self.__fp.close()
- except AttributeError:
- pass
|
[-]
[+]
|
Deleted |
_service:tar_git:harbour-simplecrop-1.0+main.20210420100251.4.g6bfb428.tar.bz2/lib/arm64/PIL/SunImagePlugin.py
^
|
@@ -1,136 +0,0 @@
-#
-# The Python Imaging Library.
-# $Id$
-#
-# Sun image file handling
-#
-# History:
-# 1995-09-10 fl Created
-# 1996-05-28 fl Fixed 32-bit alignment
-# 1998-12-29 fl Import ImagePalette module
-# 2001-12-18 fl Fixed palette loading (from Jean-Claude Rimbault)
-#
-# Copyright (c) 1997-2001 by Secret Labs AB
-# Copyright (c) 1995-1996 by Fredrik Lundh
-#
-# See the README file for information on usage and redistribution.
-#
-
-
-from . import Image, ImageFile, ImagePalette
-from ._binary import i32be as i32
-
-
-def _accept(prefix):
- return len(prefix) >= 4 and i32(prefix) == 0x59A66A95
-
-
-##
-# Image plugin for Sun raster files.
-
-
-class SunImageFile(ImageFile.ImageFile):
-
- format = "SUN"
- format_description = "Sun Raster File"
-
- def _open(self):
-
- # The Sun Raster file header is 32 bytes in length
- # and has the following format:
-
- # typedef struct _SunRaster
- # {
- # DWORD MagicNumber; /* Magic (identification) number */
- # DWORD Width; /* Width of image in pixels */
- # DWORD Height; /* Height of image in pixels */
- # DWORD Depth; /* Number of bits per pixel */
- # DWORD Length; /* Size of image data in bytes */
- # DWORD Type; /* Type of raster file */
- # DWORD ColorMapType; /* Type of color map */
- # DWORD ColorMapLength; /* Size of the color map in bytes */
- # } SUNRASTER;
-
- # HEAD
- s = self.fp.read(32)
- if not _accept(s):
- raise SyntaxError("not an SUN raster file")
-
- offset = 32
-
- self._size = i32(s[4:8]), i32(s[8:12])
-
- depth = i32(s[12:16])
- # data_length = i32(s[16:20]) # unreliable, ignore.
- file_type = i32(s[20:24])
- palette_type = i32(s[24:28]) # 0: None, 1: RGB, 2: Raw/arbitrary
- palette_length = i32(s[28:32])
-
- if depth == 1:
- self.mode, rawmode = "1", "1;I"
- elif depth == 4:
- self.mode, rawmode = "L", "L;4"
- elif depth == 8:
- self.mode = rawmode = "L"
- elif depth == 24:
- if file_type == 3:
- self.mode, rawmode = "RGB", "RGB"
- else:
- self.mode, rawmode = "RGB", "BGR"
- elif depth == 32:
- if file_type == 3:
- self.mode, rawmode = "RGB", "RGBX"
- else:
- self.mode, rawmode = "RGB", "BGRX"
- else:
- raise SyntaxError("Unsupported Mode/Bit Depth")
-
- if palette_length:
- if palette_length > 1024:
- raise SyntaxError("Unsupported Color Palette Length")
-
- if palette_type != 1:
- raise SyntaxError("Unsupported Palette Type")
-
- offset = offset + palette_length
- self.palette = ImagePalette.raw("RGB;L", self.fp.read(palette_length))
- if self.mode == "L":
- self.mode = "P"
- rawmode = rawmode.replace("L", "P")
-
- # 16 bit boundaries on stride
- stride = ((self.size[0] * depth + 15) // 16) * 2
-
- # file type: Type is the version (or flavor) of the bitmap
- # file. The following values are typically found in the Type
- # field:
- # 0000h Old
- # 0001h Standard
- # 0002h Byte-encoded
- # 0003h RGB format
- # 0004h TIFF format
- # 0005h IFF format
- # FFFFh Experimental
-
- # Old and standard are the same, except for the length tag.
- # byte-encoded is run-length-encoded
- # RGB looks similar to standard, but RGB byte order
- # TIFF and IFF mean that they were converted from T/IFF
- # Experimental means that it's something else.
- # (https://www.fileformat.info/format/sunraster/egff.htm)
-
- if file_type in (0, 1, 3, 4, 5):
- self.tile = [("raw", (0, 0) + self.size, offset, (rawmode, stride))]
- elif file_type == 2:
- self.tile = [("sun_rle", (0, 0) + self.size, offset, rawmode)]
- else:
- raise SyntaxError("Unsupported Sun Raster file type")
-
-
-#
-# registry
-
-
-Image.register_open(SunImageFile.format, SunImageFile, _accept)
-
-Image.register_extension(SunImageFile.format, ".ras")
|
[-]
[+]
|
Deleted |
_service:tar_git:harbour-simplecrop-1.0+main.20210420100251.4.g6bfb428.tar.bz2/lib/arm64/PIL/TarIO.py
^
|
@@ -1,65 +0,0 @@
-#
-# The Python Imaging Library.
-# $Id$
-#
-# read files from within a tar file
-#
-# History:
-# 95-06-18 fl Created
-# 96-05-28 fl Open files in binary mode
-#
-# Copyright (c) Secret Labs AB 1997.
-# Copyright (c) Fredrik Lundh 1995-96.
-#
-# See the README file for information on usage and redistribution.
-#
-
-import io
-
-from . import ContainerIO
-
-
-class TarIO(ContainerIO.ContainerIO):
- """A file object that provides read access to a given member of a TAR file."""
-
- def __init__(self, tarfile, file):
- """
- Create file object.
-
- :param tarfile: Name of TAR file.
- :param file: Name of member file.
- """
- self.fh = open(tarfile, "rb")
-
- while True:
-
- s = self.fh.read(512)
- if len(s) != 512:
- raise OSError("unexpected end of tar file")
-
- name = s[:100].decode("utf-8")
- i = name.find("\0")
- if i == 0:
- raise OSError("cannot find subfile")
- if i > 0:
- name = name[:i]
-
- size = int(s[124:135], 8)
-
- if file == name:
- break
-
- self.fh.seek((size + 511) & (~511), io.SEEK_CUR)
-
- # Open region
- super().__init__(self.fh, self.fh.tell(), size)
-
- # Context manager support
- def __enter__(self):
- return self
-
- def __exit__(self, *args):
- self.close()
-
- def close(self):
- self.fh.close()
|
[-]
[+]
|
Deleted |
_service:tar_git:harbour-simplecrop-1.0+main.20210420100251.4.g6bfb428.tar.bz2/lib/arm64/PIL/TgaImagePlugin.py
^
|
@@ -1,246 +0,0 @@
-#
-# The Python Imaging Library.
-# $Id$
-#
-# TGA file handling
-#
-# History:
-# 95-09-01 fl created (reads 24-bit files only)
-# 97-01-04 fl support more TGA versions, including compressed images
-# 98-07-04 fl fixed orientation and alpha layer bugs
-# 98-09-11 fl fixed orientation for runlength decoder
-#
-# Copyright (c) Secret Labs AB 1997-98.
-# Copyright (c) Fredrik Lundh 1995-97.
-#
-# See the README file for information on usage and redistribution.
-#
-
-
-import warnings
-
-from . import Image, ImageFile, ImagePalette
-from ._binary import i8, i16le as i16, o8, o16le as o16
-
-#
-# --------------------------------------------------------------------
-# Read RGA file
-
-
-MODES = {
- # map imagetype/depth to rawmode
- (1, 8): "P",
- (3, 1): "1",
- (3, 8): "L",
- (3, 16): "LA",
- (2, 16): "BGR;5",
- (2, 24): "BGR",
- (2, 32): "BGRA",
-}
-
-
-##
-# Image plugin for Targa files.
-
-
-class TgaImageFile(ImageFile.ImageFile):
-
- format = "TGA"
- format_description = "Targa"
-
- def _open(self):
-
- # process header
- s = self.fp.read(18)
-
- id_len = i8(s[0])
-
- colormaptype = i8(s[1])
- imagetype = i8(s[2])
-
- depth = i8(s[16])
-
- flags = i8(s[17])
-
- self._size = i16(s[12:]), i16(s[14:])
-
- # validate header fields
- if (
- colormaptype not in (0, 1)
- or self.size[0] <= 0
- or self.size[1] <= 0
- or depth not in (1, 8, 16, 24, 32)
- ):
- raise SyntaxError("not a TGA file")
-
- # image mode
- if imagetype in (3, 11):
- self.mode = "L"
- if depth == 1:
- self.mode = "1" # ???
- elif depth == 16:
- self.mode = "LA"
- elif imagetype in (1, 9):
- self.mode = "P"
- elif imagetype in (2, 10):
- self.mode = "RGB"
- if depth == 32:
- self.mode = "RGBA"
- else:
- raise SyntaxError("unknown TGA mode")
-
- # orientation
- orientation = flags & 0x30
- if orientation == 0x20:
- orientation = 1
- elif not orientation:
- orientation = -1
- else:
- raise SyntaxError("unknown TGA orientation")
-
- self.info["orientation"] = orientation
-
- if imagetype & 8:
- self.info["compression"] = "tga_rle"
-
- if id_len:
- self.info["id_section"] = self.fp.read(id_len)
-
- if colormaptype:
- # read palette
- start, size, mapdepth = i16(s[3:]), i16(s[5:]), i16(s[7:])
- if mapdepth == 16:
- self.palette = ImagePalette.raw(
- "BGR;16", b"\0" * 2 * start + self.fp.read(2 * size)
- )
- elif mapdepth == 24:
- self.palette = ImagePalette.raw(
- "BGR", b"\0" * 3 * start + self.fp.read(3 * size)
- )
- elif mapdepth == 32:
- self.palette = ImagePalette.raw(
- "BGRA", b"\0" * 4 * start + self.fp.read(4 * size)
- )
-
- # setup tile descriptor
- try:
- rawmode = MODES[(imagetype & 7, depth)]
- if imagetype & 8:
- # compressed
- self.tile = [
- (
- "tga_rle",
- (0, 0) + self.size,
- self.fp.tell(),
- (rawmode, orientation, depth),
- )
- ]
- else:
- self.tile = [
- (
- "raw",
- (0, 0) + self.size,
- self.fp.tell(),
- (rawmode, 0, orientation),
- )
- ]
- except KeyError:
- pass # cannot decode
-
-
-#
-# --------------------------------------------------------------------
-# Write TGA file
-
-
-SAVE = {
- "1": ("1", 1, 0, 3),
- "L": ("L", 8, 0, 3),
- "LA": ("LA", 16, 0, 3),
- "P": ("P", 8, 1, 1),
- "RGB": ("BGR", 24, 0, 2),
- "RGBA": ("BGRA", 32, 0, 2),
-}
-
-
-def _save(im, fp, filename):
-
- try:
- rawmode, bits, colormaptype, imagetype = SAVE[im.mode]
- except KeyError as e:
- raise OSError("cannot write mode %s as TGA" % im.mode) from e
-
- if "rle" in im.encoderinfo:
- rle = im.encoderinfo["rle"]
- else:
- compression = im.encoderinfo.get("compression", im.info.get("compression"))
- rle = compression == "tga_rle"
- if rle:
- imagetype += 8
-
- id_section = im.encoderinfo.get("id_section", im.info.get("id_section", ""))
- id_len = len(id_section)
- if id_len > 255:
- id_len = 255
- id_section = id_section[:255]
- warnings.warn("id_section has been trimmed to 255 characters")
-
- if colormaptype:
- colormapfirst, colormaplength, colormapentry = 0, 256, 24
- else:
- colormapfirst, colormaplength, colormapentry = 0, 0, 0
-
- if im.mode in ("LA", "RGBA"):
- flags = 8
- else:
- flags = 0
-
- orientation = im.encoderinfo.get("orientation", im.info.get("orientation", -1))
- if orientation > 0:
|
[-]
[+]
|
Deleted |
_service:tar_git:harbour-simplecrop-1.0+main.20210420100251.4.g6bfb428.tar.bz2/lib/arm64/PIL/TiffImagePlugin.py
^
|
@@ -1,1891 +0,0 @@
-#
-# The Python Imaging Library.
-# $Id$
-#
-# TIFF file handling
-#
-# TIFF is a flexible, if somewhat aged, image file format originally
-# defined by Aldus. Although TIFF supports a wide variety of pixel
-# layouts and compression methods, the name doesn't really stand for
-# "thousands of incompatible file formats," it just feels that way.
-#
-# To read TIFF data from a stream, the stream must be seekable. For
-# progressive decoding, make sure to use TIFF files where the tag
-# directory is placed first in the file.
-#
-# History:
-# 1995-09-01 fl Created
-# 1996-05-04 fl Handle JPEGTABLES tag
-# 1996-05-18 fl Fixed COLORMAP support
-# 1997-01-05 fl Fixed PREDICTOR support
-# 1997-08-27 fl Added support for rational tags (from Perry Stoll)
-# 1998-01-10 fl Fixed seek/tell (from Jan Blom)
-# 1998-07-15 fl Use private names for internal variables
-# 1999-06-13 fl Rewritten for PIL 1.0 (1.0)
-# 2000-10-11 fl Additional fixes for Python 2.0 (1.1)
-# 2001-04-17 fl Fixed rewind support (seek to frame 0) (1.2)
-# 2001-05-12 fl Added write support for more tags (from Greg Couch) (1.3)
-# 2001-12-18 fl Added workaround for broken Matrox library
-# 2002-01-18 fl Don't mess up if photometric tag is missing (D. Alan Stewart)
-# 2003-05-19 fl Check FILLORDER tag
-# 2003-09-26 fl Added RGBa support
-# 2004-02-24 fl Added DPI support; fixed rational write support
-# 2005-02-07 fl Added workaround for broken Corel Draw 10 files
-# 2006-01-09 fl Added support for float/double tags (from Russell Nelson)
-#
-# Copyright (c) 1997-2006 by Secret Labs AB. All rights reserved.
-# Copyright (c) 1995-1997 by Fredrik Lundh
-#
-# See the README file for information on usage and redistribution.
-#
-import io
-import itertools
-import logging
-import os
-import struct
-import warnings
-from collections.abc import MutableMapping
-from fractions import Fraction
-from numbers import Number, Rational
-
-from . import Image, ImageFile, ImagePalette, TiffTags
-from ._binary import i8, o8
-from .TiffTags import TYPES
-
-logger = logging.getLogger(__name__)
-
-# Set these to true to force use of libtiff for reading or writing.
-READ_LIBTIFF = False
-WRITE_LIBTIFF = False
-IFD_LEGACY_API = True
-
-II = b"II" # little-endian (Intel style)
-MM = b"MM" # big-endian (Motorola style)
-
-#
-# --------------------------------------------------------------------
-# Read TIFF files
-
-# a few tag names, just to make the code below a bit more readable
-IMAGEWIDTH = 256
-IMAGELENGTH = 257
-BITSPERSAMPLE = 258
-COMPRESSION = 259
-PHOTOMETRIC_INTERPRETATION = 262
-FILLORDER = 266
-IMAGEDESCRIPTION = 270
-STRIPOFFSETS = 273
-SAMPLESPERPIXEL = 277
-ROWSPERSTRIP = 278
-STRIPBYTECOUNTS = 279
-X_RESOLUTION = 282
-Y_RESOLUTION = 283
-PLANAR_CONFIGURATION = 284
-RESOLUTION_UNIT = 296
-TRANSFERFUNCTION = 301
-SOFTWARE = 305
-DATE_TIME = 306
-ARTIST = 315
-PREDICTOR = 317
-COLORMAP = 320
-TILEOFFSETS = 324
-EXTRASAMPLES = 338
-SAMPLEFORMAT = 339
-JPEGTABLES = 347
-REFERENCEBLACKWHITE = 532
-COPYRIGHT = 33432
-IPTC_NAA_CHUNK = 33723 # newsphoto properties
-PHOTOSHOP_CHUNK = 34377 # photoshop properties
-ICCPROFILE = 34675
-EXIFIFD = 34665
-XMP = 700
-JPEGQUALITY = 65537 # pseudo-tag by libtiff
-
-# https://github.com/imagej/ImageJA/blob/master/src/main/java/ij/io/TiffDecoder.java
-IMAGEJ_META_DATA_BYTE_COUNTS = 50838
-IMAGEJ_META_DATA = 50839
-
-COMPRESSION_INFO = {
- # Compression => pil compression name
- 1: "raw",
- 2: "tiff_ccitt",
- 3: "group3",
- 4: "group4",
- 5: "tiff_lzw",
- 6: "tiff_jpeg", # obsolete
- 7: "jpeg",
- 8: "tiff_adobe_deflate",
- 32771: "tiff_raw_16", # 16-bit padding
- 32773: "packbits",
- 32809: "tiff_thunderscan",
- 32946: "tiff_deflate",
- 34676: "tiff_sgilog",
- 34677: "tiff_sgilog24",
- 34925: "lzma",
- 50000: "zstd",
- 50001: "webp",
-}
-
-COMPRESSION_INFO_REV = {v: k for k, v in COMPRESSION_INFO.items()}
-
-OPEN_INFO = {
- # (ByteOrder, PhotoInterpretation, SampleFormat, FillOrder, BitsPerSample,
- # ExtraSamples) => mode, rawmode
- (II, 0, (1,), 1, (1,), ()): ("1", "1;I"),
- (MM, 0, (1,), 1, (1,), ()): ("1", "1;I"),
- (II, 0, (1,), 2, (1,), ()): ("1", "1;IR"),
- (MM, 0, (1,), 2, (1,), ()): ("1", "1;IR"),
- (II, 1, (1,), 1, (1,), ()): ("1", "1"),
- (MM, 1, (1,), 1, (1,), ()): ("1", "1"),
- (II, 1, (1,), 2, (1,), ()): ("1", "1;R"),
- (MM, 1, (1,), 2, (1,), ()): ("1", "1;R"),
- (II, 0, (1,), 1, (2,), ()): ("L", "L;2I"),
- (MM, 0, (1,), 1, (2,), ()): ("L", "L;2I"),
- (II, 0, (1,), 2, (2,), ()): ("L", "L;2IR"),
- (MM, 0, (1,), 2, (2,), ()): ("L", "L;2IR"),
- (II, 1, (1,), 1, (2,), ()): ("L", "L;2"),
- (MM, 1, (1,), 1, (2,), ()): ("L", "L;2"),
- (II, 1, (1,), 2, (2,), ()): ("L", "L;2R"),
- (MM, 1, (1,), 2, (2,), ()): ("L", "L;2R"),
- (II, 0, (1,), 1, (4,), ()): ("L", "L;4I"),
- (MM, 0, (1,), 1, (4,), ()): ("L", "L;4I"),
- (II, 0, (1,), 2, (4,), ()): ("L", "L;4IR"),
- (MM, 0, (1,), 2, (4,), ()): ("L", "L;4IR"),
- (II, 1, (1,), 1, (4,), ()): ("L", "L;4"),
- (MM, 1, (1,), 1, (4,), ()): ("L", "L;4"),
- (II, 1, (1,), 2, (4,), ()): ("L", "L;4R"),
- (MM, 1, (1,), 2, (4,), ()): ("L", "L;4R"),
- (II, 0, (1,), 1, (8,), ()): ("L", "L;I"),
- (MM, 0, (1,), 1, (8,), ()): ("L", "L;I"),
- (II, 0, (1,), 2, (8,), ()): ("L", "L;IR"),
- (MM, 0, (1,), 2, (8,), ()): ("L", "L;IR"),
- (II, 1, (1,), 1, (8,), ()): ("L", "L"),
- (MM, 1, (1,), 1, (8,), ()): ("L", "L"),
- (II, 1, (1,), 2, (8,), ()): ("L", "L;R"),
- (MM, 1, (1,), 2, (8,), ()): ("L", "L;R"),
- (II, 1, (1,), 1, (12,), ()): ("I;16", "I;12"),
- (II, 1, (1,), 1, (16,), ()): ("I;16", "I;16"),
- (MM, 1, (1,), 1, (16,), ()): ("I;16B", "I;16B"),
- (II, 1, (2,), 1, (16,), ()): ("I", "I;16S"),
- (MM, 1, (2,), 1, (16,), ()): ("I", "I;16BS"),
- (II, 0, (3,), 1, (32,), ()): ("F", "F;32F"),
- (MM, 0, (3,), 1, (32,), ()): ("F", "F;32BF"),
- (II, 1, (1,), 1, (32,), ()): ("I", "I;32N"),
- (II, 1, (2,), 1, (32,), ()): ("I", "I;32S"),
- (MM, 1, (2,), 1, (32,), ()): ("I", "I;32BS"),
- (II, 1, (3,), 1, (32,), ()): ("F", "F;32F"),
- (MM, 1, (3,), 1, (32,), ()): ("F", "F;32BF"),
- (II, 1, (1,), 1, (8, 8), (2,)): ("LA", "LA"),
- (MM, 1, (1,), 1, (8, 8), (2,)): ("LA", "LA"),
- (II, 2, (1,), 1, (8, 8, 8), ()): ("RGB", "RGB"),
- (MM, 2, (1,), 1, (8, 8, 8), ()): ("RGB", "RGB"),
- (II, 2, (1,), 2, (8, 8, 8), ()): ("RGB", "RGB;R"),
- (MM, 2, (1,), 2, (8, 8, 8), ()): ("RGB", "RGB;R"),
- (II, 2, (1,), 1, (8, 8, 8, 8), ()): ("RGBA", "RGBA"), # missing ExtraSamples
- (MM, 2, (1,), 1, (8, 8, 8, 8), ()): ("RGBA", "RGBA"), # missing ExtraSamples
- (II, 2, (1,), 1, (8, 8, 8, 8), (0,)): ("RGBX", "RGBX"),
- (MM, 2, (1,), 1, (8, 8, 8, 8), (0,)): ("RGBX", "RGBX"),
- (II, 2, (1,), 1, (8, 8, 8, 8, 8), (0, 0)): ("RGBX", "RGBXX"),
- (MM, 2, (1,), 1, (8, 8, 8, 8, 8), (0, 0)): ("RGBX", "RGBXX"),
- (II, 2, (1,), 1, (8, 8, 8, 8, 8, 8), (0, 0, 0)): ("RGBX", "RGBXXX"),
- (MM, 2, (1,), 1, (8, 8, 8, 8, 8, 8), (0, 0, 0)): ("RGBX", "RGBXXX"),
- (II, 2, (1,), 1, (8, 8, 8, 8), (1,)): ("RGBA", "RGBa"),
- (MM, 2, (1,), 1, (8, 8, 8, 8), (1,)): ("RGBA", "RGBa"),
- (II, 2, (1,), 1, (8, 8, 8, 8, 8), (1, 0)): ("RGBA", "RGBaX"),
- (MM, 2, (1,), 1, (8, 8, 8, 8, 8), (1, 0)): ("RGBA", "RGBaX"),
- (II, 2, (1,), 1, (8, 8, 8, 8, 8, 8), (1, 0, 0)): ("RGBA", "RGBaXX"),
- (MM, 2, (1,), 1, (8, 8, 8, 8, 8, 8), (1, 0, 0)): ("RGBA", "RGBaXX"),
- (II, 2, (1,), 1, (8, 8, 8, 8), (2,)): ("RGBA", "RGBA"),
- (MM, 2, (1,), 1, (8, 8, 8, 8), (2,)): ("RGBA", "RGBA"),
|
[-]
[+]
|
Deleted |
_service:tar_git:harbour-simplecrop-1.0+main.20210420100251.4.g6bfb428.tar.bz2/lib/arm64/PIL/TiffTags.py
^
|
@@ -1,498 +0,0 @@
-#
-# The Python Imaging Library.
-# $Id$
-#
-# TIFF tags
-#
-# This module provides clear-text names for various well-known
-# TIFF tags. the TIFF codec works just fine without it.
-#
-# Copyright (c) Secret Labs AB 1999.
-#
-# See the README file for information on usage and redistribution.
-#
-
-##
-# This module provides constants and clear-text names for various
-# well-known TIFF tags.
-##
-
-from collections import namedtuple
-
-
-class TagInfo(namedtuple("_TagInfo", "value name type length enum")):
- __slots__ = []
-
- def __new__(cls, value=None, name="unknown", type=None, length=None, enum=None):
- return super().__new__(cls, value, name, type, length, enum or {})
-
- def cvt_enum(self, value):
- # Using get will call hash(value), which can be expensive
- # for some types (e.g. Fraction). Since self.enum is rarely
- # used, it's usually better to test it first.
- return self.enum.get(value, value) if self.enum else value
-
-
-def lookup(tag):
- """
- :param tag: Integer tag number
- :returns: Taginfo namedtuple, From the TAGS_V2 info if possible,
- otherwise just populating the value and name from TAGS.
- If the tag is not recognized, "unknown" is returned for the name
-
- """
-
- return TAGS_V2.get(tag, TagInfo(tag, TAGS.get(tag, "unknown")))
-
-
-##
-# Map tag numbers to tag info.
-#
-# id: (Name, Type, Length, enum_values)
-#
-# The length here differs from the length in the tiff spec. For
-# numbers, the tiff spec is for the number of fields returned. We
-# agree here. For string-like types, the tiff spec uses the length of
-# field in bytes. In Pillow, we are using the number of expected
-# fields, in general 1 for string-like types.
-
-
-BYTE = 1
-ASCII = 2
-SHORT = 3
-LONG = 4
-RATIONAL = 5
-SIGNED_BYTE = 6
-UNDEFINED = 7
-SIGNED_SHORT = 8
-SIGNED_LONG = 9
-SIGNED_RATIONAL = 10
-FLOAT = 11
-DOUBLE = 12
-
-TAGS_V2 = {
- 254: ("NewSubfileType", LONG, 1),
- 255: ("SubfileType", SHORT, 1),
- 256: ("ImageWidth", LONG, 1),
- 257: ("ImageLength", LONG, 1),
- 258: ("BitsPerSample", SHORT, 0),
- 259: (
- "Compression",
- SHORT,
- 1,
- {
- "Uncompressed": 1,
- "CCITT 1d": 2,
- "Group 3 Fax": 3,
- "Group 4 Fax": 4,
- "LZW": 5,
- "JPEG": 6,
- "PackBits": 32773,
- },
- ),
- 262: (
- "PhotometricInterpretation",
- SHORT,
- 1,
- {
- "WhiteIsZero": 0,
- "BlackIsZero": 1,
- "RGB": 2,
- "RGB Palette": 3,
- "Transparency Mask": 4,
- "CMYK": 5,
- "YCbCr": 6,
- "CieLAB": 8,
- "CFA": 32803, # TIFF/EP, Adobe DNG
- "LinearRaw": 32892, # Adobe DNG
- },
- ),
- 263: ("Threshholding", SHORT, 1),
- 264: ("CellWidth", SHORT, 1),
- 265: ("CellLength", SHORT, 1),
- 266: ("FillOrder", SHORT, 1),
- 269: ("DocumentName", ASCII, 1),
- 270: ("ImageDescription", ASCII, 1),
- 271: ("Make", ASCII, 1),
- 272: ("Model", ASCII, 1),
- 273: ("StripOffsets", LONG, 0),
- 274: ("Orientation", SHORT, 1),
- 277: ("SamplesPerPixel", SHORT, 1),
- 278: ("RowsPerStrip", LONG, 1),
- 279: ("StripByteCounts", LONG, 0),
- 280: ("MinSampleValue", SHORT, 0),
- 281: ("MaxSampleValue", SHORT, 0),
- 282: ("XResolution", RATIONAL, 1),
- 283: ("YResolution", RATIONAL, 1),
- 284: ("PlanarConfiguration", SHORT, 1, {"Contiguous": 1, "Separate": 2}),
- 285: ("PageName", ASCII, 1),
- 286: ("XPosition", RATIONAL, 1),
- 287: ("YPosition", RATIONAL, 1),
- 288: ("FreeOffsets", LONG, 1),
- 289: ("FreeByteCounts", LONG, 1),
- 290: ("GrayResponseUnit", SHORT, 1),
- 291: ("GrayResponseCurve", SHORT, 0),
- 292: ("T4Options", LONG, 1),
- 293: ("T6Options", LONG, 1),
- 296: ("ResolutionUnit", SHORT, 1, {"none": 1, "inch": 2, "cm": 3}),
- 297: ("PageNumber", SHORT, 2),
- 301: ("TransferFunction", SHORT, 0),
- 305: ("Software", ASCII, 1),
- 306: ("DateTime", ASCII, 1),
- 315: ("Artist", ASCII, 1),
- 316: ("HostComputer", ASCII, 1),
- 317: ("Predictor", SHORT, 1, {"none": 1, "Horizontal Differencing": 2}),
- 318: ("WhitePoint", RATIONAL, 2),
- 319: ("PrimaryChromaticities", RATIONAL, 6),
- 320: ("ColorMap", SHORT, 0),
- 321: ("HalftoneHints", SHORT, 2),
- 322: ("TileWidth", LONG, 1),
- 323: ("TileLength", LONG, 1),
- 324: ("TileOffsets", LONG, 0),
- 325: ("TileByteCounts", LONG, 0),
- 332: ("InkSet", SHORT, 1),
- 333: ("InkNames", ASCII, 1),
- 334: ("NumberOfInks", SHORT, 1),
- 336: ("DotRange", SHORT, 0),
- 337: ("TargetPrinter", ASCII, 1),
- 338: ("ExtraSamples", SHORT, 0),
- 339: ("SampleFormat", SHORT, 0),
- 340: ("SMinSampleValue", DOUBLE, 0),
- 341: ("SMaxSampleValue", DOUBLE, 0),
- 342: ("TransferRange", SHORT, 6),
- 347: ("JPEGTables", UNDEFINED, 1),
- # obsolete JPEG tags
- 512: ("JPEGProc", SHORT, 1),
- 513: ("JPEGInterchangeFormat", LONG, 1),
- 514: ("JPEGInterchangeFormatLength", LONG, 1),
- 515: ("JPEGRestartInterval", SHORT, 1),
- 517: ("JPEGLosslessPredictors", SHORT, 0),
- 518: ("JPEGPointTransforms", SHORT, 0),
- 519: ("JPEGQTables", LONG, 0),
- 520: ("JPEGDCTables", LONG, 0),
- 521: ("JPEGACTables", LONG, 0),
- 529: ("YCbCrCoefficients", RATIONAL, 3),
- 530: ("YCbCrSubSampling", SHORT, 2),
- 531: ("YCbCrPositioning", SHORT, 1),
- 532: ("ReferenceBlackWhite", RATIONAL, 6),
- 700: ("XMP", BYTE, 0),
- 33432: ("Copyright", ASCII, 1),
- 33723: ("IptcNaaInfo", UNDEFINED, 0),
- 34377: ("PhotoshopInfo", BYTE, 0),
- # FIXME add more tags here
- 34665: ("ExifIFD", LONG, 1),
- 34675: ("ICCProfile", UNDEFINED, 1),
- 34853: ("GPSInfoIFD", LONG, 1),
- # MPInfo
- 45056: ("MPFVersion", UNDEFINED, 1),
- 45057: ("NumberOfImages", LONG, 1),
- 45058: ("MPEntry", UNDEFINED, 1),
- 45059: ("ImageUIDList", UNDEFINED, 0), # UNDONE, check
- 45060: ("TotalFrames", LONG, 1),
- 45313: ("MPIndividualNum", LONG, 1),
- 45569: ("PanOrientation", LONG, 1),
- 45570: ("PanOverlap_H", RATIONAL, 1),
- 45571: ("PanOverlap_V", RATIONAL, 1),
- 45572: ("BaseViewpointNum", LONG, 1),
- 45573: ("ConvergenceAngle", SIGNED_RATIONAL, 1),
- 45574: ("BaselineLength", RATIONAL, 1),
- 45575: ("VerticalDivergence", SIGNED_RATIONAL, 1),
|
[-]
[+]
|
Deleted |
_service:tar_git:harbour-simplecrop-1.0+main.20210420100251.4.g6bfb428.tar.bz2/lib/arm64/PIL/WalImageFile.py
^
|
@@ -1,126 +0,0 @@
-#
-# The Python Imaging Library.
-# $Id$
-#
-# WAL file handling
-#
-# History:
-# 2003-04-23 fl created
-#
-# Copyright (c) 2003 by Fredrik Lundh.
-#
-# See the README file for information on usage and redistribution.
-#
-
-"""
-This reader is based on the specification available from:
-https://www.flipcode.com/archives/Quake_2_BSP_File_Format.shtml
-and has been tested with a few sample files found using google.
-
-.. note::
- This format cannot be automatically recognized, so the reader
- is not registered for use with :py:func:`PIL.Image.open()`.
- To open a WAL file, use the :py:func:`PIL.WalImageFile.open()` function instead.
-"""
-
-import builtins
-
-from . import Image
-from ._binary import i32le as i32
-
-
-def open(filename):
- """
- Load texture from a Quake2 WAL texture file.
-
- By default, a Quake2 standard palette is attached to the texture.
- To override the palette, use the :py:func:`PIL.Image.Image.putpalette()` method.
-
- :param filename: WAL file name, or an opened file handle.
- :returns: An image instance.
- """
- # FIXME: modify to return a WalImageFile instance instead of
- # plain Image object ?
-
- def imopen(fp):
- # read header fields
- header = fp.read(32 + 24 + 32 + 12)
- size = i32(header, 32), i32(header, 36)
- offset = i32(header, 40)
-
- # load pixel data
- fp.seek(offset)
-
- Image._decompression_bomb_check(size)
- im = Image.frombytes("P", size, fp.read(size[0] * size[1]))
- im.putpalette(quake2palette)
-
- im.format = "WAL"
- im.format_description = "Quake2 Texture"
-
- # strings are null-terminated
- im.info["name"] = header[:32].split(b"\0", 1)[0]
- next_name = header[56 : 56 + 32].split(b"\0", 1)[0]
- if next_name:
- im.info["next_name"] = next_name
-
- return im
-
- if hasattr(filename, "read"):
- return imopen(filename)
- else:
- with builtins.open(filename, "rb") as fp:
- return imopen(fp)
-
-
-quake2palette = (
- # default palette taken from piffo 0.93 by Hans Häggström
- b"\x01\x01\x01\x0b\x0b\x0b\x12\x12\x12\x17\x17\x17\x1b\x1b\x1b\x1e"
- b"\x1e\x1e\x22\x22\x22\x26\x26\x26\x29\x29\x29\x2c\x2c\x2c\x2f\x2f"
- b"\x2f\x32\x32\x32\x35\x35\x35\x37\x37\x37\x3a\x3a\x3a\x3c\x3c\x3c"
- b"\x24\x1e\x13\x22\x1c\x12\x20\x1b\x12\x1f\x1a\x10\x1d\x19\x10\x1b"
- b"\x17\x0f\x1a\x16\x0f\x18\x14\x0d\x17\x13\x0d\x16\x12\x0d\x14\x10"
- b"\x0b\x13\x0f\x0b\x10\x0d\x0a\x0f\x0b\x0a\x0d\x0b\x07\x0b\x0a\x07"
- b"\x23\x23\x26\x22\x22\x25\x22\x20\x23\x21\x1f\x22\x20\x1e\x20\x1f"
- b"\x1d\x1e\x1d\x1b\x1c\x1b\x1a\x1a\x1a\x19\x19\x18\x17\x17\x17\x16"
- b"\x16\x14\x14\x14\x13\x13\x13\x10\x10\x10\x0f\x0f\x0f\x0d\x0d\x0d"
- b"\x2d\x28\x20\x29\x24\x1c\x27\x22\x1a\x25\x1f\x17\x38\x2e\x1e\x31"
- b"\x29\x1a\x2c\x25\x17\x26\x20\x14\x3c\x30\x14\x37\x2c\x13\x33\x28"
- b"\x12\x2d\x24\x10\x28\x1f\x0f\x22\x1a\x0b\x1b\x14\x0a\x13\x0f\x07"
- b"\x31\x1a\x16\x30\x17\x13\x2e\x16\x10\x2c\x14\x0d\x2a\x12\x0b\x27"
- b"\x0f\x0a\x25\x0f\x07\x21\x0d\x01\x1e\x0b\x01\x1c\x0b\x01\x1a\x0b"
- b"\x01\x18\x0a\x01\x16\x0a\x01\x13\x0a\x01\x10\x07\x01\x0d\x07\x01"
- b"\x29\x23\x1e\x27\x21\x1c\x26\x20\x1b\x25\x1f\x1a\x23\x1d\x19\x21"
- b"\x1c\x18\x20\x1b\x17\x1e\x19\x16\x1c\x18\x14\x1b\x17\x13\x19\x14"
- b"\x10\x17\x13\x0f\x14\x10\x0d\x12\x0f\x0b\x0f\x0b\x0a\x0b\x0a\x07"
- b"\x26\x1a\x0f\x23\x19\x0f\x20\x17\x0f\x1c\x16\x0f\x19\x13\x0d\x14"
- b"\x10\x0b\x10\x0d\x0a\x0b\x0a\x07\x33\x22\x1f\x35\x29\x26\x37\x2f"
- b"\x2d\x39\x35\x34\x37\x39\x3a\x33\x37\x39\x30\x34\x36\x2b\x31\x34"
- b"\x27\x2e\x31\x22\x2b\x2f\x1d\x28\x2c\x17\x25\x2a\x0f\x20\x26\x0d"
- b"\x1e\x25\x0b\x1c\x22\x0a\x1b\x20\x07\x19\x1e\x07\x17\x1b\x07\x14"
- b"\x18\x01\x12\x16\x01\x0f\x12\x01\x0b\x0d\x01\x07\x0a\x01\x01\x01"
- b"\x2c\x21\x21\x2a\x1f\x1f\x29\x1d\x1d\x27\x1c\x1c\x26\x1a\x1a\x24"
- b"\x18\x18\x22\x17\x17\x21\x16\x16\x1e\x13\x13\x1b\x12\x12\x18\x10"
- b"\x10\x16\x0d\x0d\x12\x0b\x0b\x0d\x0a\x0a\x0a\x07\x07\x01\x01\x01"
- b"\x2e\x30\x29\x2d\x2e\x27\x2b\x2c\x26\x2a\x2a\x24\x28\x29\x23\x27"
- b"\x27\x21\x26\x26\x1f\x24\x24\x1d\x22\x22\x1c\x1f\x1f\x1a\x1c\x1c"
- b"\x18\x19\x19\x16\x17\x17\x13\x13\x13\x10\x0f\x0f\x0d\x0b\x0b\x0a"
- b"\x30\x1e\x1b\x2d\x1c\x19\x2c\x1a\x17\x2a\x19\x14\x28\x17\x13\x26"
- b"\x16\x10\x24\x13\x0f\x21\x12\x0d\x1f\x10\x0b\x1c\x0f\x0a\x19\x0d"
- b"\x0a\x16\x0b\x07\x12\x0a\x07\x0f\x07\x01\x0a\x01\x01\x01\x01\x01"
- b"\x28\x29\x38\x26\x27\x36\x25\x26\x34\x24\x24\x31\x22\x22\x2f\x20"
- b"\x21\x2d\x1e\x1f\x2a\x1d\x1d\x27\x1b\x1b\x25\x19\x19\x21\x17\x17"
- b"\x1e\x14\x14\x1b\x13\x12\x17\x10\x0f\x13\x0d\x0b\x0f\x0a\x07\x07"
- b"\x2f\x32\x29\x2d\x30\x26\x2b\x2e\x24\x29\x2c\x21\x27\x2a\x1e\x25"
- b"\x28\x1c\x23\x26\x1a\x21\x25\x18\x1e\x22\x14\x1b\x1f\x10\x19\x1c"
- b"\x0d\x17\x1a\x0a\x13\x17\x07\x10\x13\x01\x0d\x0f\x01\x0a\x0b\x01"
- b"\x01\x3f\x01\x13\x3c\x0b\x1b\x39\x10\x20\x35\x14\x23\x31\x17\x23"
- b"\x2d\x18\x23\x29\x18\x3f\x3f\x3f\x3f\x3f\x39\x3f\x3f\x31\x3f\x3f"
- b"\x2a\x3f\x3f\x20\x3f\x3f\x14\x3f\x3c\x12\x3f\x39\x0f\x3f\x35\x0b"
- b"\x3f\x32\x07\x3f\x2d\x01\x3d\x2a\x01\x3b\x26\x01\x39\x21\x01\x37"
- b"\x1d\x01\x34\x1a\x01\x32\x16\x01\x2f\x12\x01\x2d\x0f\x01\x2a\x0b"
- b"\x01\x27\x07\x01\x23\x01\x01\x1d\x01\x01\x17\x01\x01\x10\x01\x01"
- b"\x3d\x01\x01\x19\x19\x3f\x3f\x01\x01\x01\x01\x3f\x16\x16\x13\x10"
- b"\x10\x0f\x0d\x0d\x0b\x3c\x2e\x2a\x36\x27\x20\x30\x21\x18\x29\x1b"
- b"\x10\x3c\x39\x37\x37\x32\x2f\x31\x2c\x28\x2b\x26\x21\x30\x22\x20"
-)
|
[-]
[+]
|
Deleted |
_service:tar_git:harbour-simplecrop-1.0+main.20210420100251.4.g6bfb428.tar.bz2/lib/arm64/PIL/WebPImagePlugin.py
^
|
@@ -1,351 +0,0 @@
-from io import BytesIO
-
-from . import Image, ImageFile
-
-try:
- from . import _webp
-
- SUPPORTED = True
-except ImportError:
- SUPPORTED = False
-
-
-_VALID_WEBP_MODES = {"RGBX": True, "RGBA": True, "RGB": True}
-
-_VALID_WEBP_LEGACY_MODES = {"RGB": True, "RGBA": True}
-
-_VP8_MODES_BY_IDENTIFIER = {
- b"VP8 ": "RGB",
- b"VP8X": "RGBA",
- b"VP8L": "RGBA", # lossless
-}
-
-
-def _accept(prefix):
- is_riff_file_format = prefix[:4] == b"RIFF"
- is_webp_file = prefix[8:12] == b"WEBP"
- is_valid_vp8_mode = prefix[12:16] in _VP8_MODES_BY_IDENTIFIER
-
- if is_riff_file_format and is_webp_file and is_valid_vp8_mode:
- if not SUPPORTED:
- return (
- "image file could not be identified because WEBP support not installed"
- )
- return True
-
-
-class WebPImageFile(ImageFile.ImageFile):
-
- format = "WEBP"
- format_description = "WebP image"
- __loaded = 0
- __logical_frame = 0
-
- def _open(self):
- if not _webp.HAVE_WEBPANIM:
- # Legacy mode
- data, width, height, self.mode, icc_profile, exif = _webp.WebPDecode(
- self.fp.read()
- )
- if icc_profile:
- self.info["icc_profile"] = icc_profile
- if exif:
- self.info["exif"] = exif
- self._size = width, height
- self.fp = BytesIO(data)
- self.tile = [("raw", (0, 0) + self.size, 0, self.mode)]
- self.n_frames = 1
- self.is_animated = False
- return
-
- # Use the newer AnimDecoder API to parse the (possibly) animated file,
- # and access muxed chunks like ICC/EXIF/XMP.
- self._decoder = _webp.WebPAnimDecoder(self.fp.read())
-
- # Get info from decoder
- width, height, loop_count, bgcolor, frame_count, mode = self._decoder.get_info()
- self._size = width, height
- self.info["loop"] = loop_count
- bg_a, bg_r, bg_g, bg_b = (
- (bgcolor >> 24) & 0xFF,
- (bgcolor >> 16) & 0xFF,
- (bgcolor >> 8) & 0xFF,
- bgcolor & 0xFF,
- )
- self.info["background"] = (bg_r, bg_g, bg_b, bg_a)
- self.n_frames = frame_count
- self.is_animated = self.n_frames > 1
- self.mode = "RGB" if mode == "RGBX" else mode
- self.rawmode = mode
- self.tile = []
-
- # Attempt to read ICC / EXIF / XMP chunks from file
- icc_profile = self._decoder.get_chunk("ICCP")
- exif = self._decoder.get_chunk("EXIF")
- xmp = self._decoder.get_chunk("XMP ")
- if icc_profile:
- self.info["icc_profile"] = icc_profile
- if exif:
- self.info["exif"] = exif
- if xmp:
- self.info["xmp"] = xmp
-
- # Initialize seek state
- self._reset(reset=False)
-
- def _getexif(self):
- if "exif" not in self.info:
- return None
- return dict(self.getexif())
-
- def seek(self, frame):
- if not self._seek_check(frame):
- return
-
- # Set logical frame to requested position
- self.__logical_frame = frame
-
- def _reset(self, reset=True):
- if reset:
- self._decoder.reset()
- self.__physical_frame = 0
- self.__loaded = -1
- self.__timestamp = 0
-
- def _get_next(self):
- # Get next frame
- ret = self._decoder.get_next()
- self.__physical_frame += 1
-
- # Check if an error occurred
- if ret is None:
- self._reset() # Reset just to be safe
- self.seek(0)
- raise EOFError("failed to decode next frame in WebP file")
-
- # Compute duration
- data, timestamp = ret
- duration = timestamp - self.__timestamp
- self.__timestamp = timestamp
-
- # libwebp gives frame end, adjust to start of frame
- timestamp -= duration
- return data, timestamp, duration
-
- def _seek(self, frame):
- if self.__physical_frame == frame:
- return # Nothing to do
- if frame < self.__physical_frame:
- self._reset() # Rewind to beginning
- while self.__physical_frame < frame:
- self._get_next() # Advance to the requested frame
-
- def load(self):
- if _webp.HAVE_WEBPANIM:
- if self.__loaded != self.__logical_frame:
- self._seek(self.__logical_frame)
-
- # We need to load the image data for this frame
- data, timestamp, duration = self._get_next()
- self.info["timestamp"] = timestamp
- self.info["duration"] = duration
- self.__loaded = self.__logical_frame
-
- # Set tile
- if self.fp and self._exclusive_fp:
- self.fp.close()
- self.fp = BytesIO(data)
- self.tile = [("raw", (0, 0) + self.size, 0, self.rawmode)]
-
- return super().load()
-
- def tell(self):
- if not _webp.HAVE_WEBPANIM:
- return super().tell()
-
- return self.__logical_frame
-
-
-def _save_all(im, fp, filename):
- encoderinfo = im.encoderinfo.copy()
- append_images = list(encoderinfo.get("append_images", []))
-
- # If total frame count is 1, then save using the legacy API, which
- # will preserve non-alpha modes
- total = 0
- for ims in [im] + append_images:
- total += getattr(ims, "n_frames", 1)
- if total == 1:
- _save(im, fp, filename)
- return
-
- background = (0, 0, 0, 0)
- if "background" in encoderinfo:
- background = encoderinfo["background"]
- elif "background" in im.info:
- background = im.info["background"]
- if isinstance(background, int):
- # GifImagePlugin stores a global color table index in
- # info["background"]. So it must be converted to an RGBA value
- palette = im.getpalette()
- if palette:
- r, g, b = palette[background * 3 : (background + 1) * 3]
- background = (r, g, b, 0)
-
- duration = im.encoderinfo.get("duration", 0)
- loop = im.encoderinfo.get("loop", 0)
- minimize_size = im.encoderinfo.get("minimize_size", False)
- kmin = im.encoderinfo.get("kmin", None)
- kmax = im.encoderinfo.get("kmax", None)
|
[-]
[+]
|
Deleted |
_service:tar_git:harbour-simplecrop-1.0+main.20210420100251.4.g6bfb428.tar.bz2/lib/arm64/PIL/WmfImagePlugin.py
^
|
@@ -1,175 +0,0 @@
-#
-# The Python Imaging Library
-# $Id$
-#
-# WMF stub codec
-#
-# history:
-# 1996-12-14 fl Created
-# 2004-02-22 fl Turned into a stub driver
-# 2004-02-23 fl Added EMF support
-#
-# Copyright (c) Secret Labs AB 1997-2004. All rights reserved.
-# Copyright (c) Fredrik Lundh 1996.
-#
-# See the README file for information on usage and redistribution.
-#
-# WMF/EMF reference documentation:
-# https://winprotocoldoc.blob.core.windows.net/productionwindowsarchives/MS-WMF/[MS-WMF].pdf
-# http://wvware.sourceforge.net/caolan/index.html
-# http://wvware.sourceforge.net/caolan/ora-wmf.html
-
-from . import Image, ImageFile
-from ._binary import i16le as word, i32le as dword, si16le as short, si32le as _long
-
-_handler = None
-
-
-def register_handler(handler):
- """
- Install application-specific WMF image handler.
-
- :param handler: Handler object.
- """
- global _handler
- _handler = handler
-
-
-if hasattr(Image.core, "drawwmf"):
- # install default handler (windows only)
-
- class WmfHandler:
- def open(self, im):
- im.mode = "RGB"
- self.bbox = im.info["wmf_bbox"]
-
- def load(self, im):
- im.fp.seek(0) # rewind
- return Image.frombytes(
- "RGB",
- im.size,
- Image.core.drawwmf(im.fp.read(), im.size, self.bbox),
- "raw",
- "BGR",
- (im.size[0] * 3 + 3) & -4,
- -1,
- )
-
- register_handler(WmfHandler())
-
-#
-# --------------------------------------------------------------------
-# Read WMF file
-
-
-def _accept(prefix):
- return (
- prefix[:6] == b"\xd7\xcd\xc6\x9a\x00\x00" or prefix[:4] == b"\x01\x00\x00\x00"
- )
-
-
-##
-# Image plugin for Windows metafiles.
-
-
-class WmfStubImageFile(ImageFile.StubImageFile):
-
- format = "WMF"
- format_description = "Windows Metafile"
-
- def _open(self):
- self._inch = None
-
- # check placable header
- s = self.fp.read(80)
-
- if s[:6] == b"\xd7\xcd\xc6\x9a\x00\x00":
-
- # placeable windows metafile
-
- # get units per inch
- self._inch = word(s, 14)
-
- # get bounding box
- x0 = short(s, 6)
- y0 = short(s, 8)
- x1 = short(s, 10)
- y1 = short(s, 12)
-
- # normalize size to 72 dots per inch
- self.info["dpi"] = 72
- size = (
- (x1 - x0) * self.info["dpi"] // self._inch,
- (y1 - y0) * self.info["dpi"] // self._inch,
- )
-
- self.info["wmf_bbox"] = x0, y0, x1, y1
-
- # sanity check (standard metafile header)
- if s[22:26] != b"\x01\x00\t\x00":
- raise SyntaxError("Unsupported WMF file format")
-
- elif dword(s) == 1 and s[40:44] == b" EMF":
- # enhanced metafile
-
- # get bounding box
- x0 = _long(s, 8)
- y0 = _long(s, 12)
- x1 = _long(s, 16)
- y1 = _long(s, 20)
-
- # get frame (in 0.01 millimeter units)
- frame = _long(s, 24), _long(s, 28), _long(s, 32), _long(s, 36)
-
- size = x1 - x0, y1 - y0
-
- # calculate dots per inch from bbox and frame
- xdpi = int(2540.0 * (x1 - y0) / (frame[2] - frame[0]) + 0.5)
- ydpi = int(2540.0 * (y1 - y0) / (frame[3] - frame[1]) + 0.5)
-
- self.info["wmf_bbox"] = x0, y0, x1, y1
-
- if xdpi == ydpi:
- self.info["dpi"] = xdpi
- else:
- self.info["dpi"] = xdpi, ydpi
-
- else:
- raise SyntaxError("Unsupported file format")
-
- self.mode = "RGB"
- self._size = size
-
- loader = self._load()
- if loader:
- loader.open(self)
-
- def _load(self):
- return _handler
-
- def load(self, dpi=None):
- if dpi is not None and self._inch is not None:
- self.info["dpi"] = int(dpi + 0.5)
- x0, y0, x1, y1 = self.info["wmf_bbox"]
- self._size = (
- (x1 - x0) * self.info["dpi"] // self._inch,
- (y1 - y0) * self.info["dpi"] // self._inch,
- )
- super().load()
-
-
-def _save(im, fp, filename):
- if _handler is None or not hasattr(_handler, "save"):
- raise OSError("WMF save handler not installed")
- _handler.save(im, fp, filename)
-
-
-#
-# --------------------------------------------------------------------
-# Registry stuff
-
-
-Image.register_open(WmfStubImageFile.format, WmfStubImageFile, _accept)
-Image.register_save(WmfStubImageFile.format, _save)
-
-Image.register_extensions(WmfStubImageFile.format, [".wmf", ".emf"])
|
[-]
[+]
|
Deleted |
_service:tar_git:harbour-simplecrop-1.0+main.20210420100251.4.g6bfb428.tar.bz2/lib/arm64/PIL/XVThumbImagePlugin.py
^
|
@@ -1,78 +0,0 @@
-#
-# The Python Imaging Library.
-# $Id$
-#
-# XV Thumbnail file handler by Charles E. "Gene" Cash
-# (gcash@magicnet.net)
-#
-# see xvcolor.c and xvbrowse.c in the sources to John Bradley's XV,
-# available from ftp://ftp.cis.upenn.edu/pub/xv/
-#
-# history:
-# 98-08-15 cec created (b/w only)
-# 98-12-09 cec added color palette
-# 98-12-28 fl added to PIL (with only a few very minor modifications)
-#
-# To do:
-# FIXME: make save work (this requires quantization support)
-#
-
-from . import Image, ImageFile, ImagePalette
-from ._binary import i8, o8
-
-_MAGIC = b"P7 332"
-
-# standard color palette for thumbnails (RGB332)
-PALETTE = b""
-for r in range(8):
- for g in range(8):
- for b in range(4):
- PALETTE = PALETTE + (
- o8((r * 255) // 7) + o8((g * 255) // 7) + o8((b * 255) // 3)
- )
-
-
-def _accept(prefix):
- return prefix[:6] == _MAGIC
-
-
-##
-# Image plugin for XV thumbnail images.
-
-
-class XVThumbImageFile(ImageFile.ImageFile):
-
- format = "XVThumb"
- format_description = "XV thumbnail image"
-
- def _open(self):
-
- # check magic
- if not _accept(self.fp.read(6)):
- raise SyntaxError("not an XV thumbnail file")
-
- # Skip to beginning of next line
- self.fp.readline()
-
- # skip info comments
- while True:
- s = self.fp.readline()
- if not s:
- raise SyntaxError("Unexpected EOF reading XV thumbnail file")
- if i8(s[0]) != 35: # ie. when not a comment: '#'
- break
-
- # parse header line (already read)
- s = s.strip().split()
-
- self.mode = "P"
- self._size = int(s[0]), int(s[1])
-
- self.palette = ImagePalette.raw("RGB", PALETTE)
-
- self.tile = [("raw", (0, 0) + self.size, self.fp.tell(), (self.mode, 0, 1))]
-
-
-# --------------------------------------------------------------------
-
-Image.register_open(XVThumbImageFile.format, XVThumbImageFile, _accept)
|
[-]
[+]
|
Deleted |
_service:tar_git:harbour-simplecrop-1.0+main.20210420100251.4.g6bfb428.tar.bz2/lib/arm64/PIL/XbmImagePlugin.py
^
|
@@ -1,94 +0,0 @@
-#
-# The Python Imaging Library.
-# $Id$
-#
-# XBM File handling
-#
-# History:
-# 1995-09-08 fl Created
-# 1996-11-01 fl Added save support
-# 1997-07-07 fl Made header parser more tolerant
-# 1997-07-22 fl Fixed yet another parser bug
-# 2001-02-17 fl Use 're' instead of 'regex' (Python 2.1) (0.4)
-# 2001-05-13 fl Added hotspot handling (based on code from Bernhard Herzog)
-# 2004-02-24 fl Allow some whitespace before first #define
-#
-# Copyright (c) 1997-2004 by Secret Labs AB
-# Copyright (c) 1996-1997 by Fredrik Lundh
-#
-# See the README file for information on usage and redistribution.
-#
-
-import re
-
-from . import Image, ImageFile
-
-# XBM header
-xbm_head = re.compile(
- br"\s*#define[ \t]+.*_width[ \t]+(?P<width>[0-9]+)[\r\n]+"
- b"#define[ \t]+.*_height[ \t]+(?P<height>[0-9]+)[\r\n]+"
- b"(?P<hotspot>"
- b"#define[ \t]+[^_]*_x_hot[ \t]+(?P<xhot>[0-9]+)[\r\n]+"
- b"#define[ \t]+[^_]*_y_hot[ \t]+(?P<yhot>[0-9]+)[\r\n]+"
- b")?"
- b"[\\000-\\377]*_bits\\[\\]"
-)
-
-
-def _accept(prefix):
- return prefix.lstrip()[:7] == b"#define"
-
-
-##
-# Image plugin for X11 bitmaps.
-
-
-class XbmImageFile(ImageFile.ImageFile):
-
- format = "XBM"
- format_description = "X11 Bitmap"
-
- def _open(self):
-
- m = xbm_head.match(self.fp.read(512))
-
- if m:
-
- xsize = int(m.group("width"))
- ysize = int(m.group("height"))
-
- if m.group("hotspot"):
- self.info["hotspot"] = (int(m.group("xhot")), int(m.group("yhot")))
-
- self.mode = "1"
- self._size = xsize, ysize
-
- self.tile = [("xbm", (0, 0) + self.size, m.end(), None)]
-
-
-def _save(im, fp, filename):
-
- if im.mode != "1":
- raise OSError("cannot write mode %s as XBM" % im.mode)
-
- fp.write(("#define im_width %d\n" % im.size[0]).encode("ascii"))
- fp.write(("#define im_height %d\n" % im.size[1]).encode("ascii"))
-
- hotspot = im.encoderinfo.get("hotspot")
- if hotspot:
- fp.write(("#define im_x_hot %d\n" % hotspot[0]).encode("ascii"))
- fp.write(("#define im_y_hot %d\n" % hotspot[1]).encode("ascii"))
-
- fp.write(b"static char im_bits[] = {\n")
-
- ImageFile._save(im, fp, [("xbm", (0, 0) + im.size, 0, None)])
-
- fp.write(b"};\n")
-
-
-Image.register_open(XbmImageFile.format, XbmImageFile, _accept)
-Image.register_save(XbmImageFile.format, _save)
-
-Image.register_extension(XbmImageFile.format, ".xbm")
-
-Image.register_mime(XbmImageFile.format, "image/xbm")
|
[-]
[+]
|
Deleted |
_service:tar_git:harbour-simplecrop-1.0+main.20210420100251.4.g6bfb428.tar.bz2/lib/arm64/PIL/XpmImagePlugin.py
^
|
@@ -1,130 +0,0 @@
-#
-# The Python Imaging Library.
-# $Id$
-#
-# XPM File handling
-#
-# History:
-# 1996-12-29 fl Created
-# 2001-02-17 fl Use 're' instead of 'regex' (Python 2.1) (0.7)
-#
-# Copyright (c) Secret Labs AB 1997-2001.
-# Copyright (c) Fredrik Lundh 1996-2001.
-#
-# See the README file for information on usage and redistribution.
-#
-
-
-import re
-
-from . import Image, ImageFile, ImagePalette
-from ._binary import i8, o8
-
-# XPM header
-xpm_head = re.compile(b'"([0-9]*) ([0-9]*) ([0-9]*) ([0-9]*)')
-
-
-def _accept(prefix):
- return prefix[:9] == b"/* XPM */"
-
-
-##
-# Image plugin for X11 pixel maps.
-
-
-class XpmImageFile(ImageFile.ImageFile):
-
- format = "XPM"
- format_description = "X11 Pixel Map"
-
- def _open(self):
-
- if not _accept(self.fp.read(9)):
- raise SyntaxError("not an XPM file")
-
- # skip forward to next string
- while True:
- s = self.fp.readline()
- if not s:
- raise SyntaxError("broken XPM file")
- m = xpm_head.match(s)
- if m:
- break
-
- self._size = int(m.group(1)), int(m.group(2))
-
- pal = int(m.group(3))
- bpp = int(m.group(4))
-
- if pal > 256 or bpp != 1:
- raise ValueError("cannot read this XPM file")
-
- #
- # load palette description
-
- palette = [b"\0\0\0"] * 256
-
- for i in range(pal):
-
- s = self.fp.readline()
- if s[-2:] == b"\r\n":
- s = s[:-2]
- elif s[-1:] in b"\r\n":
- s = s[:-1]
-
- c = i8(s[1])
- s = s[2:-2].split()
-
- for i in range(0, len(s), 2):
-
- if s[i] == b"c":
-
- # process colour key
- rgb = s[i + 1]
- if rgb == b"None":
- self.info["transparency"] = c
- elif rgb[0:1] == b"#":
- # FIXME: handle colour names (see ImagePalette.py)
- rgb = int(rgb[1:], 16)
- palette[c] = (
- o8((rgb >> 16) & 255) + o8((rgb >> 8) & 255) + o8(rgb & 255)
- )
- else:
- # unknown colour
- raise ValueError("cannot read this XPM file")
- break
-
- else:
-
- # missing colour key
- raise ValueError("cannot read this XPM file")
-
- self.mode = "P"
- self.palette = ImagePalette.raw("RGB", b"".join(palette))
-
- self.tile = [("raw", (0, 0) + self.size, self.fp.tell(), ("P", 0, 1))]
-
- def load_read(self, bytes):
-
- #
- # load all image data in one chunk
-
- xsize, ysize = self.size
-
- s = [None] * ysize
-
- for i in range(ysize):
- s[i] = self.fp.readline()[1 : xsize + 1].ljust(xsize)
-
- return b"".join(s)
-
-
-#
-# Registry
-
-
-Image.register_open(XpmImageFile.format, XpmImageFile, _accept)
-
-Image.register_extension(XpmImageFile.format, ".xpm")
-
-Image.register_mime(XpmImageFile.format, "image/xpm")
|
[-]
[+]
|
Deleted |
_service:tar_git:harbour-simplecrop-1.0+main.20210420100251.4.g6bfb428.tar.bz2/lib/arm64/PIL/__init__.py
^
|
@@ -1,139 +0,0 @@
-"""Pillow (Fork of the Python Imaging Library)
-
-Pillow is the friendly PIL fork by Alex Clark and Contributors.
- https://github.com/python-pillow/Pillow/
-
-Pillow is forked from PIL 1.1.7.
-
-PIL is the Python Imaging Library by Fredrik Lundh and Contributors.
-Copyright (c) 1999 by Secret Labs AB.
-
-Use PIL.__version__ for this Pillow version.
-
-;-)
-"""
-
-import sys
-import warnings
-
-from . import _version
-
-# VERSION was removed in Pillow 6.0.0.
-__version__ = _version.__version__
-
-
-# PILLOW_VERSION is deprecated and will be removed in a future release.
-# Use __version__ instead.
-def _raise_version_warning():
- warnings.warn(
- "PILLOW_VERSION is deprecated and will be removed in a future release. "
- "Use __version__ instead.",
- DeprecationWarning,
- stacklevel=3,
- )
-
-
-if sys.version_info >= (3, 7):
-
- def __getattr__(name):
- if name == "PILLOW_VERSION":
- _raise_version_warning()
- return __version__
- raise AttributeError("module '{}' has no attribute '{}'".format(__name__, name))
-
-
-else:
-
- class _Deprecated_Version(str):
- def __str__(self):
- _raise_version_warning()
- return super().__str__()
-
- def __getitem__(self, key):
- _raise_version_warning()
- return super().__getitem__(key)
-
- def __eq__(self, other):
- _raise_version_warning()
- return super().__eq__(other)
-
- def __ne__(self, other):
- _raise_version_warning()
- return super().__ne__(other)
-
- def __gt__(self, other):
- _raise_version_warning()
- return super().__gt__(other)
-
- def __lt__(self, other):
- _raise_version_warning()
- return super().__lt__(other)
-
- def __ge__(self, other):
- _raise_version_warning()
- return super().__gt__(other)
-
- def __le__(self, other):
- _raise_version_warning()
- return super().__lt__(other)
-
- PILLOW_VERSION = _Deprecated_Version(__version__)
-
-del _version
-
-
-_plugins = [
- "BlpImagePlugin",
- "BmpImagePlugin",
- "BufrStubImagePlugin",
- "CurImagePlugin",
- "DcxImagePlugin",
- "DdsImagePlugin",
- "EpsImagePlugin",
- "FitsStubImagePlugin",
- "FliImagePlugin",
- "FpxImagePlugin",
- "FtexImagePlugin",
- "GbrImagePlugin",
- "GifImagePlugin",
- "GribStubImagePlugin",
- "Hdf5StubImagePlugin",
- "IcnsImagePlugin",
- "IcoImagePlugin",
- "ImImagePlugin",
- "ImtImagePlugin",
- "IptcImagePlugin",
- "JpegImagePlugin",
- "Jpeg2KImagePlugin",
- "McIdasImagePlugin",
- "MicImagePlugin",
- "MpegImagePlugin",
- "MpoImagePlugin",
- "MspImagePlugin",
- "PalmImagePlugin",
- "PcdImagePlugin",
- "PcxImagePlugin",
- "PdfImagePlugin",
- "PixarImagePlugin",
- "PngImagePlugin",
- "PpmImagePlugin",
- "PsdImagePlugin",
- "SgiImagePlugin",
- "SpiderImagePlugin",
- "SunImagePlugin",
- "TgaImagePlugin",
- "TiffImagePlugin",
- "WebPImagePlugin",
- "WmfImagePlugin",
- "XbmImagePlugin",
- "XpmImagePlugin",
- "XVThumbImagePlugin",
-]
-
-
-class UnidentifiedImageError(OSError):
- """
- Raised in :py:meth:`PIL.Image.open` if an image cannot be opened and identified.
- """
-
- pass
|
[-]
[+]
|
Deleted |
_service:tar_git:harbour-simplecrop-1.0+main.20210420100251.4.g6bfb428.tar.bz2/lib/arm64/PIL/__main__.py
^
|
@@ -1,3 +0,0 @@
-from .features import pilinfo
-
-pilinfo()
|
[-]
[+]
|
Deleted |
_service:tar_git:harbour-simplecrop-1.0+main.20210420100251.4.g6bfb428.tar.bz2/lib/arm64/PIL/_binary.py
^
|
@@ -1,92 +0,0 @@
-#
-# The Python Imaging Library.
-# $Id$
-#
-# Binary input/output support routines.
-#
-# Copyright (c) 1997-2003 by Secret Labs AB
-# Copyright (c) 1995-2003 by Fredrik Lundh
-# Copyright (c) 2012 by Brian Crowell
-#
-# See the README file for information on usage and redistribution.
-#
-
-
-"""Binary input/output support routines."""
-
-
-from struct import pack, unpack_from
-
-
-def i8(c):
- return c if c.__class__ is int else c[0]
-
-
-def o8(i):
- return bytes((i & 255,))
-
-
-# Input, le = little endian, be = big endian
-def i16le(c, o=0):
- """
- Converts a 2-bytes (16 bits) string to an unsigned integer.
-
- :param c: string containing bytes to convert
- :param o: offset of bytes to convert in string
- """
- return unpack_from("<H", c, o)[0]
-
-
-def si16le(c, o=0):
- """
- Converts a 2-bytes (16 bits) string to a signed integer.
-
- :param c: string containing bytes to convert
- :param o: offset of bytes to convert in string
- """
- return unpack_from("<h", c, o)[0]
-
-
-def i32le(c, o=0):
- """
- Converts a 4-bytes (32 bits) string to an unsigned integer.
-
- :param c: string containing bytes to convert
- :param o: offset of bytes to convert in string
- """
- return unpack_from("<I", c, o)[0]
-
-
-def si32le(c, o=0):
- """
- Converts a 4-bytes (32 bits) string to a signed integer.
-
- :param c: string containing bytes to convert
- :param o: offset of bytes to convert in string
- """
- return unpack_from("<i", c, o)[0]
-
-
-def i16be(c, o=0):
- return unpack_from(">H", c, o)[0]
-
-
-def i32be(c, o=0):
- return unpack_from(">I", c, o)[0]
-
-
-# Output, le = little endian, be = big endian
-def o16le(i):
- return pack("<H", i)
-
-
-def o32le(i):
- return pack("<I", i)
-
-
-def o16be(i):
- return pack(">H", i)
-
-
-def o32be(i):
- return pack(">I", i)
|
|
Deleted |
_service:tar_git:harbour-simplecrop-1.0+main.20210420100251.4.g6bfb428.tar.bz2/lib/arm64/PIL/_imaging.cpython-35m-aarch64-linux-gnu.so
^
|
|
Deleted |
_service:tar_git:harbour-simplecrop-1.0+main.20210420100251.4.g6bfb428.tar.bz2/lib/arm64/PIL/_imagingcms.cpython-35m-aarch64-linux-gnu.so
^
|
|
Deleted |
_service:tar_git:harbour-simplecrop-1.0+main.20210420100251.4.g6bfb428.tar.bz2/lib/arm64/PIL/_imagingft.cpython-35m-aarch64-linux-gnu.so
^
|
|
Deleted |
_service:tar_git:harbour-simplecrop-1.0+main.20210420100251.4.g6bfb428.tar.bz2/lib/arm64/PIL/_imagingmath.cpython-35m-aarch64-linux-gnu.so
^
|
|
Deleted |
_service:tar_git:harbour-simplecrop-1.0+main.20210420100251.4.g6bfb428.tar.bz2/lib/arm64/PIL/_imagingmorph.cpython-35m-aarch64-linux-gnu.so
^
|
|
Deleted |
_service:tar_git:harbour-simplecrop-1.0+main.20210420100251.4.g6bfb428.tar.bz2/lib/arm64/PIL/_imagingtk.cpython-35m-aarch64-linux-gnu.so
^
|
[-]
[+]
|
Deleted |
_service:tar_git:harbour-simplecrop-1.0+main.20210420100251.4.g6bfb428.tar.bz2/lib/arm64/PIL/_tkinter_finder.py
^
|
@@ -1,16 +0,0 @@
-""" Find compiled module linking to Tcl / Tk libraries
-"""
-import sys
-from tkinter import _tkinter as tk
-
-if hasattr(sys, "pypy_find_executable"):
- # Tested with packages at https://bitbucket.org/pypy/pypy/downloads.
- # PyPies 1.6, 2.0 do not have tkinter built in. PyPy3-2.3.1 gives an
- # OSError trying to import tkinter. Otherwise:
- try: # PyPy 5.1, 4.0.0, 2.6.1, 2.6.0
- TKINTER_LIB = tk.tklib_cffi.__file__
- except AttributeError:
- # PyPy3 2.4, 2.1-beta1; PyPy 2.5.1, 2.5.0, 2.4.0, 2.3, 2.2, 2.1
- TKINTER_LIB = tk.tkffi.verifier.modulefilename
-else:
- TKINTER_LIB = tk.__file__
|
[-]
[+]
|
Deleted |
_service:tar_git:harbour-simplecrop-1.0+main.20210420100251.4.g6bfb428.tar.bz2/lib/arm64/PIL/_util.py
^
|
@@ -1,30 +0,0 @@
-import os
-import sys
-
-py36 = sys.version_info[0:2] >= (3, 6)
-
-
-if py36:
- from pathlib import Path
-
- def isPath(f):
- return isinstance(f, (bytes, str, Path))
-
-
-else:
-
- def isPath(f):
- return isinstance(f, (bytes, str))
-
-
-# Checks if an object is a string, and that it points to a directory.
-def isDirectory(f):
- return isPath(f) and os.path.isdir(f)
-
-
-class deferred_error:
- def __init__(self, ex):
- self.ex = ex
-
- def __getattr__(self, elt):
- raise self.ex
|
[-]
[+]
|
Deleted |
_service:tar_git:harbour-simplecrop-1.0+main.20210420100251.4.g6bfb428.tar.bz2/lib/arm64/PIL/_version.py
^
|
@@ -1,2 +0,0 @@
-# Master version for Pillow
-__version__ = "7.2.0"
|
|
Deleted |
_service:tar_git:harbour-simplecrop-1.0+main.20210420100251.4.g6bfb428.tar.bz2/lib/arm64/PIL/_webp.cpython-35m-aarch64-linux-gnu.so
^
|
[-]
[+]
|
Deleted |
_service:tar_git:harbour-simplecrop-1.0+main.20210420100251.4.g6bfb428.tar.bz2/lib/arm64/PIL/features.py
^
|
@@ -1,309 +0,0 @@
-import collections
-import os
-import sys
-import warnings
-
-import PIL
-
-from . import Image
-
-modules = {
- "pil": ("PIL._imaging", "PILLOW_VERSION"),
- "tkinter": ("PIL._tkinter_finder", None),
- "freetype2": ("PIL._imagingft", "freetype2_version"),
- "littlecms2": ("PIL._imagingcms", "littlecms_version"),
- "webp": ("PIL._webp", "webpdecoder_version"),
-}
-
-
-def check_module(feature):
- """
- Checks if a module is available.
-
- :param feature: The module to check for.
- :returns: ``True`` if available, ``False`` otherwise.
- :raises ValueError: If the module is not defined in this version of Pillow.
- """
- if not (feature in modules):
- raise ValueError("Unknown module %s" % feature)
-
- module, ver = modules[feature]
-
- try:
- __import__(module)
- return True
- except ImportError:
- return False
-
-
-def version_module(feature):
- """
- :param feature: The module to check for.
- :returns:
- The loaded version number as a string, or ``None`` if unknown or not available.
- :raises ValueError: If the module is not defined in this version of Pillow.
- """
- if not check_module(feature):
- return None
-
- module, ver = modules[feature]
-
- if ver is None:
- return None
-
- return getattr(__import__(module, fromlist=[ver]), ver)
-
-
-def get_supported_modules():
- """
- :returns: A list of all supported modules.
- """
- return [f for f in modules if check_module(f)]
-
-
-codecs = {
- "jpg": ("jpeg", "jpeglib"),
- "jpg_2000": ("jpeg2k", "jp2klib"),
- "zlib": ("zip", "zlib"),
- "libtiff": ("libtiff", "libtiff"),
-}
-
-
-def check_codec(feature):
- """
- Checks if a codec is available.
-
- :param feature: The codec to check for.
- :returns: ``True`` if available, ``False`` otherwise.
- :raises ValueError: If the codec is not defined in this version of Pillow.
- """
- if feature not in codecs:
- raise ValueError("Unknown codec %s" % feature)
-
- codec, lib = codecs[feature]
-
- return codec + "_encoder" in dir(Image.core)
-
-
-def version_codec(feature):
- """
- :param feature: The codec to check for.
- :returns:
- The version number as a string, or ``None`` if not available.
- Checked at compile time for ``jpg``, run-time otherwise.
- :raises ValueError: If the codec is not defined in this version of Pillow.
- """
- if not check_codec(feature):
- return None
-
- codec, lib = codecs[feature]
-
- version = getattr(Image.core, lib + "_version")
-
- if feature == "libtiff":
- return version.split("\n")[0].split("Version ")[1]
-
- return version
-
-
-def get_supported_codecs():
- """
- :returns: A list of all supported codecs.
- """
- return [f for f in codecs if check_codec(f)]
-
-
-features = {
- "webp_anim": ("PIL._webp", "HAVE_WEBPANIM", None),
- "webp_mux": ("PIL._webp", "HAVE_WEBPMUX", None),
- "transp_webp": ("PIL._webp", "HAVE_TRANSPARENCY", None),
- "raqm": ("PIL._imagingft", "HAVE_RAQM", "raqm_version"),
- "libjpeg_turbo": ("PIL._imaging", "HAVE_LIBJPEGTURBO", "libjpeg_turbo_version"),
- "libimagequant": ("PIL._imaging", "HAVE_LIBIMAGEQUANT", "imagequant_version"),
- "xcb": ("PIL._imaging", "HAVE_XCB", None),
-}
-
-
-def check_feature(feature):
- """
- Checks if a feature is available.
-
- :param feature: The feature to check for.
- :returns: ``True`` if available, ``False`` if unavailable, ``None`` if unknown.
- :raises ValueError: If the feature is not defined in this version of Pillow.
- """
- if feature not in features:
- raise ValueError("Unknown feature %s" % feature)
-
- module, flag, ver = features[feature]
-
- try:
- imported_module = __import__(module, fromlist=["PIL"])
- return getattr(imported_module, flag)
- except ImportError:
- return None
-
-
-def version_feature(feature):
- """
- :param feature: The feature to check for.
- :returns: The version number as a string, or ``None`` if not available.
- :raises ValueError: If the feature is not defined in this version of Pillow.
- """
- if not check_feature(feature):
- return None
-
- module, flag, ver = features[feature]
-
- if ver is None:
- return None
-
- return getattr(__import__(module, fromlist=[ver]), ver)
-
-
-def get_supported_features():
- """
- :returns: A list of all supported features.
- """
- return [f for f in features if check_feature(f)]
-
-
-def check(feature):
- """
- :param feature: A module, codec, or feature name.
- :returns:
- ``True`` if the module, codec, or feature is available,
- ``False`` or ``None`` otherwise.
- """
-
- if feature in modules:
- return check_module(feature)
- if feature in codecs:
- return check_codec(feature)
- if feature in features:
- return check_feature(feature)
- warnings.warn("Unknown feature '%s'." % feature, stacklevel=2)
- return False
-
-
-def version(feature):
- """
- :param feature:
- The module, codec, or feature to check for.
- :returns:
- The version number as a string, or ``None`` if unknown or not available.
- """
- if feature in modules:
- return version_module(feature)
- if feature in codecs:
- return version_codec(feature)
|
[-]
[+]
|
Deleted |
_service:tar_git:harbour-simplecrop-1.0+main.20210420100251.4.g6bfb428.tar.bz2/lib/arm64/Pillow-7.2.0.dist-info/LICENSE
^
|
@@ -1,30 +0,0 @@
-The Python Imaging Library (PIL) is
-
- Copyright © 1997-2011 by Secret Labs AB
- Copyright © 1995-2011 by Fredrik Lundh
-
-Pillow is the friendly PIL fork. It is
-
- Copyright © 2010-2020 by Alex Clark and contributors
-
-Like PIL, Pillow is licensed under the open source PIL Software License:
-
-By obtaining, using, and/or copying this software and/or its associated
-documentation, you agree that you have read, understood, and will comply
-with the following terms and conditions:
-
-Permission to use, copy, modify, and distribute this software and its
-associated documentation for any purpose and without fee is hereby granted,
-provided that the above copyright notice appears in all copies, and that
-both that copyright notice and this permission notice appear in supporting
-documentation, and that the name of Secret Labs AB or the author not be
-used in advertising or publicity pertaining to distribution of the software
-without specific, written prior permission.
-
-SECRET LABS AB AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
-SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS.
-IN NO EVENT SHALL SECRET LABS AB OR THE AUTHOR BE LIABLE FOR ANY SPECIAL,
-INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
-LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
-OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
-PERFORMANCE OF THIS SOFTWARE.
|
[-]
[+]
|
Deleted |
_service:tar_git:harbour-simplecrop-1.0+main.20210420100251.4.g6bfb428.tar.bz2/lib/arm64/Pillow-7.2.0.dist-info/METADATA
^
|
@@ -1,135 +0,0 @@
-Metadata-Version: 2.1
-Name: Pillow
-Version: 7.2.0
-Summary: Python Imaging Library (Fork)
-Home-page: https://python-pillow.org
-Author: Alex Clark (PIL Fork Author)
-Author-email: aclark@python-pillow.org
-License: HPND
-Project-URL: Source, https://github.com/python-pillow/Pillow
-Project-URL: Funding, https://tidelift.com/subscription/pkg/pypi-pillow?utm_source=pypi-pillow&utm_medium=pypi
-Project-URL: Documentation, https://pillow.readthedocs.io
-Keywords: Imaging
-Platform: UNKNOWN
-Classifier: Development Status :: 6 - Mature
-Classifier: License :: OSI Approved :: Historical Permission Notice and Disclaimer (HPND)
-Classifier: Programming Language :: Python :: 3
-Classifier: Programming Language :: Python :: 3.5
-Classifier: Programming Language :: Python :: 3.6
-Classifier: Programming Language :: Python :: 3.7
-Classifier: Programming Language :: Python :: 3.8
-Classifier: Programming Language :: Python :: 3 :: Only
-Classifier: Programming Language :: Python :: Implementation :: CPython
-Classifier: Programming Language :: Python :: Implementation :: PyPy
-Classifier: Topic :: Multimedia :: Graphics
-Classifier: Topic :: Multimedia :: Graphics :: Capture :: Digital Camera
-Classifier: Topic :: Multimedia :: Graphics :: Capture :: Screen Capture
-Classifier: Topic :: Multimedia :: Graphics :: Graphics Conversion
-Classifier: Topic :: Multimedia :: Graphics :: Viewers
-Requires-Python: >=3.5
-
-Pillow
-======
-
-Python Imaging Library (Fork)
------------------------------
-
-Pillow is the friendly PIL fork by `Alex Clark and Contributors <https://github.com/python-pillow/Pillow/graphs/contributors>`_. PIL is the Python Imaging Library by Fredrik Lundh and Contributors. As of 2019, Pillow development is `supported by Tidelift <https://tidelift.com/subscription/pkg/pypi-pillow?utm_source=pypi-pillow&utm_medium=readme&utm_campaign=enterprise>`_.
-
-.. start-badges
-
-.. list-table::
- :stub-columns: 1
-
- * - docs
- - |docs|
- * - tests
- - |linux| |macos| |windows| |gha_lint| |gha| |gha_windows| |gha_docker| |coverage|
- * - package
- - |zenodo| |tidelift| |version| |downloads|
- * - social
- - |gitter| |twitter|
-
-.. end-badges
-
-More Information
-----------------
-
-- `Documentation <https://pillow.readthedocs.io/>`_
-
- - `Installation <https://pillow.readthedocs.io/en/latest/installation.html>`_
- - `Handbook <https://pillow.readthedocs.io/en/latest/handbook/index.html>`_
-
-- `Contribute <https://github.com/python-pillow/Pillow/blob/master/.github/CONTRIBUTING.md>`_
-
- - `Issues <https://github.com/python-pillow/Pillow/issues>`_
- - `Pull requests <https://github.com/python-pillow/Pillow/pulls>`_
-
-- `Changelog <https://github.com/python-pillow/Pillow/blob/master/CHANGES.rst>`_
-
- - `Pre-fork <https://github.com/python-pillow/Pillow/blob/master/CHANGES.rst#pre-fork>`_
-
-Report a Vulnerability
-----------------------
-
-To report a security vulnerability, please follow the procedure described in the `Tidelift security policy <https://tidelift.com/docs/security>`_.
-
-.. |docs| image:: https://readthedocs.org/projects/pillow/badge/?version=latest
- :target: https://pillow.readthedocs.io/?badge=latest
- :alt: Documentation Status
-
-.. |linux| image:: https://img.shields.io/travis/python-pillow/Pillow/master.svg?label=Linux%20build
- :target: https://travis-ci.org/python-pillow/Pillow
- :alt: Travis CI build status (Linux)
-
-.. |macos| image:: https://img.shields.io/travis/python-pillow/pillow-wheels/master.svg?label=macOS%20build
- :target: https://travis-ci.org/python-pillow/pillow-wheels
- :alt: Travis CI build status (macOS)
-
-.. |windows| image:: https://img.shields.io/appveyor/build/python-pillow/Pillow/master.svg?label=Windows%20build
- :target: https://ci.appveyor.com/project/python-pillow/Pillow
- :alt: AppVeyor CI build status (Windows)
-
-.. |gha_lint| image:: https://github.com/python-pillow/Pillow/workflows/Lint/badge.svg
- :target: https://github.com/python-pillow/Pillow/actions?query=workflow%3ALint
- :alt: GitHub Actions build status (Lint)
-
-.. |gha_docker| image:: https://github.com/python-pillow/Pillow/workflows/Test%20Docker/badge.svg
- :target: https://github.com/python-pillow/Pillow/actions?query=workflow%3A%22Test+Docker%22
- :alt: GitHub Actions build status (Test Docker)
-
-.. |gha| image:: https://github.com/python-pillow/Pillow/workflows/Test/badge.svg
- :target: https://github.com/python-pillow/Pillow/actions?query=workflow%3ATest
- :alt: GitHub Actions build status (Test Linux and macOS)
-
-.. |gha_windows| image:: https://github.com/python-pillow/Pillow/workflows/Test%20Windows/badge.svg
- :target: https://github.com/python-pillow/Pillow/actions?query=workflow%3A%22Test+Windows%22
- :alt: GitHub Actions build status (Test Windows)
-
-.. |coverage| image:: https://codecov.io/gh/python-pillow/Pillow/branch/master/graph/badge.svg
- :target: https://codecov.io/gh/python-pillow/Pillow
- :alt: Code coverage
-
-.. |zenodo| image:: https://zenodo.org/badge/17549/python-pillow/Pillow.svg
- :target: https://zenodo.org/badge/latestdoi/17549/python-pillow/Pillow
-
-.. |tidelift| image:: https://tidelift.com/badges/package/pypi/Pillow?style=flat
- :target: https://tidelift.com/subscription/pkg/pypi-pillow?utm_source=pypi-pillow&utm_medium=badge
-
-.. |version| image:: https://img.shields.io/pypi/v/pillow.svg
- :target: https://pypi.org/project/Pillow/
- :alt: Latest PyPI version
-
-.. |downloads| image:: https://img.shields.io/pypi/dm/pillow.svg
- :target: https://pypi.org/project/Pillow/
- :alt: Number of PyPI downloads
-
-.. |gitter| image:: https://badges.gitter.im/python-pillow/Pillow.svg
- :target: https://gitter.im/python-pillow/Pillow?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge
- :alt: Join the chat at https://gitter.im/python-pillow/Pillow
-
-.. |twitter| image:: https://img.shields.io/badge/tweet-on%20Twitter-00aced.svg
- :target: https://twitter.com/PythonPillow
- :alt: Follow on https://twitter.com/PythonPillow
-
-
|
[-]
[+]
|
Deleted |
_service:tar_git:harbour-simplecrop-1.0+main.20210420100251.4.g6bfb428.tar.bz2/lib/arm64/Pillow-7.2.0.dist-info/RECORD
^
|
@@ -1,118 +0,0 @@
-PIL/__init__.py,sha256=kmCZsISXCYqhkyIhg1xfddav65p4l3nNifzh6a9qgi0,3265
-PIL/PcfFontFile.py,sha256=1GCvZM86-l8OmMhxDUeL66WqrrPckTJAeKySpck99GI,6268
-PIL/IcnsImagePlugin.py,sha256=SC9TkWt0MVer-aBer5F95rD45KXL2o-mX4RJKi1m6Dk,11718
-PIL/PixarImagePlugin.py,sha256=PriyK2dGF7ecbm_ZNB6eWlL5CiVA2d0RkYw4TYS0n7Y,1647
-PIL/XVThumbImagePlugin.py,sha256=sYdEiHkRT5U8JG-VMzjTlErNUGLnMqFJxHVPheyqXgo,1948
-PIL/ImageDraw.py,sha256=SH8-SsBWk7mX66pzrYD3Jl7EMmwuLYDAXf-A1XSAcdQ,19319
-PIL/GbrImagePlugin.py,sha256=X8UAqQtyUPO3G8OUOlrYXROgsZyDZoUmXvk_RgpGLtw,2801
-PIL/PsdImagePlugin.py,sha256=KAAItucNljGjlBnTZX9PgONB7ViNCmbxbhp-8bxNqBo,7628
-PIL/ImageQt.py,sha256=p5IwMwxc2kHzwXc30bXo4fIsTBG6fzQMClIjKCCdcro,5797
-PIL/TiffImagePlugin.py,sha256=z-6FybmlNvXeP00iRw9tgGg2AZT7hwQ68oCqtVzhmIY,67498
-PIL/TgaImagePlugin.py,sha256=3j3c1DAMKDcS0GLYq0yuPuc3gF-cTyAmF52Hp5Nsdog,6268
-PIL/MicImagePlugin.py,sha256=t8iqakHjOilWVEOrjTISN2-ctxkTYSZgzmtxf4ufrfg,2606
-PIL/ImageFile.py,sha256=oPXH-sNQU1rQ6goP67ZEbFBM56SxOR-ulPhbvfZyKwQ,21015
-PIL/DcxImagePlugin.py,sha256=bfESLTji9GerqI4oYsy5oTFyRMlr2mjSsXzpY9IuLsk,2145
-PIL/FontFile.py,sha256=5LQh5Rr62fTz8rHvanAccr_oQQt8E2M_BIO0ZeG1isQ,2769
-PIL/SgiImagePlugin.py,sha256=Jn7gWyIXI5s1M8dkVKkQCp0XweWHe8mVB-YmuPx-Wx0,6100
-PIL/ImagePalette.py,sha256=O-kWUT0q1ExW-1I26uggy-jC_DaDlur9wlf9DBCMzGU,6352
-PIL/ImageColor.py,sha256=g0yVp1VyRBieKf2n18gh5w9BaveRtp5LK-4WNYmZTE8,8634
-PIL/MpegImagePlugin.py,sha256=n16Zgdy8Hcfke16lQwZWs53PZq4BA_OxPCMPDkW62nw,1803
-PIL/JpegPresets.py,sha256=59KxoMhAJGpdMtTaVSC_J7-JQgW1GtmWo5oYDP_ADII,12711
-PIL/ImtImagePlugin.py,sha256=cn60lqUVnK2oh_sPqPBORr_rZ4zuF_6FU0V96IAh8Ww,2203
-PIL/GimpGradientFile.py,sha256=G0ClRmjRHIJoU0nmG-P-tgehLHZip5i0rY4-5pjJ7bc,3353
-PIL/TarIO.py,sha256=E_pjAxk9wHezXUuR_99liySBXfJoL2wjzdNDf0g1hTo,1440
-PIL/EpsImagePlugin.py,sha256=exWRY-hn_NP2lvj7w11rHZADN-ubY93TcZ_KSkwgHts,12123
-PIL/ImageShow.py,sha256=wnLjXbmwqrc1dNi4nxfFK64yUm_imMIxboE17ql9cIc,6358
-PIL/ImageFilter.py,sha256=yyjUre0YHNOC-WRAFf060sZWnQ_JTvZxme3X-VQBEGM,15887
-PIL/_webp.cpython-35m-aarch64-linux-gnu.so,sha256=nXGcobnqQPOx_KDsbKWF15kY7MS6huHoA10KmHEylPs,84448
-PIL/PcxImagePlugin.py,sha256=zfNKKUEIdykafo44h7ylZlANBPgt_8c-W2SkakxoQc4,5483
-PIL/FpxImagePlugin.py,sha256=qn-JGrpfN_99egOSZAsCcx14RXeZaK2pKDomryEM2og,6670
-PIL/PyAccess.py,sha256=U_N4WB6yg_qpWKo1X7avE98p6Ve3bqqnWOGX6DeyE4U,9592
-PIL/_version.py,sha256=oQcbLZ3YKpJ_oyN9BngQk3RukRqCAYLYIaUNjkAnM3A,50
-PIL/SpiderImagePlugin.py,sha256=VwW-TCSjeqQ4QvhlDTKBqZPxTiHZpRTlrypRn95BTu8,9538
-PIL/ImageWin.py,sha256=WlwWoWKPkNkPCbKfjqQUsjLk3xknboqcx1rmRjBSWxI,7200
-PIL/WmfImagePlugin.py,sha256=D7kFCuEPLZcdOoGg5Ab3jGBRJiAPy6nYd0WbDfsYPp8,4612
-PIL/McIdasImagePlugin.py,sha256=LrP5nA7l8IQG3WhlMI0Xs8fGXY_uf6IDmzNCERl3tGw,1754
-PIL/Image.py,sha256=IbqOBdm0e5SaiGcu49gDCylMfZH2lSu0e5dfmF0gH80,115642
-PIL/GdImageFile.py,sha256=Ub6B3SP0BQlsBgLjZmYT68gKblXK1MPbtJynyPWez40,2487
-PIL/MpoImagePlugin.py,sha256=lbBbUp-o6xVnfaX3sQYpd7RN4-5-KHcbwi0Km2vN0eg,4244
-PIL/ImImagePlugin.py,sha256=HCwMuVW03zj9aWNbK1Sw9gfqCDRVCJ3hUKXZk3E03Ds,10825
-PIL/PcdImagePlugin.py,sha256=iBuIYSh2ff69V_DqG3yiMtvn9-wQkKkpdrmXbXYBluM,1504
-PIL/_util.py,sha256=VCm5WKSTI2hGMBDZdAY_XxBAbBYRwkKM_EbTLo0qJlc,503
-PIL/DdsImagePlugin.py,sha256=llS29X6w-oFTyflc7ta7jiFHE4PWqnHgpXlrVO-Zmgo,5466
-PIL/GimpPaletteFile.py,sha256=_wWvNmB40AfQ1M5sTxoYYXOMApWQji7rrubqZhfd1dU,1274
-PIL/XpmImagePlugin.py,sha256=BTgbV-ij_1Lw5u5yCWVOI_ZWUoif1-3AoQ0uszigrfE,3070
-PIL/PalmImagePlugin.py,sha256=SuMO5oCq1sgTFVsnJLvFRJFVAadez6UEJMbW65bjr5M,9092
-PIL/ImageCms.py,sha256=ffh825laLsZfH4Ojn9ADWbfx2Kqo2LVw3uc5UUAaqQo,36750
-PIL/BmpImagePlugin.py,sha256=zQOhwL2iIKntYKxkdLTYWO3OGqByaz4jAx9mZW0mSPw,14374
-PIL/FtexImagePlugin.py,sha256=-iysUmqEEOORhWBQCou0gqrgSwsMBqcr6qyWbrNptSE,3307
-PIL/_imagingtk.cpython-35m-aarch64-linux-gnu.so,sha256=FxCHswbmSqXv-GHy7wfx05KfcBUMEs1I572WYnz-Tfw,67816
-PIL/PaletteFile.py,sha256=s3KtsDuY5S04MKDyiXK3iIbiOGzV9PvCDUpOQHI7yqc,1106
-PIL/PSDraw.py,sha256=zySuABiEoP2TW_7DypJaS9ByWpxqPjmP43gCjXOghRA,6735
-PIL/ImageEnhance.py,sha256=CJnCouiBmxN2fE0xW7m_uMdBqcm-Fp0S3ruHhkygal4,3190
-PIL/ImageSequence.py,sha256=3djA7vDH6wafTGbt4e_lPlVhy2TaKfdSrA1XQ4n-Uoc,1850
-PIL/IptcImagePlugin.py,sha256=gs12EAOvOWaVYrv_LAZAlqhX_OsedSZom90MWQFNAmQ,5670
-PIL/_binary.py,sha256=M_yObPVR_1rxnS5craSJsSbFJMykMYqJ0vNHeUpAmj4,1793
-PIL/BlpImagePlugin.py,sha256=haYEEl_DnCGzbSICvTjxRKRq93j1BJ49D6rON3VoMSE,14296
-PIL/_imagingmath.cpython-35m-aarch64-linux-gnu.so,sha256=HvdbKotqkDxGghVXwkKo0a2OccklsuZDSJEoT99Aa3Q,67776
-PIL/GifImagePlugin.py,sha256=Y-skmIQinP0W2pOMbEuUBolzZqt0EQX6MV09XuYPkpw,28872
-PIL/PdfImagePlugin.py,sha256=sS6VL5uZvipBn3gkPEA8qEpb3gaKtNxhH6sHia11x4o,7574
-PIL/ImageOps.py,sha256=Mm8dmGeaUJx2V3LViRO_yUNJA7I_tLtxf99kJitU-0M,18022
-PIL/JpegImagePlugin.py,sha256=DUUQ9SW01fVj1W3O7nEj8-EJJ1MpVgoor1M-k9aFdZU,27898
-PIL/ImageMath.py,sha256=olaAaE7xJORKmQgQsfD7EhGREseKBZz7u4_zVW6WOdk,7054
-PIL/_imagingcms.cpython-35m-aarch64-linux-gnu.so,sha256=XozEviIk4whsfGtsgM1eVR2_YVEcx13Jfu2Gfhqq29c,82112
-PIL/PpmImagePlugin.py,sha256=YrtSj-K7XQjb1dW7Y8G6I21-xXAVJ4YqPuNwOJosVTE,4451
-PIL/ImageMorph.py,sha256=S_ZN_u6QwmqphSnv6iqobbqv1-CKxNGNJqSQ7i8MyrM,7896
-PIL/ImageStat.py,sha256=PieQi44mRHE6jod7NqujwGr6WCntuZuNGmC2z9PaoDY,3901
-PIL/TiffTags.py,sha256=Kl6hB2v-IT-h01P_5aBafrsO1AIA0JxJI7fNJvQCuhk,14551
-PIL/ImageTransform.py,sha256=V2l6tsjmymMIF7HQBMI21UPn4mlicarrm4NF3Kazvio,2843
-PIL/ImageChops.py,sha256=XxYMb9xWRFF6N2nUcBrWdpZLTJhog9G0dKbepFaWVBQ,7309
-PIL/BufrStubImagePlugin.py,sha256=Zq60GwcqQJTmZJrA9EQq94QvYpNqwYvQzHojh4U7SDw,1520
-PIL/PdfParser.py,sha256=TQtymvzfdjrdYXYrVJ_ntM5A7rBqyDqLF-FQX26kcGE,34422
-PIL/SunImagePlugin.py,sha256=OYiU1zBBlN_lNqoGpxAPuZDDyBm31A_-Ck_wul7vIv8,4302
-PIL/_imagingmorph.cpython-35m-aarch64-linux-gnu.so,sha256=htq7naafMf1sZg8TI_VPvrYv6-IoWiR9FteBTDY8G7k,67824
-PIL/WalImageFile.py,sha256=Mfwtpwi-CgRKGORZbdc35uVG0XdelIEIafmtzh0aTKw,5531
-PIL/BdfFontFile.py,sha256=hRnSgFZOIiTgWfJIaRHRQpU4TKVok2E31KJY6sbZPwc,2817
-PIL/ImageGrab.py,sha256=DdO1jppfTiwF4XtTLZ_dTeZm9flgOim4n3Hfk_rhpec,3625
-PIL/ImageTk.py,sha256=LqiRd0wkODL-7GI4gZm2fAlmtUDw7keLZj_dtRmqug8,9328
-PIL/ImageFont.py,sha256=4nv8YNcE-IGYWwESeBmQvK6Ii_OGzv1FjspGi5FOqfQ,36077
-PIL/ContainerIO.py,sha256=1U15zUXjWO8uWK-MyCp66Eh7djQEU-oUeCDoBqewNkA,2883
-PIL/FitsStubImagePlugin.py,sha256=8Zq2D9ReJE-stBppxB_ELX3wxcS0_BDGg6Xce7sWpaU,1624
-PIL/XbmImagePlugin.py,sha256=rCNKI-dem3N-NIvRvepuQ9MzAWkSWS7C5FNpNInYfOg,2448
-PIL/ImagePath.py,sha256=lVmH1-lCd0SyrFoqyhlstAFW2iJuC14fPcW8iewvxCQ,336
-PIL/IcoImagePlugin.py,sha256=BrFX4_d-HBe0Sn6htQNX5V3LI-HxZnW9QGYG9t3yr7A,10134
-PIL/PngImagePlugin.py,sha256=jAwolRtePqHwCUd-a65p1mM7n4KZN_yHzlmuIHQzE-o,41790
-PIL/features.py,sha256=56xvqPTkaGDpeVBfIu38yQBxZE6cMe88QG-UPcptfbk,8826
-PIL/WebPImagePlugin.py,sha256=RKHtxgrWjuxN1fQF8AX0ckl3cEJkltOiKJrHYh--gk4,10795
-PIL/_tkinter_finder.py,sha256=H8lIY9JyNwACYSmxnPRyGwqSoolSxBoE_zMbQEmbe-o,622
-PIL/_imaging.cpython-35m-aarch64-linux-gnu.so,sha256=8P2Rzjsx-5f1J9cS63D3hXr9A-XnDJFK_ByBpgyv5c4,612256
-PIL/ExifTags.py,sha256=fx7S0CnztT9ptHT2HGuMYteI99CMVrD73IHeRI5OFjU,9009
-PIL/MspImagePlugin.py,sha256=UlkKUCM7D0ZZZW-iSwsQxUrh44DOsTwjXLHzUhUPeZM,5530
-PIL/Jpeg2KImagePlugin.py,sha256=3NAbqBmvSU_fHUIGspXFsVQV7uYMydN2Rj8jP2bGdiA,8722
-PIL/Hdf5StubImagePlugin.py,sha256=zjtFPZIcVkWXvYRPnHow6XA9kElEi772w7PFSuEqmq4,1517
-PIL/ImageDraw2.py,sha256=oBhpBTZhx3bd4D0s8E2kDjBzgThRkDU_TE_987l501k,5019
-PIL/__main__.py,sha256=axR7PO-HtXp-o0rBhKIxs0wark0rBfaDIhAIWqtWUo4,41
-PIL/ImageMode.py,sha256=gI88wDgAc4y-m46vTA4zPmipG12wpYLNXPRHyPZBZaY,1638
-PIL/CurImagePlugin.py,sha256=zhFOIWO0Id1kDqO3bL-6P27Y142mseLx9eOzsWs2hyQ,1681
-PIL/FliImagePlugin.py,sha256=fl-3mUGENpHSpI0NxJ7PzOOuS7vPtZgjnUipSWnX0rU,4272
-PIL/GribStubImagePlugin.py,sha256=gtLF7drAx66O9OOE_lJ1GgtLzjULoQDzFWT0sms7l98,1543
-PIL/_imagingft.cpython-35m-aarch64-linux-gnu.so,sha256=_JDgqMn2NQfZhZUFqgT5NNjfW6Xb9hXBnZvcdO4SIuA,81696
-Pillow-7.2.0.dist-info/WHEEL,sha256=QOfWDvEDmo10x26xaxGzdbPkcBGwpJkl5xUunBgAn10,113
-Pillow-7.2.0.dist-info/RECORD,,
-Pillow-7.2.0.dist-info/METADATA,sha256=dNEm_37p28ITb7psMJHVGCcrV5ViAbxKEnLLopkBQWI,5966
-Pillow-7.2.0.dist-info/top_level.txt,sha256=riZqrk-hyZqh5f1Z0Zwii3dKfxEsByhu9cU9IODF-NY,4
-Pillow-7.2.0.dist-info/LICENSE,sha256=N95Cq-M6JH6PA9IxNleg8XSiOaGY9Sat1lRP8-JkO4E,1452
-Pillow-7.2.0.dist-info/zip-safe,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
-Pillow.libs/libwebpmux-113e9fec.so.3.0.5,sha256=kdvoZRrSeSgwvyL1roxFLg1pLf-ULfcTXdYFcjgJWOQ,79040
-Pillow.libs/libpng16-91e3a340.so.16.37.0,sha256=GQx8kap3ANLx5zCIGiUcAvQjkdq3p2CqP67LTENAo0c,345368
-Pillow.libs/libwebpdemux-d8ede030.so.2.0.6,sha256=pfifQ0k8UAZulZD9YY1QsLlZBp_GAPzdfN9VyD4ejq4,78624
-Pillow.libs/libxcb-ce05b0d3.so.1.1.0,sha256=_jWw8YHqpbd-eWjLUNNfNOkmsKibIX36QVNSNtqMn2w,308760
-Pillow.libs/liblcms2-d13186b2.so.2.0.10,sha256=9hnqzqu1ocZl6WhY_wF7n5wNoL9EI49CCh5RUerfevg,489976
-Pillow.libs/liblzma-c28580a1.so.5.2.2,sha256=i8ALozWZyhaNsXZdtZ5R5904Xh3AKpNSRxsZicUgVro,208512
-Pillow.libs/libz-558a5e64.so.1.2.7,sha256=Szt3llbSrucXEhltDH5djUN9F63DR8qfVGFU1l6F7O8,141336
-Pillow.libs/libwebp-85499e5a.so.7.1.0,sha256=vDtM78c5TBydo9DdZ2B_-4FAqTm9TO4xEM23vULkMVk,531104
-Pillow.libs/libXau-21870672.so.6.0.0,sha256=FI4k8hWwNewsSOeG1-yCTyLiIKTIFDrR-UvBFbcw9aM,70424
-Pillow.libs/libjpeg-166ca757.so.9.4.0,sha256=7IPh3goAlT3rrn8izTTdQkuBjnIJZSf75MED1n4xN0Q,270952
-Pillow.libs/libfreetype-58427440.so.6.17.2,sha256=zqEdKhcwg5MHo6MIF5iI_TMzlj3QEyT0E_t9xEuo6Us,1483712
-Pillow.libs/libtiff-4cf5e268.so.5.5.0,sha256=R7L8s9w2EynohcBWaXBNN3H6Q5phEEd7s-ZIT7vbbmk,702160
-Pillow.libs/libopenjp2-2fc03407.so.2.3.1,sha256=Q_YSIBCFBXe_4r5hRe1nDTLCHjGi_wp6nyEh6FPvnNQ,536456
|
[-]
[+]
|
Deleted |
_service:tar_git:harbour-simplecrop-1.0+main.20210420100251.4.g6bfb428.tar.bz2/lib/arm64/Pillow-7.2.0.dist-info/WHEEL
^
|
@@ -1,5 +0,0 @@
-Wheel-Version: 1.0
-Generator: bdist_wheel (0.34.2)
-Root-Is-Purelib: false
-Tag: cp35-cp35m-manylinux2014_aarch64
-
|
[-]
[+]
|
Deleted |
_service:tar_git:harbour-simplecrop-1.0+main.20210420100251.4.g6bfb428.tar.bz2/lib/arm64/Pillow-7.2.0.dist-info/top_level.txt
^
|
@@ -1 +0,0 @@
-PIL
|
[-]
[+]
|
Deleted |
_service:tar_git:harbour-simplecrop-1.0+main.20210420100251.4.g6bfb428.tar.bz2/lib/arm64/Pillow-7.2.0.dist-info/zip-safe
^
|
@@ -1 +0,0 @@
-
|
|
Deleted |
_service:tar_git:harbour-simplecrop-1.0+main.20210420100251.4.g6bfb428.tar.bz2/lib/arm64/Pillow.libs/libXau-21870672.so.6.0.0
^
|
|
Deleted |
_service:tar_git:harbour-simplecrop-1.0+main.20210420100251.4.g6bfb428.tar.bz2/lib/arm64/Pillow.libs/libfreetype-58427440.so.6.17.2
^
|
|
Deleted |
_service:tar_git:harbour-simplecrop-1.0+main.20210420100251.4.g6bfb428.tar.bz2/lib/arm64/Pillow.libs/libjpeg-166ca757.so.9.4.0
^
|
|
Deleted |
_service:tar_git:harbour-simplecrop-1.0+main.20210420100251.4.g6bfb428.tar.bz2/lib/arm64/Pillow.libs/liblcms2-d13186b2.so.2.0.10
^
|
|
Deleted |
_service:tar_git:harbour-simplecrop-1.0+main.20210420100251.4.g6bfb428.tar.bz2/lib/arm64/Pillow.libs/liblzma-c28580a1.so.5.2.2
^
|
|
Deleted |
_service:tar_git:harbour-simplecrop-1.0+main.20210420100251.4.g6bfb428.tar.bz2/lib/arm64/Pillow.libs/libopenjp2-2fc03407.so.2.3.1
^
|
|
Deleted |
_service:tar_git:harbour-simplecrop-1.0+main.20210420100251.4.g6bfb428.tar.bz2/lib/arm64/Pillow.libs/libpng16-91e3a340.so.16.37.0
^
|
|
Deleted |
_service:tar_git:harbour-simplecrop-1.0+main.20210420100251.4.g6bfb428.tar.bz2/lib/arm64/Pillow.libs/libtiff-4cf5e268.so.5.5.0
^
|
|
Deleted |
_service:tar_git:harbour-simplecrop-1.0+main.20210420100251.4.g6bfb428.tar.bz2/lib/arm64/Pillow.libs/libwebp-85499e5a.so.7.1.0
^
|
|
Deleted |
_service:tar_git:harbour-simplecrop-1.0+main.20210420100251.4.g6bfb428.tar.bz2/lib/arm64/Pillow.libs/libwebpdemux-d8ede030.so.2.0.6
^
|
|
Deleted |
_service:tar_git:harbour-simplecrop-1.0+main.20210420100251.4.g6bfb428.tar.bz2/lib/arm64/Pillow.libs/libwebpmux-113e9fec.so.3.0.5
^
|
|
Deleted |
_service:tar_git:harbour-simplecrop-1.0+main.20210420100251.4.g6bfb428.tar.bz2/lib/arm64/Pillow.libs/libxcb-ce05b0d3.so.1.1.0
^
|
|
Deleted |
_service:tar_git:harbour-simplecrop-1.0+main.20210420100251.4.g6bfb428.tar.bz2/lib/arm64/Pillow.libs/libz-558a5e64.so.1.2.7
^
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-simplecrop-1.0.tar.bz2/harbour-simplecrop.pro
^
|
@@ -75,11 +75,11 @@
DISTFILES += lib/arm32/PIL/* \
message("!!!architecture armv7hl detected!!!");
}
-equals(QT_ARCH, arm64): {
- python.files = lib/arm64/*
- DISTFILES += lib/arm64/PIL/* \
- message("!!!architecture aa64 detected!!!");
-}
+#equals(QT_ARCH, arm64): {
+# python.files = lib/arm32/*
+# DISTFILES += lib/arm32/PIL/* \
+# message("!!!architecture armv7hl detected!!!");
+#}
python.path = "/usr/share/harbour-simplecrop/lib"
INSTALLS += python
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-simplecrop-1.0.tar.bz2/qml/pages/AboutPage.qml
^
|
@@ -68,30 +68,15 @@
font.pixelSize: Theme.fontSizeSmall
color: Theme.secondaryColor
wrapMode: Text.WrapAtWordBoundaryOrAnywhere
- text: qsTr("Imageworks is open source software licensed under the terms of ")
- + qsTr("the GNU General Public License v3.")
+ text: qsTr("Tidings is open source software licensed under the terms of ")
+ + qsTr("the GNU General Public License.")
}
- Item {
+ /*Item {
width: 1
height: 2 * Theme.paddingLarge
}
- Label {
- anchors.horizontalCenter: parent.horizontalCenter
- anchors.bottomMargin: Theme.paddingSmall
- color: Theme.secondaryColor
- textFormat: Text.StyledText
- linkColor: Theme.highlightColor
- font.pixelSize: Theme.fontSizeSmall
- text: "<a href=\"https://github.com/poetaster/harbour-simplecrop\">Source: github</a>"
- /*text: "<style>a:link{color: " + Theme.highlightColor + ";}</style>" + "<a href=\"https://github.com/poetaster/harbour-simplecrop\">Source: github</a>" */
- onLinkActivated: {
- console.log("Opening external browser: " + link);
- Qt.openUrlExternally(link)
- }
- }
- /*
Button {
anchors.horizontalCenter: parent.horizontalCenter
text: qsTr("View license")
@@ -101,4 +86,14 @@
}*/
}
+
+ Label {
+ anchors.horizontalCenter: parent.horizontalCenter
+ anchors.bottom: parent.bottom
+ anchors.bottomMargin: Theme.paddingSmall
+ color: Theme.secondaryColor
+ font.pixelSize: Theme.fontSizeTiny
+ text: "https://github.com/poetaster/harbour-simplecrop"
+ }
+
}
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-simplecrop-1.0.tar.bz2/qml/pages/FirstPage.qml
^
|
@@ -25,8 +25,8 @@
property string origImageFilePath : ""
property string origImageFileName
property string origImageFolderPath
- property string tempImageFolderPath
- property string saveImageFolderPath
+ property string tempImageFolderPath //: "/home" + "/defaultuser" + "/.imageworks_tmp/"
+ property string saveImageFolderPath //: "/home" + "/defaultuser" + "/Pictures" + "/Imageworks/"
property string symbolSourceFolder: "/usr" + "/share" + "/harbour-simplecrop" + "/qml" + "/symbols/"
property string filterSourceFolder: "/usr" + "/share" + "/harbour-simplecrop" + "/qml" + "/filters/"
property string fontSourceFolder: "/usr" + "/share" + "/harbour-simplecrop" + "/qml" + "/fonts/"
@@ -262,11 +262,11 @@
// Handlers = Signals to do something in QML whith received Infos from pyotherside
setHandler('homePathFolder', function( homeDir ) {
- tempImageFolderPath = homeDir + "/.cache/harbour-simplecrop/"
+ tempImageFolderPath = homeDir + "/.imageworks_tmp/"
saveImageFolderPath = homeDir + "/Pictures" + "/Imageworks/"
homeDirectory = homeDir
- py.createTmpAndSaveFolder(tempImageFolderPath, saveImageFolderPath)
- py.deleteAllTMPFunction(tempImageFolderPath)
+ py.createTmpAndSaveFolder()
+ py.deleteAllTMPFunction()
py.deleteCopyPasteImage()
});
setHandler('exchangeImage', function(new_imagePath) {
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-simplecrop-1.0.tar.bz2/qml/py/graphx.py
^
|
@@ -43,6 +43,9 @@
from PIL import ExifTags
from io import BytesIO
+
+
+
def argb2rgba ( paintColor ) :
first2 = paintColor[1:3]
last6 = paintColor[3:9]
@@ -81,6 +84,10 @@
img.close()
output_img.close()
+
+
+
+
def cropNowFunction ( inputPathPy, outputPathPy, rectX, rectY, rectWidth, rectHeight, scaleFactor, undoNr ):
img = Image.open(inputPathPy)
img = ImageOps.exif_transpose(img)
@@ -95,6 +102,7 @@
img.close()
output_img.close()
+
def cropCoordinatesFunction ( inputPathPy, outputPathPy, rectX, rectY, rectWidth, rectHeight, undoNr ):
img = Image.open(inputPathPy)
img = ImageOps.exif_transpose(img)
@@ -109,6 +117,7 @@
img.close()
output_img.close()
+
def cropCanvasPolygonFunction( inputPathPy, outputPathPy, freeDrawPolyCoordinates, scaleFactor, paintColor, actionSelection ):
img = Image.open(inputPathPy)
img = ImageOps.exif_transpose(img)
@@ -198,6 +207,8 @@
+
+
def rotateLeftFunction ( inputPathPy, outputPathPy ):
img = Image.open(inputPathPy)
img = ImageOps.exif_transpose(img)
@@ -207,6 +218,7 @@
img.close()
output_img.close()
+
def mirrorHorizontalFunction ( inputPathPy, outputPathPy ):
img = Image.open(inputPathPy)
img = ImageOps.exif_transpose(img)
@@ -216,6 +228,7 @@
img.close()
output_img.close()
+
def mirrorVerticalFunction ( inputPathPy, outputPathPy ):
img = Image.open(inputPathPy)
img = ImageOps.exif_transpose(img)
@@ -3069,6 +3082,10 @@
+
+
+
+
|
|
Changed |
_service:tar_git:harbour-simplecrop-1.0.tar.bz2/screenshot-01.png
^
|
|
Changed |
_service:tar_git:harbour-simplecrop-1.0.tar.bz2/screenshot-03.png
^
|
|
Changed |
_service:tar_git:harbour-simplecrop-1.0.tar.bz2/screenshot-12.png
^
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-simplecrop-1.0.tar.bz2/translations/harbour-simplecrop.ts
^
|
@@ -20,11 +20,11 @@
<translation type="unfinished"></translation>
</message>
<message>
- <source>Imageworks is open source software licensed under the terms of </source>
+ <source>Tidings is open source software licensed under the terms of </source>
<translation type="unfinished"></translation>
</message>
<message>
- <source>the GNU General Public License v3.</source>
+ <source>the GNU General Public License.</source>
<translation type="unfinished"></translation>
</message>
</context>
|