mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-01-26 17:24:31 +03:00
Merge branch 'main' into comprehensions
This commit is contained in:
commit
9601102724
2
.github/workflows/wheels-dependencies.sh
vendored
2
.github/workflows/wheels-dependencies.sh
vendored
|
@ -22,7 +22,7 @@ JPEGTURBO_VERSION=3.0.1
|
||||||
OPENJPEG_VERSION=2.5.0
|
OPENJPEG_VERSION=2.5.0
|
||||||
XZ_VERSION=5.4.5
|
XZ_VERSION=5.4.5
|
||||||
TIFF_VERSION=4.6.0
|
TIFF_VERSION=4.6.0
|
||||||
LCMS2_VERSION=2.15
|
LCMS2_VERSION=2.16
|
||||||
if [[ -n "$IS_MACOS" ]]; then
|
if [[ -n "$IS_MACOS" ]]; then
|
||||||
GIFLIB_VERSION=5.1.4
|
GIFLIB_VERSION=5.1.4
|
||||||
else
|
else
|
||||||
|
|
|
@ -5,10 +5,13 @@ Changelog (Pillow)
|
||||||
10.2.0 (unreleased)
|
10.2.0 (unreleased)
|
||||||
-------------------
|
-------------------
|
||||||
|
|
||||||
|
- Correct PDF palette size when saving #7555
|
||||||
|
[radarhere]
|
||||||
|
|
||||||
- Fixed closing file pointer with olefile 0.47 #7594
|
- Fixed closing file pointer with olefile 0.47 #7594
|
||||||
[radarhere]
|
[radarhere]
|
||||||
|
|
||||||
- Raise ValueError when TrueType font size is not greater than zero #7584
|
- Raise ValueError when TrueType font size is not greater than zero #7584, #7587
|
||||||
[akx, radarhere]
|
[akx, radarhere]
|
||||||
|
|
||||||
- If absent, do not try to close fp when closing image #7557
|
- If absent, do not try to close fp when closing image #7557
|
||||||
|
|
|
@ -175,7 +175,7 @@ Many of Pillow's features require external libraries:
|
||||||
* **littlecms** provides color management
|
* **littlecms** provides color management
|
||||||
|
|
||||||
* Pillow version 2.2.1 and below uses liblcms1, Pillow 2.3.0 and
|
* Pillow version 2.2.1 and below uses liblcms1, Pillow 2.3.0 and
|
||||||
above uses liblcms2. Tested with **1.19** and **2.7-2.15**.
|
above uses liblcms2. Tested with **1.19** and **2.7-2.16**.
|
||||||
|
|
||||||
* **libwebp** provides the WebP format.
|
* **libwebp** provides the WebP format.
|
||||||
|
|
||||||
|
|
|
@ -188,6 +188,10 @@ class FreeTypeFont:
|
||||||
def __init__(self, font=None, size=10, index=0, encoding="", layout_engine=None):
|
def __init__(self, font=None, size=10, index=0, encoding="", layout_engine=None):
|
||||||
# FIXME: use service provider instead
|
# FIXME: use service provider instead
|
||||||
|
|
||||||
|
if size <= 0:
|
||||||
|
msg = "font size must be greater than 0"
|
||||||
|
raise ValueError(msg)
|
||||||
|
|
||||||
self.path = font
|
self.path = font
|
||||||
self.size = size
|
self.size = size
|
||||||
self.index = index
|
self.index = index
|
||||||
|
@ -791,10 +795,6 @@ def truetype(font=None, size=10, index=0, encoding="", layout_engine=None):
|
||||||
:exception ValueError: If the font size is not greater than zero.
|
:exception ValueError: If the font size is not greater than zero.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
if size <= 0:
|
|
||||||
msg = "font size must be greater than 0"
|
|
||||||
raise ValueError(msg)
|
|
||||||
|
|
||||||
def freetype(font):
|
def freetype(font):
|
||||||
return FreeTypeFont(font, size, index, encoding, layout_engine)
|
return FreeTypeFont(font, size, index, encoding, layout_engine)
|
||||||
|
|
||||||
|
|
|
@ -21,9 +21,7 @@
|
||||||
# See the README file for information on usage and redistribution.
|
# See the README file for information on usage and redistribution.
|
||||||
#
|
#
|
||||||
|
|
||||||
import functools
|
|
||||||
import math
|
import math
|
||||||
import operator
|
|
||||||
|
|
||||||
|
|
||||||
class Stat:
|
class Stat:
|
||||||
|
@ -65,10 +63,7 @@ class Stat:
|
||||||
|
|
||||||
def _getcount(self):
|
def _getcount(self):
|
||||||
"""Get total number of pixels in each layer"""
|
"""Get total number of pixels in each layer"""
|
||||||
return [
|
return [sum(self.h[i : i + 256]) for i in range(0, len(self.h), 256)]
|
||||||
functools.reduce(operator.add, self.h[i : i + 256])
|
|
||||||
for i in range(0, len(self.h), 256)
|
|
||||||
]
|
|
||||||
|
|
||||||
def _getsum(self):
|
def _getsum(self):
|
||||||
"""Get sum of all pixels in each layer"""
|
"""Get sum of all pixels in each layer"""
|
||||||
|
|
|
@ -96,7 +96,7 @@ def _write_image(im, filename, existing_pdf, image_refs):
|
||||||
dict_obj["ColorSpace"] = [
|
dict_obj["ColorSpace"] = [
|
||||||
PdfParser.PdfName("Indexed"),
|
PdfParser.PdfName("Indexed"),
|
||||||
PdfParser.PdfName("DeviceRGB"),
|
PdfParser.PdfName("DeviceRGB"),
|
||||||
255,
|
len(palette) // 3 - 1,
|
||||||
PdfParser.PdfBinary(palette),
|
PdfParser.PdfBinary(palette),
|
||||||
]
|
]
|
||||||
procset = "ImageI" # indexed color
|
procset = "ImageI" # indexed color
|
||||||
|
|
|
@ -279,10 +279,10 @@ DEPS = {
|
||||||
"libs": [r"objs\{msbuild_arch}\Release Static\freetype.lib"],
|
"libs": [r"objs\{msbuild_arch}\Release Static\freetype.lib"],
|
||||||
},
|
},
|
||||||
"lcms2": {
|
"lcms2": {
|
||||||
"url": SF_PROJECTS + "/lcms/files/lcms/2.15/lcms2-2.15.tar.gz/download",
|
"url": SF_PROJECTS + "/lcms/files/lcms/2.16/lcms2-2.16.tar.gz/download",
|
||||||
"filename": "lcms2-2.15.tar.gz",
|
"filename": "lcms2-2.16.tar.gz",
|
||||||
"dir": "lcms2-2.15",
|
"dir": "lcms2-2.16",
|
||||||
"license": "COPYING",
|
"license": "LICENSE",
|
||||||
"patch": {
|
"patch": {
|
||||||
r"Projects\VC2022\lcms2_static\lcms2_static.vcxproj": {
|
r"Projects\VC2022\lcms2_static\lcms2_static.vcxproj": {
|
||||||
# default is /MD for x86 and /MT for x64, we need /MD always
|
# default is /MD for x86 and /MT for x64, we need /MD always
|
||||||
|
|
Loading…
Reference in New Issue
Block a user