Skip to content

Commit

Permalink
Merge branch 'main' into comprehensions
Browse files Browse the repository at this point in the history
  • Loading branch information
hugovk authored Dec 4, 2023
2 parents e92c07f + fe26900 commit 9601102
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 18 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/wheels-dependencies.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ JPEGTURBO_VERSION=3.0.1
OPENJPEG_VERSION=2.5.0
XZ_VERSION=5.4.5
TIFF_VERSION=4.6.0
LCMS2_VERSION=2.15
LCMS2_VERSION=2.16
if [[ -n "$IS_MACOS" ]]; then
GIFLIB_VERSION=5.1.4
else
Expand Down
5 changes: 4 additions & 1 deletion CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,13 @@ Changelog (Pillow)
10.2.0 (unreleased)
-------------------

- Correct PDF palette size when saving #7555
[radarhere]

- Fixed closing file pointer with olefile 0.47 #7594
[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]

- If absent, do not try to close fp when closing image #7557
Expand Down
2 changes: 1 addition & 1 deletion docs/installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ Many of Pillow's features require external libraries:
* **littlecms** provides color management

* 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.

Expand Down
8 changes: 4 additions & 4 deletions src/PIL/ImageFont.py
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,10 @@ class FreeTypeFont:
def __init__(self, font=None, size=10, index=0, encoding="", layout_engine=None):
# FIXME: use service provider instead

if size <= 0:
msg = "font size must be greater than 0"
raise ValueError(msg)

self.path = font
self.size = size
self.index = index
Expand Down Expand Up @@ -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.
"""

if size <= 0:
msg = "font size must be greater than 0"
raise ValueError(msg)

def freetype(font):
return FreeTypeFont(font, size, index, encoding, layout_engine)

Expand Down
7 changes: 1 addition & 6 deletions src/PIL/ImageStat.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,7 @@
# See the README file for information on usage and redistribution.
#

import functools
import math
import operator


class Stat:
Expand Down Expand Up @@ -65,10 +63,7 @@ def minmax(histogram):

def _getcount(self):
"""Get total number of pixels in each layer"""
return [
functools.reduce(operator.add, self.h[i : i + 256])
for i in range(0, len(self.h), 256)
]
return [sum(self.h[i : i + 256]) for i in range(0, len(self.h), 256)]

def _getsum(self):
"""Get sum of all pixels in each layer"""
Expand Down
2 changes: 1 addition & 1 deletion src/PIL/PdfImagePlugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ def _write_image(im, filename, existing_pdf, image_refs):
dict_obj["ColorSpace"] = [
PdfParser.PdfName("Indexed"),
PdfParser.PdfName("DeviceRGB"),
255,
len(palette) // 3 - 1,
PdfParser.PdfBinary(palette),
]
procset = "ImageI" # indexed color
Expand Down
8 changes: 4 additions & 4 deletions winbuild/build_prepare.py
Original file line number Diff line number Diff line change
Expand Up @@ -279,10 +279,10 @@ def cmd_msbuild(
"libs": [r"objs\{msbuild_arch}\Release Static\freetype.lib"],
},
"lcms2": {
"url": SF_PROJECTS + "/lcms/files/lcms/2.15/lcms2-2.15.tar.gz/download",
"filename": "lcms2-2.15.tar.gz",
"dir": "lcms2-2.15",
"license": "COPYING",
"url": SF_PROJECTS + "/lcms/files/lcms/2.16/lcms2-2.16.tar.gz/download",
"filename": "lcms2-2.16.tar.gz",
"dir": "lcms2-2.16",
"license": "LICENSE",
"patch": {
r"Projects\VC2022\lcms2_static\lcms2_static.vcxproj": {
# default is /MD for x86 and /MT for x64, we need /MD always
Expand Down

0 comments on commit 9601102

Please sign in to comment.