mirror of
https://github.com/python-pillow/Pillow.git
synced 2024-12-24 00:46:16 +03:00
Use "gray" more consistently
This commit is contained in:
parent
0a6fcc2d97
commit
d682c18ded
12
CHANGES.rst
12
CHANGES.rst
|
@ -2191,7 +2191,7 @@ Changelog (Pillow)
|
|||
- Cache EXIF information #3498
|
||||
[Glandos]
|
||||
|
||||
- Added transparency for all PNG greyscale modes #3744
|
||||
- Added transparency for all PNG grayscale modes #3744
|
||||
[radarhere]
|
||||
|
||||
- Fix deprecation warnings in Python 3.8 #3749
|
||||
|
@ -4693,7 +4693,7 @@ Changelog (Pillow)
|
|||
- Fix Bicubic interpolation #970
|
||||
[homm]
|
||||
|
||||
- Support for 4-bit greyscale TIFF images #980
|
||||
- Support for 4-bit grayscale TIFF images #980
|
||||
[hugovk]
|
||||
|
||||
- Updated manifest #957
|
||||
|
@ -6768,7 +6768,7 @@ The test suite includes 750 individual tests.
|
|||
|
||||
- You can now convert directly between all modes supported by
|
||||
PIL. When converting colour images to "P", PIL defaults to
|
||||
a "web" palette and dithering. When converting greyscale
|
||||
a "web" palette and dithering. When converting grayscale
|
||||
images to "1", PIL uses a thresholding and dithering.
|
||||
|
||||
- Added a "dither" option to "convert". By default, "convert"
|
||||
|
@ -6846,13 +6846,13 @@ The test suite includes 530 individual tests.
|
|||
- Fixed "paste" to allow a mask also for mode "F" images.
|
||||
|
||||
- The BMP driver now saves mode "1" images. When loading images, the mode
|
||||
is set to "L" for 8-bit files with greyscale palettes, and to "P" for
|
||||
is set to "L" for 8-bit files with grayscale palettes, and to "P" for
|
||||
other 8-bit files.
|
||||
|
||||
- The IM driver now reads and saves "1" images (file modes "0 1" or "L 1").
|
||||
|
||||
- The JPEG and GIF drivers now saves "1" images. For JPEG, the image
|
||||
is saved as 8-bit greyscale (it will load as mode "L"). For GIF, the
|
||||
is saved as 8-bit grayscale (it will load as mode "L"). For GIF, the
|
||||
image will be loaded as a "P" image.
|
||||
|
||||
- Fixed a potential buffer overrun in the GIF encoder.
|
||||
|
@ -7156,7 +7156,7 @@ The test suite includes 400 individual tests.
|
|||
drawing capabilities can be used to render vector and metafile
|
||||
formats.
|
||||
|
||||
- Added restricted drivers for images from Image Tools (greyscale
|
||||
- Added restricted drivers for images from Image Tools (grayscale
|
||||
only) and LabEye/IFUNC (common interchange modes only).
|
||||
|
||||
- Some minor improvements to the sample scripts provided in the
|
||||
|
|
Before Width: | Height: | Size: 331 B After Width: | Height: | Size: 331 B |
Before Width: | Height: | Size: 668 B After Width: | Height: | Size: 668 B |
Before Width: | Height: | Size: 6.1 KiB After Width: | Height: | Size: 6.1 KiB |
|
@ -231,13 +231,13 @@ def test_apng_mode():
|
|||
assert im.getpixel((0, 0)) == (0, 0, 128, 191)
|
||||
assert im.getpixel((64, 32)) == (0, 0, 128, 191)
|
||||
|
||||
with Image.open("Tests/images/apng/mode_greyscale.png") as im:
|
||||
with Image.open("Tests/images/apng/mode_grayscale.png") as im:
|
||||
assert im.mode == "L"
|
||||
im.seek(im.n_frames - 1)
|
||||
assert im.getpixel((0, 0)) == 128
|
||||
assert im.getpixel((64, 32)) == 255
|
||||
|
||||
with Image.open("Tests/images/apng/mode_greyscale_alpha.png") as im:
|
||||
with Image.open("Tests/images/apng/mode_grayscale_alpha.png") as im:
|
||||
assert im.mode == "LA"
|
||||
im.seek(im.n_frames - 1)
|
||||
assert im.getpixel((0, 0)) == (128, 191)
|
||||
|
|
|
@ -159,7 +159,7 @@ def test_rle8():
|
|||
with Image.open("Tests/images/hopper_rle8.bmp") as im:
|
||||
assert_image_similar_tofile(im.convert("RGB"), "Tests/images/hopper.bmp", 12)
|
||||
|
||||
with Image.open("Tests/images/hopper_rle8_greyscale.bmp") as im:
|
||||
with Image.open("Tests/images/hopper_rle8_grayscale.bmp") as im:
|
||||
assert_image_equal_tofile(im, "Tests/images/bw_gradient.png")
|
||||
|
||||
# This test image has been manually hexedited
|
||||
|
|
|
@ -590,7 +590,7 @@ def test_save_dispose(tmp_path):
|
|||
def test_dispose2_palette(tmp_path):
|
||||
out = str(tmp_path / "temp.gif")
|
||||
|
||||
# Four colors: white, grey, black, red
|
||||
# Four colors: white, gray, black, red
|
||||
circles = [(255, 255, 255), (153, 153, 153), (0, 0, 0), (255, 0, 0)]
|
||||
|
||||
im_list = []
|
||||
|
|
|
@ -297,7 +297,7 @@ class TestFilePng:
|
|||
assert_image(im, "RGBA", (10, 10))
|
||||
assert im.getcolors() == [(100, (0, 0, 0, 0))]
|
||||
|
||||
def test_save_greyscale_transparency(self, tmp_path):
|
||||
def test_save_grayscale_transparency(self, tmp_path):
|
||||
for mode, num_transparent in {"1": 1994, "L": 559, "I": 559}.items():
|
||||
in_file = "Tests/images/" + mode.lower() + "_trns.png"
|
||||
with Image.open(in_file) as im:
|
||||
|
|
|
@ -10,7 +10,7 @@ GREEN = (0, 255, 0)
|
|||
ORANGE = (255, 128, 0)
|
||||
WHITE = (255, 255, 255)
|
||||
|
||||
GREY = 128
|
||||
GRAY = 128
|
||||
|
||||
|
||||
def test_sanity():
|
||||
|
@ -121,12 +121,12 @@ def test_constant():
|
|||
im = Image.new("RGB", (20, 10))
|
||||
|
||||
# Act
|
||||
new = ImageChops.constant(im, GREY)
|
||||
new = ImageChops.constant(im, GRAY)
|
||||
|
||||
# Assert
|
||||
assert new.size == im.size
|
||||
assert new.getpixel((0, 0)) == GREY
|
||||
assert new.getpixel((19, 9)) == GREY
|
||||
assert new.getpixel((0, 0)) == GRAY
|
||||
assert new.getpixel((19, 9)) == GRAY
|
||||
|
||||
|
||||
def test_darker_image():
|
||||
|
|
|
@ -303,8 +303,8 @@ def test_multiline_spacing(font):
|
|||
"orientation", (Image.Transpose.ROTATE_90, Image.Transpose.ROTATE_270)
|
||||
)
|
||||
def test_rotated_transposed_font(font, orientation):
|
||||
img_grey = Image.new("L", (100, 100))
|
||||
draw = ImageDraw.Draw(img_grey)
|
||||
img_gray = Image.new("L", (100, 100))
|
||||
draw = ImageDraw.Draw(img_gray)
|
||||
word = "testing"
|
||||
|
||||
transposed_font = ImageFont.TransposedFont(font, orientation=orientation)
|
||||
|
@ -344,8 +344,8 @@ def test_rotated_transposed_font(font, orientation):
|
|||
),
|
||||
)
|
||||
def test_unrotated_transposed_font(font, orientation):
|
||||
img_grey = Image.new("L", (100, 100))
|
||||
draw = ImageDraw.Draw(img_grey)
|
||||
img_gray = Image.new("L", (100, 100))
|
||||
draw = ImageDraw.Draw(img_gray)
|
||||
word = "testing"
|
||||
|
||||
transposed_font = ImageFont.TransposedFont(font, orientation=orientation)
|
||||
|
|
|
@ -26,7 +26,7 @@ image. If the image was not read from a file, it is set to None. The size
|
|||
attribute is a 2-tuple containing width and height (in pixels). The
|
||||
:py:attr:`~PIL.Image.Image.mode` attribute defines the number and names of the
|
||||
bands in the image, and also the pixel type and depth. Common modes are “L”
|
||||
(luminance) for greyscale images, “RGB” for true color images, and “CMYK” for
|
||||
(luminance) for grayscale images, “RGB” for true color images, and “CMYK” for
|
||||
pre-press images.
|
||||
|
||||
If the file cannot be opened, an :py:exc:`OSError` exception is raised.
|
||||
|
@ -599,7 +599,7 @@ Controlling the decoder
|
|||
Some decoders allow you to manipulate the image while reading it from a file.
|
||||
This can often be used to speed up decoding when creating thumbnails (when
|
||||
speed is usually more important than quality) and printing to a monochrome
|
||||
laser printer (when only a greyscale version of the image is needed).
|
||||
laser printer (when only a grayscale version of the image is needed).
|
||||
|
||||
The :py:meth:`~PIL.Image.Image.draft` method manipulates an opened but not yet
|
||||
loaded image so it as closely as possible matches the given mode and size. This
|
||||
|
|
|
@ -45,7 +45,7 @@ Example
|
|||
The following plugin supports a simple format, which has a 128-byte header
|
||||
consisting of the words “SPAM” followed by the width, height, and pixel size in
|
||||
bits. The header fields are separated by spaces. The image data follows
|
||||
directly after the header, and can be either bi-level, greyscale, or 24-bit
|
||||
directly after the header, and can be either bi-level, grayscale, or 24-bit
|
||||
true color.
|
||||
|
||||
**SpamImagePlugin.py**::
|
||||
|
@ -211,9 +211,9 @@ table describes some commonly used **raw modes**:
|
|||
| ``1;R`` | | 1-bit reversed bilevel, stored with the leftmost pixel in the |
|
||||
| | | least significant bit. 0 means black, 1 means white. |
|
||||
+-----------+-------------------------------------------------------------------+
|
||||
| ``L`` | 8-bit greyscale. 0 means black, 255 means white. |
|
||||
| ``L`` | 8-bit grayscale. 0 means black, 255 means white. |
|
||||
+-----------+-------------------------------------------------------------------+
|
||||
| ``L;I`` | 8-bit inverted greyscale. 0 means white, 255 means black. |
|
||||
| ``L;I`` | 8-bit inverted grayscale. 0 means white, 255 means black. |
|
||||
+-----------+-------------------------------------------------------------------+
|
||||
| ``P`` | 8-bit palette-mapped image. |
|
||||
+-----------+-------------------------------------------------------------------+
|
||||
|
|
|
@ -59,7 +59,7 @@ Functions
|
|||
.. py:method:: 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
|
||||
grayscale 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
|
||||
|
|
|
@ -58,7 +58,7 @@ method:
|
|||
|
||||
This class can be used to control the contrast of an image, similar to the
|
||||
contrast control on a TV set. An
|
||||
:ref:`enhancement factor <enhancement-factor>` of 0.0 gives a solid grey
|
||||
:ref:`enhancement factor <enhancement-factor>` of 0.0 gives a solid gray
|
||||
image, a factor of 1.0 gives the original image, and greater values
|
||||
increase the contrast of the image.
|
||||
|
||||
|
|
|
@ -72,7 +72,7 @@ pixel bits.
|
|||
|
||||
Note that the operands are converted to 32-bit signed integers before the
|
||||
bitwise operation is applied. This means that you’ll get negative values if
|
||||
you invert an ordinary greyscale image. You can use the and (&) operator to
|
||||
you invert an ordinary grayscale image. You can use the and (&) operator to
|
||||
mask off unwanted bits.
|
||||
|
||||
Bitwise operators don’t work on floating point images.
|
||||
|
|
|
@ -29,10 +29,10 @@ API Additions
|
|||
Image.entropy
|
||||
^^^^^^^^^^^^^
|
||||
Calculates and returns the entropy for the image. A bilevel image (mode "1") is treated
|
||||
as a greyscale ("L") image by this method. If a mask is provided, the method employs
|
||||
as a grayscale ("L") image by this method. If a mask is provided, the method employs
|
||||
the histogram for those parts of the image where the mask image is non-zero. The mask
|
||||
image must have the same size as the image, and be either a bi-level image (mode "1") or
|
||||
a greyscale image ("L").
|
||||
a grayscale image ("L").
|
||||
|
||||
ImageGrab.grab
|
||||
^^^^^^^^^^^^^^
|
||||
|
|
|
@ -230,21 +230,21 @@ class BmpImageFile(ImageFile.ImageFile):
|
|||
else:
|
||||
padding = file_info["palette_padding"]
|
||||
palette = read(padding * file_info["colors"])
|
||||
greyscale = True
|
||||
grayscale = True
|
||||
indices = (
|
||||
(0, 255)
|
||||
if file_info["colors"] == 2
|
||||
else list(range(file_info["colors"]))
|
||||
)
|
||||
|
||||
# ----------------- Check if greyscale and ignore palette if so
|
||||
# ----------------- Check if grayscale and ignore palette if so
|
||||
for ind, val in enumerate(indices):
|
||||
rgb = palette[ind * padding : ind * padding + 3]
|
||||
if rgb != o8(val) * 3:
|
||||
greyscale = False
|
||||
grayscale = False
|
||||
|
||||
# ------- If all colors are grey, white or black, ditch palette
|
||||
if greyscale:
|
||||
# ------- If all colors are gray, white or black, ditch palette
|
||||
if grayscale:
|
||||
self._mode = "1" if file_info["colors"] == 2 else "L"
|
||||
raw_mode = self.mode
|
||||
else:
|
||||
|
|
|
@ -878,12 +878,12 @@ class Image:
|
|||
"L", "RGB" and "CMYK". The ``matrix`` argument only supports "L"
|
||||
and "RGB".
|
||||
|
||||
When translating a color image to greyscale (mode "L"),
|
||||
When translating a color image to grayscale (mode "L"),
|
||||
the library uses the ITU-R 601-2 luma transform::
|
||||
|
||||
L = R * 299/1000 + G * 587/1000 + B * 114/1000
|
||||
|
||||
The default method of converting a greyscale ("L") or "RGB"
|
||||
The default method of converting a grayscale ("L") or "RGB"
|
||||
image into a bilevel (mode "1") image uses Floyd-Steinberg
|
||||
dither to approximate the original image luminosity levels. If
|
||||
dither is ``None``, all values larger than 127 are set to 255 (white),
|
||||
|
@ -1238,7 +1238,7 @@ class Image:
|
|||
Configures the image file loader so it returns a version of the
|
||||
image that as closely as possible matches the given mode and
|
||||
size. For example, you can use this method to convert a color
|
||||
JPEG to greyscale while loading it.
|
||||
JPEG to grayscale while loading it.
|
||||
|
||||
If any changes are made, returns a tuple with the chosen ``mode`` and
|
||||
``box`` with coordinates of the original image within the altered one.
|
||||
|
@ -1610,13 +1610,13 @@ class Image:
|
|||
than one band, the histograms for all bands are concatenated (for
|
||||
example, the histogram for an "RGB" image contains 768 values).
|
||||
|
||||
A bilevel image (mode "1") is treated as a greyscale ("L") image
|
||||
A bilevel image (mode "1") is treated as a grayscale ("L") image
|
||||
by this method.
|
||||
|
||||
If a mask is provided, the method returns a histogram for those
|
||||
parts of the image where the mask image is non-zero. The mask
|
||||
image must have the same size as the image, and be either a
|
||||
bi-level image (mode "1") or a greyscale image ("L").
|
||||
bi-level image (mode "1") or a grayscale image ("L").
|
||||
|
||||
:param mask: An optional mask.
|
||||
:param extrema: An optional tuple of manually-specified extrema.
|
||||
|
@ -1636,13 +1636,13 @@ class Image:
|
|||
"""
|
||||
Calculates and returns the entropy for the image.
|
||||
|
||||
A bilevel image (mode "1") is treated as a greyscale ("L")
|
||||
A bilevel image (mode "1") is treated as a grayscale ("L")
|
||||
image by this method.
|
||||
|
||||
If a mask is provided, the method employs the histogram for
|
||||
those parts of the image where the mask image is non-zero.
|
||||
The mask image must have the same size as the image, and be
|
||||
either a bi-level image (mode "1") or a greyscale image ("L").
|
||||
either a bi-level image (mode "1") or a grayscale image ("L").
|
||||
|
||||
:param mask: An optional mask.
|
||||
:param extrema: An optional tuple of manually-specified extrema.
|
||||
|
@ -2874,7 +2874,7 @@ class ImageTransformHandler:
|
|||
|
||||
|
||||
def _wedge():
|
||||
"""Create greyscale wedge (for debugging only)"""
|
||||
"""Create grayscale wedge (for debugging only)"""
|
||||
|
||||
return Image()._new(core.wedge("L"))
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@ from . import Image
|
|||
|
||||
|
||||
def constant(image, value):
|
||||
"""Fill a channel with a given grey level.
|
||||
"""Fill a channel with a given gray level.
|
||||
|
||||
:rtype: :py:class:`~PIL.Image.Image`
|
||||
"""
|
||||
|
|
|
@ -124,7 +124,7 @@ def getcolor(color, mode):
|
|||
"""
|
||||
Same as :py:func:`~PIL.ImageColor.getrgb` for most modes. However, if
|
||||
``mode`` is HSV, converts the RGB value to a HSV value, or if ``mode`` is
|
||||
not color or a palette image, converts the RGB value to a greyscale value.
|
||||
not color or a palette image, converts the RGB value to a grayscale value.
|
||||
If the string cannot be parsed, this function raises a :py:exc:`ValueError`
|
||||
exception.
|
||||
|
||||
|
|
|
@ -59,7 +59,7 @@ class Contrast(_Enhance):
|
|||
|
||||
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.
|
||||
gives a solid gray image. A factor of 1.0 gives the original image.
|
||||
"""
|
||||
|
||||
def __init__(self, image):
|
||||
|
|
|
@ -593,7 +593,7 @@ def solarize(image, threshold=128):
|
|||
Invert all pixel values above a threshold.
|
||||
|
||||
:param image: The image to solarize.
|
||||
:param threshold: All pixels above this greyscale level are inverted.
|
||||
:param threshold: All pixels above this grayscale level are inverted.
|
||||
:return: An image.
|
||||
"""
|
||||
lut = []
|
||||
|
|
|
@ -54,9 +54,9 @@ class Dib:
|
|||
"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
|
||||
palette and associates it with the image. For an "L" image, 128 graylevels
|
||||
are allocated. For an "RGB" image, a 6x6x6 colour cube is used, together
|
||||
with 20 greylevels.
|
||||
with 20 graylevels.
|
||||
|
||||
To make sure that palettes work properly under Windows, you must call the
|
||||
``palette`` method upon certain events from Windows.
|
||||
|
|
|
@ -109,7 +109,7 @@ class PSDraw:
|
|||
if im.mode == "1":
|
||||
dpi = 200 # fax
|
||||
else:
|
||||
dpi = 100 # greyscale
|
||||
dpi = 100 # grayscale
|
||||
# image size (on paper)
|
||||
x = im.size[0] * 72 / dpi
|
||||
y = im.size[1] * 72 / dpi
|
||||
|
|
|
@ -124,7 +124,7 @@ def _save(im, fp, filename):
|
|||
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)
|
||||
# Palm does grayscale 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)
|
||||
|
|
|
@ -91,7 +91,7 @@ class PcxImageFile(ImageFile.ImageFile):
|
|||
self.fp.seek(-769, io.SEEK_END)
|
||||
s = self.fp.read(769)
|
||||
if len(s) == 769 and s[0] == 12:
|
||||
# check if the palette is linear greyscale
|
||||
# check if the palette is linear grayscale
|
||||
for i in range(256):
|
||||
if s[i * 3 + 1 : i * 3 + 4] != o8(i) * 3:
|
||||
mode = rawmode = "P"
|
||||
|
@ -203,7 +203,7 @@ def _save(im, fp, filename):
|
|||
palette += b"\x00" * (768 - len(palette))
|
||||
fp.write(palette) # 768 bytes
|
||||
elif im.mode == "L":
|
||||
# greyscale palette
|
||||
# grayscale palette
|
||||
fp.write(o8(12))
|
||||
for i in range(256):
|
||||
fp.write(o8(i) * 3)
|
||||
|
|
|
@ -56,7 +56,7 @@ _MAGIC = b"\211PNG\r\n\032\n"
|
|||
|
||||
_MODES = {
|
||||
# supported bits/color combinations, and corresponding modes/rawmodes
|
||||
# Greyscale
|
||||
# Grayscale
|
||||
(1, 0): ("1", "1"),
|
||||
(2, 0): ("L", "L;2"),
|
||||
(4, 0): ("L", "L;4"),
|
||||
|
@ -70,7 +70,7 @@ _MODES = {
|
|||
(2, 3): ("P", "P;2"),
|
||||
(4, 3): ("P", "P;4"),
|
||||
(8, 3): ("P", "P"),
|
||||
# Greyscale with alpha
|
||||
# Grayscale with alpha
|
||||
(8, 4): ("LA", "LA"),
|
||||
(16, 4): ("RGBA", "LA;16B"), # LA;16B->LA not yet available
|
||||
# Truecolour with alpha
|
||||
|
|
|
@ -1013,7 +1013,7 @@ static struct {
|
|||
static void
|
||||
p2bit(UINT8 *out, const UINT8 *in, int xsize, ImagingPalette palette) {
|
||||
int x;
|
||||
/* FIXME: precalculate greyscale palette? */
|
||||
/* FIXME: precalculate grayscale palette? */
|
||||
for (x = 0; x < xsize; x++) {
|
||||
*out++ = (L(&palette->palette[in[x] * 4]) >= 128000) ? 255 : 0;
|
||||
}
|
||||
|
@ -1022,7 +1022,7 @@ p2bit(UINT8 *out, const UINT8 *in, int xsize, ImagingPalette palette) {
|
|||
static void
|
||||
pa2bit(UINT8 *out, const UINT8 *in, int xsize, ImagingPalette palette) {
|
||||
int x;
|
||||
/* FIXME: precalculate greyscale palette? */
|
||||
/* FIXME: precalculate grayscale palette? */
|
||||
for (x = 0; x < xsize; x++, in += 4) {
|
||||
*out++ = (L(&palette->palette[in[0] * 4]) >= 128000) ? 255 : 0;
|
||||
}
|
||||
|
@ -1031,7 +1031,7 @@ pa2bit(UINT8 *out, const UINT8 *in, int xsize, ImagingPalette palette) {
|
|||
static void
|
||||
p2l(UINT8 *out, const UINT8 *in, int xsize, ImagingPalette palette) {
|
||||
int x;
|
||||
/* FIXME: precalculate greyscale palette? */
|
||||
/* FIXME: precalculate grayscale palette? */
|
||||
for (x = 0; x < xsize; x++) {
|
||||
*out++ = L24(&palette->palette[in[x] * 4]) >> 16;
|
||||
}
|
||||
|
@ -1040,7 +1040,7 @@ p2l(UINT8 *out, const UINT8 *in, int xsize, ImagingPalette palette) {
|
|||
static void
|
||||
pa2l(UINT8 *out, const UINT8 *in, int xsize, ImagingPalette palette) {
|
||||
int x;
|
||||
/* FIXME: precalculate greyscale palette? */
|
||||
/* FIXME: precalculate grayscale palette? */
|
||||
for (x = 0; x < xsize; x++, in += 4) {
|
||||
*out++ = L24(&palette->palette[in[0] * 4]) >> 16;
|
||||
}
|
||||
|
@ -1070,7 +1070,7 @@ p2pa(UINT8 *out, const UINT8 *in, int xsize, ImagingPalette palette) {
|
|||
static void
|
||||
p2la(UINT8 *out, const UINT8 *in, int xsize, ImagingPalette palette) {
|
||||
int x;
|
||||
/* FIXME: precalculate greyscale palette? */
|
||||
/* FIXME: precalculate grayscale palette? */
|
||||
for (x = 0; x < xsize; x++, out += 4) {
|
||||
const UINT8 *rgba = &palette->palette[*in++ * 4];
|
||||
out[0] = out[1] = out[2] = L24(rgba) >> 16;
|
||||
|
@ -1081,7 +1081,7 @@ p2la(UINT8 *out, const UINT8 *in, int xsize, ImagingPalette palette) {
|
|||
static void
|
||||
pa2la(UINT8 *out, const UINT8 *in, int xsize, ImagingPalette palette) {
|
||||
int x;
|
||||
/* FIXME: precalculate greyscale palette? */
|
||||
/* FIXME: precalculate grayscale palette? */
|
||||
for (x = 0; x < xsize; x++, in += 4, out += 4) {
|
||||
out[0] = out[1] = out[2] = L24(&palette->palette[in[0] * 4]) >> 16;
|
||||
out[3] = in[3];
|
||||
|
@ -1335,9 +1335,9 @@ topalette(
|
|||
imOut->palette = ImagingPaletteDuplicate(palette);
|
||||
|
||||
if (imIn->bands == 1) {
|
||||
/* greyscale image */
|
||||
/* grayscale image */
|
||||
|
||||
/* Greyscale palette: copy data as is */
|
||||
/* Grayscale palette: copy data as is */
|
||||
ImagingSectionEnter(&cookie);
|
||||
for (y = 0; y < imIn->ysize; y++) {
|
||||
if (alpha) {
|
||||
|
|
|
@ -142,9 +142,9 @@ ImagingNewDIB(const char *mode, int xsize, int ysize) {
|
|||
GetSystemPaletteEntries(dib->dc, 0, 256, pal->palPalEntry);
|
||||
|
||||
if (strcmp(mode, "L") == 0) {
|
||||
/* Greyscale DIB. Fill all 236 slots with a greyscale ramp
|
||||
/* Grayscale DIB. Fill all 236 slots with a grayscale ramp
|
||||
* (this is usually overkill on Windows since VGA only offers
|
||||
* 6 bits greyscale resolution). Ignore the slots already
|
||||
* 6 bits grayscale resolution). Ignore the slots already
|
||||
* allocated by Windows */
|
||||
|
||||
i = 10;
|
||||
|
@ -160,7 +160,7 @@ ImagingNewDIB(const char *mode, int xsize, int ysize) {
|
|||
#ifdef CUBE216
|
||||
|
||||
/* Colour DIB. Create a 6x6x6 colour cube (216 entries) and
|
||||
* add 20 extra greylevels for best result with greyscale
|
||||
* add 20 extra graylevels for best result with grayscale
|
||||
* images. */
|
||||
|
||||
i = 10;
|
||||
|
|
|
@ -549,16 +549,16 @@ static struct {
|
|||
{"1", "1;IR", 1, pack1IR},
|
||||
{"1", "L", 8, pack1L},
|
||||
|
||||
/* greyscale */
|
||||
/* grayscale */
|
||||
{"L", "L", 8, copy1},
|
||||
{"L", "L;16", 16, packL16},
|
||||
{"L", "L;16B", 16, packL16B},
|
||||
|
||||
/* greyscale w. alpha */
|
||||
/* grayscale w. alpha */
|
||||
{"LA", "LA", 16, packLA},
|
||||
{"LA", "LA;L", 16, packLAL},
|
||||
|
||||
/* greyscale w. alpha premultiplied */
|
||||
/* grayscale w. alpha premultiplied */
|
||||
{"La", "La", 16, packLA},
|
||||
|
||||
/* palette */
|
||||
|
|
|
@ -75,7 +75,7 @@ ImagingPaletteNewBrowser(void) {
|
|||
}
|
||||
palette->size = i;
|
||||
|
||||
/* FIXME: add 30-level greyscale wedge here? */
|
||||
/* FIXME: add 30-level grayscale wedge here? */
|
||||
|
||||
return palette;
|
||||
}
|
||||
|
|
|
@ -1697,7 +1697,7 @@ ImagingQuantize(Imaging im, int colors, int mode, int kmeans) {
|
|||
image data? */
|
||||
|
||||
if (!strcmp(im->mode, "L")) {
|
||||
/* greyscale */
|
||||
/* grayscale */
|
||||
|
||||
/* FIXME: converting a "L" image to "P" with 256 colors
|
||||
should be done by a simple copy... */
|
||||
|
|
|
@ -80,18 +80,18 @@ ImagingNewPrologueSubtype(const char *mode, int xsize, int ysize, int size) {
|
|||
im->palette = ImagingPaletteNew("RGB");
|
||||
|
||||
} else if (strcmp(mode, "L") == 0) {
|
||||
/* 8-bit greyscale (luminance) images */
|
||||
/* 8-bit grayscale (luminance) images */
|
||||
im->bands = im->pixelsize = 1;
|
||||
im->linesize = xsize;
|
||||
|
||||
} else if (strcmp(mode, "LA") == 0) {
|
||||
/* 8-bit greyscale (luminance) with alpha */
|
||||
/* 8-bit grayscale (luminance) with alpha */
|
||||
im->bands = 2;
|
||||
im->pixelsize = 4; /* store in image32 memory */
|
||||
im->linesize = xsize * 4;
|
||||
|
||||
} else if (strcmp(mode, "La") == 0) {
|
||||
/* 8-bit greyscale (luminance) with premultiplied alpha */
|
||||
/* 8-bit grayscale (luminance) with premultiplied alpha */
|
||||
im->bands = 2;
|
||||
im->pixelsize = 4; /* store in image32 memory */
|
||||
im->linesize = xsize * 4;
|
||||
|
|
|
@ -819,7 +819,7 @@ ImagingUnpackXBGR(UINT8 *_out, const UINT8 *in, int pixels) {
|
|||
static void
|
||||
unpackRGBALA(UINT8 *_out, const UINT8 *in, int pixels) {
|
||||
int i;
|
||||
/* greyscale with alpha */
|
||||
/* grayscale with alpha */
|
||||
for (i = 0; i < pixels; i++) {
|
||||
UINT32 iv = MAKE_UINT32(in[0], in[0], in[0], in[1]);
|
||||
memcpy(_out, &iv, sizeof(iv));
|
||||
|
@ -831,7 +831,7 @@ unpackRGBALA(UINT8 *_out, const UINT8 *in, int pixels) {
|
|||
static void
|
||||
unpackRGBALA16B(UINT8 *_out, const UINT8 *in, int pixels) {
|
||||
int i;
|
||||
/* 16-bit greyscale with alpha, big-endian */
|
||||
/* 16-bit grayscale with alpha, big-endian */
|
||||
for (i = 0; i < pixels; i++) {
|
||||
UINT32 iv = MAKE_UINT32(in[0], in[0], in[0], in[2]);
|
||||
memcpy(_out, &iv, sizeof(iv));
|
||||
|
@ -1108,7 +1108,7 @@ unpackCMYKI(UINT8 *_out, const UINT8 *in, int pixels) {
|
|||
/* There are two representations of LAB images for whatever precision:
|
||||
L: Uint (in PS, it's 0-100)
|
||||
A: Int (in ps, -128 .. 128, or elsewhere 0..255, with 128 as middle.
|
||||
Channels in PS display a 0 value as middle grey,
|
||||
Channels in PS display a 0 value as middle gray,
|
||||
LCMS appears to use 128 as the 0 value for these channels)
|
||||
B: Int (as above)
|
||||
|
||||
|
@ -1172,7 +1172,7 @@ unpackI16R_I16(UINT8 *out, const UINT8 *in, int pixels) {
|
|||
|
||||
static void
|
||||
unpackI12_I16(UINT8 *out, const UINT8 *in, int pixels) {
|
||||
/* Fillorder 1/MSB -> LittleEndian, for 12bit integer greyscale tiffs.
|
||||
/* Fillorder 1/MSB -> LittleEndian, for 12bit integer grayscale tiffs.
|
||||
|
||||
According to the TIFF spec:
|
||||
|
||||
|
@ -1527,7 +1527,7 @@ static struct {
|
|||
{"1", "1;IR", 1, unpack1IR},
|
||||
{"1", "1;8", 8, unpack18},
|
||||
|
||||
/* greyscale */
|
||||
/* grayscale */
|
||||
{"L", "L;2", 2, unpackL2},
|
||||
{"L", "L;2I", 2, unpackL2I},
|
||||
{"L", "L;2R", 2, unpackL2R},
|
||||
|
@ -1544,11 +1544,11 @@ static struct {
|
|||
{"L", "L;16", 16, unpackL16},
|
||||
{"L", "L;16B", 16, unpackL16B},
|
||||
|
||||
/* greyscale w. alpha */
|
||||
/* grayscale w. alpha */
|
||||
{"LA", "LA", 16, unpackLA},
|
||||
{"LA", "LA;L", 16, unpackLAL},
|
||||
|
||||
/* greyscale w. alpha premultiplied */
|
||||
/* grayscale w. alpha premultiplied */
|
||||
{"La", "La", 16, unpackLA},
|
||||
|
||||
/* palette */
|
||||
|
|
Loading…
Reference in New Issue
Block a user