From d682c18ded4ca6fdbb256373f7c8aae78ee9b212 Mon Sep 17 00:00:00 2001 From: Andrew Murray Date: Thu, 19 Oct 2023 19:12:01 +1100 Subject: [PATCH] Use "gray" more consistently --- CHANGES.rst | 12 ++++++------ .../{mode_greyscale.png => mode_grayscale.png} | Bin ...scale_alpha.png => mode_grayscale_alpha.png} | Bin ..._greyscale.bmp => hopper_rle8_grayscale.bmp} | Bin Tests/test_file_apng.py | 4 ++-- Tests/test_file_bmp.py | 2 +- Tests/test_file_gif.py | 2 +- Tests/test_file_png.py | 2 +- Tests/test_imagechops.py | 8 ++++---- Tests/test_imagefont.py | 8 ++++---- docs/handbook/tutorial.rst | 4 ++-- docs/handbook/writing-your-own-image-plugin.rst | 6 +++--- docs/reference/ImageColor.rst | 2 +- docs/reference/ImageEnhance.rst | 2 +- docs/reference/ImageMath.rst | 2 +- docs/releasenotes/6.1.0.rst | 4 ++-- src/PIL/BmpImagePlugin.py | 10 +++++----- src/PIL/Image.py | 16 ++++++++-------- src/PIL/ImageChops.py | 2 +- src/PIL/ImageColor.py | 2 +- src/PIL/ImageEnhance.py | 2 +- src/PIL/ImageOps.py | 2 +- src/PIL/ImageWin.py | 4 ++-- src/PIL/PSDraw.py | 2 +- src/PIL/PalmImagePlugin.py | 2 +- src/PIL/PcxImagePlugin.py | 4 ++-- src/PIL/PngImagePlugin.py | 4 ++-- src/libImaging/Convert.c | 16 ++++++++-------- src/libImaging/Dib.c | 6 +++--- src/libImaging/Pack.c | 6 +++--- src/libImaging/Palette.c | 2 +- src/libImaging/Quant.c | 2 +- src/libImaging/Storage.c | 6 +++--- src/libImaging/Unpack.c | 14 +++++++------- 34 files changed, 80 insertions(+), 80 deletions(-) rename Tests/images/apng/{mode_greyscale.png => mode_grayscale.png} (100%) rename Tests/images/apng/{mode_greyscale_alpha.png => mode_grayscale_alpha.png} (100%) rename Tests/images/{hopper_rle8_greyscale.bmp => hopper_rle8_grayscale.bmp} (100%) diff --git a/CHANGES.rst b/CHANGES.rst index d2f2bb46231..f4d11ba48e6 100644 --- a/CHANGES.rst +++ b/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 diff --git a/Tests/images/apng/mode_greyscale.png b/Tests/images/apng/mode_grayscale.png similarity index 100% rename from Tests/images/apng/mode_greyscale.png rename to Tests/images/apng/mode_grayscale.png diff --git a/Tests/images/apng/mode_greyscale_alpha.png b/Tests/images/apng/mode_grayscale_alpha.png similarity index 100% rename from Tests/images/apng/mode_greyscale_alpha.png rename to Tests/images/apng/mode_grayscale_alpha.png diff --git a/Tests/images/hopper_rle8_greyscale.bmp b/Tests/images/hopper_rle8_grayscale.bmp similarity index 100% rename from Tests/images/hopper_rle8_greyscale.bmp rename to Tests/images/hopper_rle8_grayscale.bmp diff --git a/Tests/test_file_apng.py b/Tests/test_file_apng.py index 57928880882..fffbc54caf5 100644 --- a/Tests/test_file_apng.py +++ b/Tests/test_file_apng.py @@ -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) diff --git a/Tests/test_file_bmp.py b/Tests/test_file_bmp.py index 9e79937e9f5..58a45aa0b8a 100644 --- a/Tests/test_file_bmp.py +++ b/Tests/test_file_bmp.py @@ -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 diff --git a/Tests/test_file_gif.py b/Tests/test_file_gif.py index 3c2e96356c4..fa5d54febf8 100644 --- a/Tests/test_file_gif.py +++ b/Tests/test_file_gif.py @@ -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 = [] diff --git a/Tests/test_file_png.py b/Tests/test_file_png.py index 40fc595ad52..b8f48140851 100644 --- a/Tests/test_file_png.py +++ b/Tests/test_file_png.py @@ -297,7 +297,7 @@ def test_save_p_transparent_black(self, tmp_path): 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: diff --git a/Tests/test_imagechops.py b/Tests/test_imagechops.py index d0fea385433..e7687cc1b76 100644 --- a/Tests/test_imagechops.py +++ b/Tests/test_imagechops.py @@ -10,7 +10,7 @@ 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(): diff --git a/Tests/test_imagefont.py b/Tests/test_imagefont.py index f2b7dedf0ac..db0df047f77 100644 --- a/Tests/test_imagefont.py +++ b/Tests/test_imagefont.py @@ -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) diff --git a/docs/handbook/tutorial.rst b/docs/handbook/tutorial.rst index 2fbce86d4b6..d79f2465f16 100644 --- a/docs/handbook/tutorial.rst +++ b/docs/handbook/tutorial.rst @@ -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 diff --git a/docs/handbook/writing-your-own-image-plugin.rst b/docs/handbook/writing-your-own-image-plugin.rst index ad1bf7f9523..956d63aa771 100644 --- a/docs/handbook/writing-your-own-image-plugin.rst +++ b/docs/handbook/writing-your-own-image-plugin.rst @@ -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. | +-----------+-------------------------------------------------------------------+ diff --git a/docs/reference/ImageColor.rst b/docs/reference/ImageColor.rst index 20237eccf78..31faeac788b 100644 --- a/docs/reference/ImageColor.rst +++ b/docs/reference/ImageColor.rst @@ -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 diff --git a/docs/reference/ImageEnhance.rst b/docs/reference/ImageEnhance.rst index 457f0d4df1b..529acad4a91 100644 --- a/docs/reference/ImageEnhance.rst +++ b/docs/reference/ImageEnhance.rst @@ -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 ` of 0.0 gives a solid grey + :ref:`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. diff --git a/docs/reference/ImageMath.rst b/docs/reference/ImageMath.rst index 118d988d6d4..ee07efa0132 100644 --- a/docs/reference/ImageMath.rst +++ b/docs/reference/ImageMath.rst @@ -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. diff --git a/docs/releasenotes/6.1.0.rst b/docs/releasenotes/6.1.0.rst index 76e13b06172..e7c593e6e63 100644 --- a/docs/releasenotes/6.1.0.rst +++ b/docs/releasenotes/6.1.0.rst @@ -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 ^^^^^^^^^^^^^^ diff --git a/src/PIL/BmpImagePlugin.py b/src/PIL/BmpImagePlugin.py index 9abfd0b5b8d..ef719e3eca2 100644 --- a/src/PIL/BmpImagePlugin.py +++ b/src/PIL/BmpImagePlugin.py @@ -230,21 +230,21 @@ def _bitmap(self, header=0, offset=0): 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: diff --git a/src/PIL/Image.py b/src/PIL/Image.py index 1adca9ad5b1..7e49e2c6993 100644 --- a/src/PIL/Image.py +++ b/src/PIL/Image.py @@ -878,12 +878,12 @@ def convert( "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 @@ def draft(self, mode, size): 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 @@ def histogram(self, mask=None, extrema=None): 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 @@ def entropy(self, mask=None, extrema=None): """ 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")) diff --git a/src/PIL/ImageChops.py b/src/PIL/ImageChops.py index 70120031797..0255f41b6f7 100644 --- a/src/PIL/ImageChops.py +++ b/src/PIL/ImageChops.py @@ -19,7 +19,7 @@ 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` """ diff --git a/src/PIL/ImageColor.py b/src/PIL/ImageColor.py index befc1fd1d88..894461c831d 100644 --- a/src/PIL/ImageColor.py +++ b/src/PIL/ImageColor.py @@ -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. diff --git a/src/PIL/ImageEnhance.py b/src/PIL/ImageEnhance.py index 3b79d5c46a1..d7fdec262f4 100644 --- a/src/PIL/ImageEnhance.py +++ b/src/PIL/ImageEnhance.py @@ -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): diff --git a/src/PIL/ImageOps.py b/src/PIL/ImageOps.py index 42f2152b39a..6d70f02483d 100644 --- a/src/PIL/ImageOps.py +++ b/src/PIL/ImageOps.py @@ -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 = [] diff --git a/src/PIL/ImageWin.py b/src/PIL/ImageWin.py index ca9b14c8adf..c7c64b35add 100644 --- a/src/PIL/ImageWin.py +++ b/src/PIL/ImageWin.py @@ -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. diff --git a/src/PIL/PSDraw.py b/src/PIL/PSDraw.py index 13b3048f67e..c01534bbf42 100644 --- a/src/PIL/PSDraw.py +++ b/src/PIL/PSDraw.py @@ -109,7 +109,7 @@ def image(self, box, im, dpi=None): 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 diff --git a/src/PIL/PalmImagePlugin.py b/src/PIL/PalmImagePlugin.py index a88a907917d..606739c8766 100644 --- a/src/PIL/PalmImagePlugin.py +++ b/src/PIL/PalmImagePlugin.py @@ -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) diff --git a/src/PIL/PcxImagePlugin.py b/src/PIL/PcxImagePlugin.py index 854d9e83ee7..67990b0adc1 100644 --- a/src/PIL/PcxImagePlugin.py +++ b/src/PIL/PcxImagePlugin.py @@ -91,7 +91,7 @@ def _open(self): 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) diff --git a/src/PIL/PngImagePlugin.py b/src/PIL/PngImagePlugin.py index 5e5a8cf6a2d..0ec12604d9e 100644 --- a/src/PIL/PngImagePlugin.py +++ b/src/PIL/PngImagePlugin.py @@ -56,7 +56,7 @@ _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 @@ (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 diff --git a/src/libImaging/Convert.c b/src/libImaging/Convert.c index b08519d3045..99d2a4ada70 100644 --- a/src/libImaging/Convert.c +++ b/src/libImaging/Convert.c @@ -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) { diff --git a/src/libImaging/Dib.c b/src/libImaging/Dib.c index f8a2901b8c7..1b5bfe1324e 100644 --- a/src/libImaging/Dib.c +++ b/src/libImaging/Dib.c @@ -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; diff --git a/src/libImaging/Pack.c b/src/libImaging/Pack.c index 14c8f1461aa..d47344245cc 100644 --- a/src/libImaging/Pack.c +++ b/src/libImaging/Pack.c @@ -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 */ diff --git a/src/libImaging/Palette.c b/src/libImaging/Palette.c index 059d7b72aca..78916bca52b 100644 --- a/src/libImaging/Palette.c +++ b/src/libImaging/Palette.c @@ -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; } diff --git a/src/libImaging/Quant.c b/src/libImaging/Quant.c index c84acb99889..398fbf6db57 100644 --- a/src/libImaging/Quant.c +++ b/src/libImaging/Quant.c @@ -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... */ diff --git a/src/libImaging/Storage.c b/src/libImaging/Storage.c index 128595f6547..b1b03c515ad 100644 --- a/src/libImaging/Storage.c +++ b/src/libImaging/Storage.c @@ -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; diff --git a/src/libImaging/Unpack.c b/src/libImaging/Unpack.c index 279bdcdc8ad..6c7d52f58d1 100644 --- a/src/libImaging/Unpack.c +++ b/src/libImaging/Unpack.c @@ -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 */