mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-01-13 02:36:17 +03:00
Use literal code blocks
This commit is contained in:
parent
9830abd19e
commit
5a8b8b95f6
22
CHANGES.rst
22
CHANGES.rst
|
@ -5057,7 +5057,7 @@ http://svn.effbot.org/public/pil/
|
||||||
and the documentation; this is a bug, and will most likely be fixed
|
and the documentation; this is a bug, and will most likely be fixed
|
||||||
in a future version. In this release, PIL prints a warning message
|
in a future version. In this release, PIL prints a warning message
|
||||||
instead. To silence the warning, change any calls of the form
|
instead. To silence the warning, change any calls of the form
|
||||||
"frombuffer(mode, size, data)" to
|
"frombuffer(mode, size, data)" to::
|
||||||
|
|
||||||
frombuffer(mode, size, data, "raw", mode, 0, 1)
|
frombuffer(mode, size, data, "raw", mode, 0, 1)
|
||||||
|
|
||||||
|
@ -5069,14 +5069,11 @@ http://svn.effbot.org/public/pil/
|
||||||
Image class (based on code by Travis Oliphant).
|
Image class (based on code by Travis Oliphant).
|
||||||
|
|
||||||
This allows you to easily convert between PIL image memories and
|
This allows you to easily convert between PIL image memories and
|
||||||
NumPy arrays:
|
NumPy arrays::
|
||||||
|
|
||||||
import numpy, Image
|
import numpy, Image
|
||||||
|
|
||||||
im = Image.open('hopper.jpg')
|
im = Image.open('hopper.jpg')
|
||||||
|
|
||||||
a = numpy.asarray(im) # a is readonly
|
a = numpy.asarray(im) # a is readonly
|
||||||
|
|
||||||
im = Image.fromarray(a)
|
im = Image.fromarray(a)
|
||||||
|
|
||||||
- Fixed CMYK polarity for JPEG images, by treating all images as
|
- Fixed CMYK polarity for JPEG images, by treating all images as
|
||||||
|
@ -5128,7 +5125,7 @@ http://svn.effbot.org/public/pil/
|
||||||
|
|
||||||
- Added pixel access object. The "load" method now returns a
|
- Added pixel access object. The "load" method now returns a
|
||||||
access object that can be used to directly get and set pixel
|
access object that can be used to directly get and set pixel
|
||||||
values, using ordinary [x, y] notation:
|
values, using ordinary [x, y] notation::
|
||||||
|
|
||||||
pixel = im.load()
|
pixel = im.load()
|
||||||
v = pixel[x, y]
|
v = pixel[x, y]
|
||||||
|
@ -5363,7 +5360,7 @@ http://svn.effbot.org/public/pil/
|
||||||
- Added optional "encoding" argument to the ImageFont.truetype
|
- Added optional "encoding" argument to the ImageFont.truetype
|
||||||
factory. This argument can be used to specify non-Unicode character
|
factory. This argument can be used to specify non-Unicode character
|
||||||
maps for fonts that support that. For example, to draw text using
|
maps for fonts that support that. For example, to draw text using
|
||||||
the Microsoft Symbol font, use:
|
the Microsoft Symbol font, use::
|
||||||
|
|
||||||
font = ImageFont.truetype("symbol.ttf", 16, encoding="symb")
|
font = ImageFont.truetype("symbol.ttf", 16, encoding="symb")
|
||||||
draw.text((0, 0), unichr(0xF000 + 0xAA))
|
draw.text((0, 0), unichr(0xF000 + 0xAA))
|
||||||
|
@ -5661,7 +5658,7 @@ http://svn.effbot.org/public/pil/
|
||||||
|
|
||||||
- Added DPI read/write support to the JPEG codec. The decoder
|
- Added DPI read/write support to the JPEG codec. The decoder
|
||||||
sets the info["dpi"] attribute for JPEG files with JFIF dpi
|
sets the info["dpi"] attribute for JPEG files with JFIF dpi
|
||||||
settings. The encoder uses the "dpi" option:
|
settings. The encoder uses the "dpi" option::
|
||||||
|
|
||||||
im = Image.open("file.jpg")
|
im = Image.open("file.jpg")
|
||||||
dpi = im.info["dpi"] # raises KeyError if DPI not known
|
dpi = im.info["dpi"] # raises KeyError if DPI not known
|
||||||
|
@ -5858,7 +5855,7 @@ http://svn.effbot.org/public/pil/
|
||||||
-----
|
-----
|
||||||
|
|
||||||
- Added Toby J. Sargeant's quantization package. To enable
|
- Added Toby J. Sargeant's quantization package. To enable
|
||||||
quantization, use the "palette" option to "convert":
|
quantization, use the "palette" option to "convert"::
|
||||||
|
|
||||||
imOut = im.convert("P", palette=Image.ADAPTIVE)
|
imOut = im.convert("P", palette=Image.ADAPTIVE)
|
||||||
|
|
||||||
|
@ -5952,7 +5949,7 @@ The test suite includes 825 individual tests.
|
||||||
- The Image "histogram" method now works for "I" and "F" images.
|
- The Image "histogram" method now works for "I" and "F" images.
|
||||||
For these modes, PIL divides the range between the min and
|
For these modes, PIL divides the range between the min and
|
||||||
max values used in the image into 256 bins. You can also
|
max values used in the image into 256 bins. You can also
|
||||||
pass in your own min and max values via the "extrema" option:
|
pass in your own min and max values via the "extrema" option::
|
||||||
|
|
||||||
h = im.histogram(extrema=(0, 255))
|
h = im.histogram(extrema=(0, 255))
|
||||||
|
|
||||||
|
@ -5969,7 +5966,7 @@ The test suite includes 825 individual tests.
|
||||||
- Added JPEG "save" and "draft" support for mode "YCbCr" images.
|
- Added JPEG "save" and "draft" support for mode "YCbCr" images.
|
||||||
Note that if you save an "YCbCr" image as a JPEG file and read
|
Note that if you save an "YCbCr" image as a JPEG file and read
|
||||||
it back, it is read as an RGB file. To get around this, you
|
it back, it is read as an RGB file. To get around this, you
|
||||||
can use the "draft" method:
|
can use the "draft" method::
|
||||||
|
|
||||||
im = Image.open("color.jpg")
|
im = Image.open("color.jpg")
|
||||||
im.draft("YCbCr", im.size)
|
im.draft("YCbCr", im.size)
|
||||||
|
@ -6006,7 +6003,7 @@ The test suite includes 750 individual tests.
|
||||||
to make the methods compatible with the "fromstring"
|
to make the methods compatible with the "fromstring"
|
||||||
factory function.
|
factory function.
|
||||||
|
|
||||||
To get the old behaviour, use the following syntax:
|
To get the old behaviour, use the following syntax::
|
||||||
|
|
||||||
data = im.tostring("raw", "RGBX", 0, -1)
|
data = im.tostring("raw", "RGBX", 0, -1)
|
||||||
im.fromstring(data, "raw", "RGBX", 0, -1)
|
im.fromstring(data, "raw", "RGBX", 0, -1)
|
||||||
|
@ -6026,6 +6023,7 @@ The test suite includes 750 individual tests.
|
||||||
uses floyd-steinberg error diffusion for "P" and "1" targets,
|
uses floyd-steinberg error diffusion for "P" and "1" targets,
|
||||||
so this option is only used to *disable* dithering. Allowed
|
so this option is only used to *disable* dithering. Allowed
|
||||||
values are NONE (no dithering) or FLOYDSTEINBERG (default).
|
values are NONE (no dithering) or FLOYDSTEINBERG (default).
|
||||||
|
::
|
||||||
|
|
||||||
imOut = im.convert("P", dither=Image.NONE)
|
imOut = im.convert("P", dither=Image.NONE)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user