Linux ns1.utparral.edu.mx 6.8.0-79-generic #79~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Fri Aug 15 16:54:53 UTC 2 x86_64
Apache/2.4.58 (Unix) OpenSSL/1.1.1w PHP/8.2.12 mod_perl/2.0.12 Perl/v5.34.1
: 10.10.1.9 | : 10.10.1.254
Cant Read [ /etc/named.conf ]
daemon
Terminal
AUTO ROOT
Adminer
Backdoor Destroyer
Linux Exploit
Lock Shell
Lock File
Create User
README
+ Create Folder
+ Create File
/
usr /
lib /
python3 /
dist-packages /
PIL /
[ HOME SHELL ]
Name
Size
Permission
Action
__pycache__
[ DIR ]
drwxr-xr-x
BdfFontFile.py
2.75
KB
-rw-r--r--
_binary.py
2
KB
-rw-r--r--
BlpImagePlugin.py
14.23
KB
-rw-r--r--
BmpImagePlugin.py
13.91
KB
-rw-r--r--
BufrStubImagePlugin.py
1.48
KB
-rw-r--r--
ContainerIO.py
2.82
KB
-rw-r--r--
CurImagePlugin.py
1.64
KB
-rw-r--r--
DcxImagePlugin.py
2.09
KB
-rw-r--r--
DdsImagePlugin.py
7.8
KB
-rw-r--r--
EpsImagePlugin.py
11.64
KB
-rw-r--r--
ExifTags.py
9.22
KB
-rw-r--r--
features.py
9.17
KB
-rw-r--r--
FitsStubImagePlugin.py
2.5
KB
-rw-r--r--
FliImagePlugin.py
4.16
KB
-rw-r--r--
FontFile.py
2.7
KB
-rw-r--r--
FpxImagePlugin.py
6.5
KB
-rw-r--r--
FtexImagePlugin.py
3.23
KB
-rw-r--r--
GbrImagePlugin.py
2.73
KB
-rw-r--r--
GdImageFile.py
2.41
KB
-rw-r--r--
GifImagePlugin.py
32.05
KB
-rw-r--r--
GimpGradientFile.py
3.27
KB
-rw-r--r--
GimpPaletteFile.py
1.24
KB
-rw-r--r--
GribStubImagePlugin.py
1.48
KB
-rw-r--r--
Hdf5StubImagePlugin.py
1.48
KB
-rw-r--r--
IcnsImagePlugin.py
11.46
KB
-rw-r--r--
IcoImagePlugin.py
10.57
KB
-rw-r--r--
ImageChops.py
7.13
KB
-rw-r--r--
ImageCms.py
36.22
KB
-rw-r--r--
ImageColor.py
8.52
KB
-rw-r--r--
ImageDraw2.py
4.9
KB
-rw-r--r--
ImageDraw.py
33.9
KB
-rw-r--r--
ImageEnhance.py
3.12
KB
-rw-r--r--
ImageFile.py
20.58
KB
-rw-r--r--
ImageFilter.py
15.75
KB
-rw-r--r--
ImageFont.py
44.29
KB
-rw-r--r--
ImageGrab.py
3.54
KB
-rw-r--r--
ImageMath.py
7.44
KB
-rw-r--r--
ImageMode.py
2.03
KB
-rw-r--r--
ImageMorph.py
7.59
KB
-rw-r--r--
ImageOps.py
19.82
KB
-rw-r--r--
ImagePalette.py
7.66
KB
-rw-r--r--
ImagePath.py
336
B
-rw-r--r--
Image.py
118.51
KB
-rw-r--r--
ImageQt.py
6.54
KB
-rw-r--r--
ImageSequence.py
1.81
KB
-rw-r--r--
ImageShow.py
7.75
KB
-rw-r--r--
ImageStat.py
3.81
KB
-rw-r--r--
ImageTransform.py
2.78
KB
-rw-r--r--
ImageWin.py
7.02
KB
-rw-r--r--
_imagingcms.cpython-310-x86_64-linux-gnu.so
37.8
KB
-rw-r--r--
_imaging.cpython-310-x86_64-linux-gnu.so
438.53
KB
-rw-r--r--
_imagingft.cpython-310-x86_64-linux-gnu.so
41.46
KB
-rw-r--r--
_imagingmath.cpython-310-x86_64-linux-gnu.so
18.43
KB
-rw-r--r--
_imagingmorph.cpython-310-x86_64-linux-gnu.so
14.46
KB
-rw-r--r--
ImImagePlugin.py
10.48
KB
-rw-r--r--
ImtImagePlugin.py
2.15
KB
-rw-r--r--
__init__.py
1.7
KB
-rw-r--r--
IptcImagePlugin.py
5.58
KB
-rw-r--r--
Jpeg2KImagePlugin.py
10.14
KB
-rw-r--r--
JpegImagePlugin.py
27.79
KB
-rw-r--r--
JpegPresets.py
12.06
KB
-rw-r--r--
__main__.py
41
B
-rw-r--r--
McIdasImagePlugin.py
1.71
KB
-rw-r--r--
MicImagePlugin.py
2.55
KB
-rw-r--r--
MpegImagePlugin.py
1.76
KB
-rw-r--r--
MpoImagePlugin.py
4.3
KB
-rw-r--r--
MspImagePlugin.py
5.4
KB
-rw-r--r--
PaletteFile.py
1.08
KB
-rw-r--r--
PalmImagePlugin.py
8.89
KB
-rw-r--r--
PcdImagePlugin.py
1.44
KB
-rw-r--r--
PcfFontFile.py
6.2
KB
-rw-r--r--
PcxImagePlugin.py
5.73
KB
-rw-r--r--
PdfImagePlugin.py
7.16
KB
-rw-r--r--
PdfParser.py
33.75
KB
-rw-r--r--
PixarImagePlugin.py
1.59
KB
-rw-r--r--
PngImagePlugin.py
43.11
KB
-rw-r--r--
PpmImagePlugin.py
4.34
KB
-rw-r--r--
PsdImagePlugin.py
7.88
KB
-rw-r--r--
PSDraw.py
6.56
KB
-rw-r--r--
PyAccess.py
9.38
KB
-rw-r--r--
SgiImagePlugin.py
5.95
KB
-rw-r--r--
SpiderImagePlugin.py
9.31
KB
-rw-r--r--
SunImagePlugin.py
4.18
KB
-rw-r--r--
TarIO.py
1.41
KB
-rw-r--r--
TgaImagePlugin.py
6.32
KB
-rw-r--r--
TiffImagePlugin.py
71.17
KB
-rw-r--r--
TiffTags.py
14.93
KB
-rw-r--r--
_tkinter_finder.py
525
B
-rw-r--r--
_util.py
359
B
-rw-r--r--
_version.py
50
B
-rw-r--r--
WalImageFile.py
5.42
KB
-rw-r--r--
_webp.cpython-310-x86_64-linux-gnu.so
28.09
KB
-rw-r--r--
WebPImagePlugin.py
10.58
KB
-rw-r--r--
WmfImagePlugin.py
4.53
KB
-rw-r--r--
XbmImagePlugin.py
2.37
KB
-rw-r--r--
XpmImagePlugin.py
2.99
KB
-rw-r--r--
XVThumbImagePlugin.py
1.89
KB
-rw-r--r--
Delete
Unzip
Zip
${this.title}
Close
Code Editor : ImagePalette.py
# # 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 import warnings 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. The list must consist of all channels for one color followed by the next color (e.g. RGBRGBRGB). Defaults to an empty palette. :param size: An optional palette size. If given, an error is raised if ``palette`` is not of equal length. """ 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() self.dirty = None if size != 0: warnings.warn( "The size parameter is deprecated and will be removed in Pillow 10 " "(2023-07-01).", DeprecationWarning, ) if size != len(self.palette): raise ValueError("wrong palette size") @property def palette(self): return self._palette @palette.setter def palette(self, palette): self._palette = palette mode_len = len(self.mode) self.colors = {} for i in range(0, len(self.palette), mode_len): color = tuple(self.palette[i : i + mode_len]) if color in self.colors: continue self.colors[color] = i // mode_len def copy(self): new = ImagePalette() new.mode = self.mode new.rawmode = self.rawmode if self.palette is not None: new.palette = self.palette[:] 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, 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) return arr.tobytes() # Declare tostring as an alias for tobytes tostring = tobytes def getcolor(self, color, image=None): """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): if self.mode == "RGB": if len(color) == 4 and color[3] == 255: color = color[:3] elif self.mode == "RGBA": if len(color) == 3: color += (255,) try: return self.colors[color] except KeyError as e: # allocate new color slot if not isinstance(self.palette, bytearray): self._palette = bytearray(self.palette) index = len(self.palette) // 3 special_colors = () if image: special_colors = ( image.info.get("background"), image.info.get("transparency"), ) while index in special_colors: index += 1 if index >= 256: if image: # Search for an unused index for i, count in reversed(list(enumerate(image.histogram()))): if count == 0 and i not in special_colors: index = i break if index >= 256: raise ValueError("cannot allocate more than 256 colors") from e self.colors[color] = index if index * 3 < len(self.palette): self._palette = ( self.palette[: index * 3] + bytes(color) + self.palette[index * 3 + 3 :] ) else: self._palette += bytes(color) self.dirty = 1 return index else: raise ValueError(f"unknown color specifier: {repr(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(f"# Mode: {self.mode}\n") for i in range(256): fp.write(f"{i}") for j in range(i * len(self.mode), (i + 1) * len(self.mode)): try: fp.write(f" {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 * len(mode))) palette.reverse() return ImagePalette(mode, [i // len(mode) for i in palette]) 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"): bands = [make_linear_lut(0, band) for band in ImageColor.getrgb(white)] return ImagePalette("RGB", [bands[i % 3][i // 3] for i in range(256 * 3)]) def wedge(mode="RGB"): palette = list(range(256 * len(mode))) return ImagePalette(mode, [i // len(mode) for i in palette]) def load(filename): # FIXME: supports GIMP gradients only with open(filename, "rb") as fp: for paletteHandler in [ GimpPaletteFile.GimpPaletteFile, GimpGradientFile.GimpGradientFile, PaletteFile.PaletteFile, ]: try: fp.seek(0) lut = paletteHandler(fp).getpalette() if lut: break except (SyntaxError, ValueError): # import traceback # traceback.print_exc() pass else: raise OSError("cannot load palette") return lut # data, rawmode
Close