Removed whitespace from blank lines

This commit is contained in:
Andrew Murray 2016-09-03 12:23:42 +10:00
parent 00cb14afd7
commit 572a3d970c
27 changed files with 140 additions and 140 deletions

View File

@ -18,7 +18,7 @@ Changelog (Pillow)
- Skip failing numpy tests on Pypy <= 5.3.1 #2090 - Skip failing numpy tests on Pypy <= 5.3.1 #2090
[arjennienhuis] [arjennienhuis]
- Show warning when trying to save RGBA image as JPEG #2010 - Show warning when trying to save RGBA image as JPEG #2010
[homm] [homm]
@ -33,16 +33,16 @@ Changelog (Pillow)
- Add ImageOps.scale to expand or contract a PIL image by a factor #2011 - Add ImageOps.scale to expand or contract a PIL image by a factor #2011
[vlmath] [vlmath]
- Flake8 fixes #2050 - Flake8 fixes #2050
[hugovk] [hugovk]
- Updated freetype to 2.6.5 on Appveyor builds #2035 - Updated freetype to 2.6.5 on Appveyor builds #2035
[radarhere] [radarhere]
- PCX encoder fixes #2023, pr #2041 - PCX encoder fixes #2023, pr #2041
[homm] [homm]
- Docs: Windows console prompts are > #2031 - Docs: Windows console prompts are > #2031
[techtonik] [techtonik]
@ -72,7 +72,7 @@ Changelog (Pillow)
- Fix issue converting P mode to LA #1986 - Fix issue converting P mode to LA #1986
[didrix] [didrix]
- Moved test_j2k_overflow to check_j2k_overflow, prevent DOS of our 32bit testing machines #1995 - Moved test_j2k_overflow to check_j2k_overflow, prevent DOS of our 32bit testing machines #1995
[wiredfool] [wiredfool]
@ -99,10 +99,10 @@ Changelog (Pillow)
- test_imagecms: Reduce precision of extended info due to 32 bit machine precision #1990 - test_imagecms: Reduce precision of extended info due to 32 bit machine precision #1990
[AbdealiJK] [AbdealiJK]
- Binary Tiff Metadata/ICC profile. #1988 - Binary Tiff Metadata/ICC profile. #1988
[wiredfool] [wiredfool]
- Ignore large text blocks in PNG if LOAD_TRUNCATED_IMAGES is enabled #1970 - Ignore large text blocks in PNG if LOAD_TRUNCATED_IMAGES is enabled #1970
[homm] [homm]
@ -111,7 +111,7 @@ Changelog (Pillow)
- Skip extra 0xff00 in jpeg #1977 - Skip extra 0xff00 in jpeg #1977
[kkopachev] [kkopachev]
- Use bytearray for palette mutable storage #1985 - Use bytearray for palette mutable storage #1985
[radarhere, wiredfool] [radarhere, wiredfool]
@ -123,7 +123,7 @@ Changelog (Pillow)
- Changed depends/install_*.sh urls to point to github pillow-depends repo #1983 - Changed depends/install_*.sh urls to point to github pillow-depends repo #1983
[wiredfool] [wiredfool]
- Allow ICC profile from `encoderinfo` while saving PNGs #1909 - Allow ICC profile from `encoderinfo` while saving PNGs #1909
[homm] [homm]
@ -138,7 +138,7 @@ Changelog (Pillow)
- Change equals method on Image so it short circuits #1967 - Change equals method on Image so it short circuits #1967
[mattBoros] [mattBoros]
- Runtime loading of TCL/TK libraries, eliminating build time dependency. #1932 - Runtime loading of TCL/TK libraries, eliminating build time dependency. #1932
[matthew-brett] [matthew-brett]
@ -300,7 +300,7 @@ Changelog (Pillow)
- Added install docs for Fedora 23 and FreeBSD #1729, #1739, #1792 - Added install docs for Fedora 23 and FreeBSD #1729, #1739, #1792
[koobs, zandermartin, wiredfool] [koobs, zandermartin, wiredfool]
- Fixed TIFF multiframe load when the frames have different compression types #1782 - Fixed TIFF multiframe load when the frames have different compression types #1782
[radarhere, geka000] [radarhere, geka000]
@ -309,7 +309,7 @@ Changelog (Pillow)
- Updated dates in PIL license in OleFileIO README #1787 - Updated dates in PIL license in OleFileIO README #1787
[radarhere] [radarhere]
- Corrected Tiff tag names #1786 - Corrected Tiff tag names #1786
[radarhere] [radarhere]
@ -360,7 +360,7 @@ Changelog (Pillow)
- Add a loader for the FTEX format from Independence War 2: Edge of Chaos #1688 - Add a loader for the FTEX format from Independence War 2: Edge of Chaos #1688
[jleclanche] [jleclanche]
- Improved alpha_composite documentation #1698 - Improved alpha_composite documentation #1698
[radarhere] [radarhere]
@ -378,7 +378,7 @@ Changelog (Pillow)
- Fixed support for .gbr version 1 images, added support for version 2 in GbrImagePlugin #1653 - Fixed support for .gbr version 1 images, added support for version 2 in GbrImagePlugin #1653
[wiredfool] [wiredfool]
- Clarified which YCbCr format is used #1677 - Clarified which YCbCr format is used #1677
[radarhere] [radarhere]
@ -455,7 +455,7 @@ Changelog (Pillow)
- Updated installation docs for new versions of dependencies #1611 - Updated installation docs for new versions of dependencies #1611
[radarhere] [radarhere]
- Removed unrunnable test file #1610 - Removed unrunnable test file #1610
[radarhere] [radarhere]
@ -464,7 +464,7 @@ Changelog (Pillow)
- Added field type constants to TiffTags #1596 - Added field type constants to TiffTags #1596
[radarhere] [radarhere]
- Allow saving RowsPerStrip with libtiff #1594 - Allow saving RowsPerStrip with libtiff #1594
[wiredfool] [wiredfool]
@ -473,10 +473,10 @@ Changelog (Pillow)
- Changed some urls in the docs to use https #1580 - Changed some urls in the docs to use https #1580
[hugovk] [hugovk]
- Removed logger.exception from ImageFile.py #1590 - Removed logger.exception from ImageFile.py #1590
[radarhere] [radarhere]
- Removed warnings module check #1587 - Removed warnings module check #1587
[radarhere] [radarhere]
@ -491,7 +491,7 @@ Changelog (Pillow)
- Consistent multiline text spacing #1574 - Consistent multiline text spacing #1574
[wiredfool, hugovk] [wiredfool, hugovk]
- Removed unused lines in BDFFontFile #1530 - Removed unused lines in BDFFontFile #1530
[radarhere] [radarhere]
@ -509,19 +509,19 @@ Changelog (Pillow)
- Docs and code health fixes #1565 #1566 #1581 #1586 #1591 #1621 - Docs and code health fixes #1565 #1566 #1581 #1586 #1591 #1621
[radarhere] [radarhere]
- Updated freetype to 2.6.2 #1564 - Updated freetype to 2.6.2 #1564
[radarhere] [radarhere]
- Updated WebP to 0.5.0 for Travis #1515 #1609 - Updated WebP to 0.5.0 for Travis #1515 #1609
[radarhere] [radarhere]
- Fix missing 'version' key value in __array_interface__ #1519 - Fix missing 'version' key value in __array_interface__ #1519
[mattip] [mattip]
- Replaced os.popen with subprocess.Popen to pilprint script #1523 - Replaced os.popen with subprocess.Popen to pilprint script #1523
[radarhere] [radarhere]
- Catch OverflowError in SpiderImagePlugin #1545 - Catch OverflowError in SpiderImagePlugin #1545
[radarhere, MrShark] [radarhere, MrShark]
@ -533,7 +533,7 @@ Changelog (Pillow)
- Fix Exception when requiring jpeg #1501 - Fix Exception when requiring jpeg #1501
[hansmosh] [hansmosh]
- Dependency scripts for Debian and Ubuntu #1486 - Dependency scripts for Debian and Ubuntu #1486
[wiredfool] [wiredfool]
@ -566,28 +566,28 @@ Changelog (Pillow)
- Added PDF multipage saving #1445 - Added PDF multipage saving #1445
[radarhere] [radarhere]
- Removed deprecated code, Image.tostring, Image.fromstring, Image.offset, ImageDraw.setink, ImageDraw.setfill, ImageFileIO, ImageFont.FreeTypeFont and ImageFont.truetype `file` kwarg, ImagePalette private _make functions, ImageWin.fromstring and ImageWin.tostring #1343 - Removed deprecated code, Image.tostring, Image.fromstring, Image.offset, ImageDraw.setink, ImageDraw.setfill, ImageFileIO, ImageFont.FreeTypeFont and ImageFont.truetype `file` kwarg, ImagePalette private _make functions, ImageWin.fromstring and ImageWin.tostring #1343
[radarhere] [radarhere]
- Load more broken images #1428 - Load more broken images #1428
[homm] [homm]
- Require zlib and libjpeg #1439 - Require zlib and libjpeg #1439
[wiredfool] [wiredfool]
- Preserve alpha when converting from a QImage to a Pillow Image by using png instead of ppm #1429 - Preserve alpha when converting from a QImage to a Pillow Image by using png instead of ppm #1429
[ericfrederich] [ericfrederich]
- Qt needs 32 bit aligned image data #1430 - Qt needs 32 bit aligned image data #1430
[ericfrederich] [ericfrederich]
- Tiff ImageFileDirectory rewrite #1419 - Tiff ImageFileDirectory rewrite #1419
[anntzer, wiredfool, homm] [anntzer, wiredfool, homm]
- Removed spammy debug logging #1423 - Removed spammy debug logging #1423
[wiredfool] [wiredfool]
- Save as GiF89a with support for animation parameters #1384 - Save as GiF89a with support for animation parameters #1384
[radarhere] [radarhere]
@ -608,19 +608,19 @@ Changelog (Pillow)
- Single threaded build for pypy3, refactor #1413 - Single threaded build for pypy3, refactor #1413
[wiredfool] [wiredfool]
- Fix loading of truncated images with LOAD_TRUNCATED_IMAGES enabled #1366 - Fix loading of truncated images with LOAD_TRUNCATED_IMAGES enabled #1366
[homm] [homm]
- Documentation update for concepts: bands - Documentation update for concepts: bands
[merriam] [merriam]
- Add Solaris/SmartOS include and library directories #1356 - Add Solaris/SmartOS include and library directories #1356
[njones11] [njones11]
- Improved handling of getink color #1387 - Improved handling of getink color #1387
[radarhere] [radarhere]
- Disable compiler optimizations for topalette and tobilevel functions for all msvc versions, fixes #1357 - Disable compiler optimizations for topalette and tobilevel functions for all msvc versions, fixes #1357
[cgohlke] [cgohlke]
@ -656,10 +656,10 @@ Changelog (Pillow)
- Fix fast rotate operations #1373 - Fix fast rotate operations #1373
[radarhere] [radarhere]
- Added support for pathlib Path objects to open and save #1372 - Added support for pathlib Path objects to open and save #1372
[radarhere] [radarhere]
- Changed register calls to use format property #1333 - Changed register calls to use format property #1333
[radarhere] [radarhere]
@ -677,7 +677,7 @@ Changelog (Pillow)
- Added various tests #1330, #1344 - Added various tests #1330, #1344
[radarhere] [radarhere]
- More ImageFont tests #1327 - More ImageFont tests #1327
[hugovk] [hugovk]
@ -704,10 +704,10 @@ Changelog (Pillow)
- Added width and height properties #1304 - Added width and height properties #1304
[radarhere] [radarhere]
- Update tiff and tk tcl 8.5 versions #1303 - Update tiff and tk tcl 8.5 versions #1303
[radarhere, wiredfool] [radarhere, wiredfool]
- Add functions to convert: Image <-> QImage; Image <-> QPixmap #1217 - Add functions to convert: Image <-> QImage; Image <-> QPixmap #1217
[radarhere, rominf] [radarhere, rominf]
@ -716,19 +716,19 @@ Changelog (Pillow)
- Multiline text in ImageDraw #1177 - Multiline text in ImageDraw #1177
[allo-, radarhere] [allo-, radarhere]
- Automated Windows CI/build support #1278 - Automated Windows CI/build support #1278
[wiredfool] [wiredfool]
- Removed support for Tk versions earlier than 8.4 #1288 - Removed support for Tk versions earlier than 8.4 #1288
[radarhere] [radarhere]
- Fixed polygon edge drawing #1255 (fixes #1252) - Fixed polygon edge drawing #1255 (fixes #1252)
[radarhere] [radarhere]
- Check prefix length in _accept methods #1267 - Check prefix length in _accept methods #1267
[radarhere] [radarhere]
- Register MIME type for BMP #1277 - Register MIME type for BMP #1277
[coldmind] [coldmind]
@ -737,7 +737,7 @@ Changelog (Pillow)
- Identify XBM file created with filename including underscore #1230 (fixes #1229) - Identify XBM file created with filename including underscore #1230 (fixes #1229)
[hugovk] [hugovk]
- Copy image when saving in GifImagePlugin #1231 (fixes #718) - Copy image when saving in GifImagePlugin #1231 (fixes #718)
[radarhere] [radarhere]
@ -761,7 +761,7 @@ Changelog (Pillow)
- Setting transparency value to 0 when the tRNS contains only null byte(s) #1239 - Setting transparency value to 0 when the tRNS contains only null byte(s) #1239
[juztin] [juztin]
- Separated out feature checking from selftest #1233 - Separated out feature checking from selftest #1233
[radarhere] [radarhere]
@ -830,7 +830,7 @@ Changelog (Pillow)
- Fix ImagingEffectNoise #1128 - Fix ImagingEffectNoise #1128
[hugovk] [hugovk]
- Remove unreachable code - Remove unreachable code
[hugovk] [hugovk]
@ -842,13 +842,13 @@ Changelog (Pillow)
- Fast path for opaque pixels in RGBa unpacker #1088 - Fast path for opaque pixels in RGBa unpacker #1088
[bgilbert] [bgilbert]
- Enable basic support for 'RGBa' raw encoding/decoding #1096 - Enable basic support for 'RGBa' raw encoding/decoding #1096
[immerrr] [immerrr]
- Fix pickling L mode images with no palette, #1095 - Fix pickling L mode images with no palette, #1095
[hugovk] [hugovk]
- iPython display hook #1091 - iPython display hook #1091
[wiredfool] [wiredfool]
@ -872,13 +872,13 @@ Changelog (Pillow)
- Use underscores, not spaces, in TIFF tag kwargs. #1044, #1058 - Use underscores, not spaces, in TIFF tag kwargs. #1044, #1058
[anntzer, hugovk] [anntzer, hugovk]
- Update PSDraw for Python3, add tests. #1055 - Update PSDraw for Python3, add tests. #1055
[hugovk] [hugovk]
- Use Bicubic filtering by default for thumbnails. Don't use Jpeg Draft mode for thumbnails. #1029 - Use Bicubic filtering by default for thumbnails. Don't use Jpeg Draft mode for thumbnails. #1029
[homm] [homm]
- Fix MSVC compiler error: Use Py_ssize_t instead of ssize_t #1051 - Fix MSVC compiler error: Use Py_ssize_t instead of ssize_t #1051
[cgohlke] [cgohlke]
@ -902,7 +902,7 @@ Changelog (Pillow)
- Fix for saving TIFF image into an io.BytesIO buffer #1011 - Fix for saving TIFF image into an io.BytesIO buffer #1011
[mfergie] [mfergie]
- Fix antialias compilation on debug versions of Python #1010 - Fix antialias compilation on debug versions of Python #1010
[wiredfool] [wiredfool]
@ -914,7 +914,7 @@ Changelog (Pillow)
- Use PyQt4 if it has already been imported, otherwise prefer PyQt5. #1003 - Use PyQt4 if it has already been imported, otherwise prefer PyQt5. #1003
[AurelienBallier] [AurelienBallier]
- Speedup resample implementation up to 2.5 times. #977 - Speedup resample implementation up to 2.5 times. #977
[homm] [homm]
@ -935,7 +935,7 @@ Changelog (Pillow)
- Webp Metadata Skip Test comments #954 - Webp Metadata Skip Test comments #954
[wiredfool] [wiredfool]
- Fixes for things rpmlint complains about #942 - Fixes for things rpmlint complains about #942
[manisandro] [manisandro]
@ -953,7 +953,7 @@ Changelog (Pillow)
- Fix SciPy regression in Image.resize #945 - Fix SciPy regression in Image.resize #945
[wiredfool] [wiredfool]
- Fix manifest to include all test files. - Fix manifest to include all test files.
[aclark4life] [aclark4life]
@ -971,13 +971,13 @@ Changelog (Pillow)
- Use redistributable ICC profiles for testing, skip if not available #923 - Use redistributable ICC profiles for testing, skip if not available #923
[wiredfool] [wiredfool]
- Additional documentation for JPEG info and save options #890 - Additional documentation for JPEG info and save options #890
[wiredfool] [wiredfool]
- Fix JPEG Encoding memory leak when exif or qtables were specified - Fix JPEG Encoding memory leak when exif or qtables were specified
[wiredfool] [wiredfool]
- Image.tobytes() and Image.tostring() documentation update #916 #917 - Image.tobytes() and Image.tostring() documentation update #916 #917
[mgedmin] [mgedmin]
@ -1043,7 +1043,7 @@ Changelog (Pillow)
- Added support for reading MPO files - Added support for reading MPO files
[Feneric] [Feneric]
- Added support for encoding and decoding iTXt chunks #818 - Added support for encoding and decoding iTXt chunks #818
[dolda2000] [dolda2000]
@ -1093,7 +1093,7 @@ Changelog (Pillow)
- Fixed CVE-2014-3589, a DOS in the IcnsImagePlugin (backport) - Fixed CVE-2014-3589, a DOS in the IcnsImagePlugin (backport)
[Andrew Drake] [Andrew Drake]
2.5.1 (2014-07-10) 2.5.1 (2014-07-10)
------------------ ------------------
@ -1114,10 +1114,10 @@ Changelog (Pillow)
- Prevent shell injection #748 - Prevent shell injection #748
[mbrown1413, wiredfool] [mbrown1413, wiredfool]
- Support for Resolution in BMP files #734 - Support for Resolution in BMP files #734
[gcq] [gcq]
- Fix error in setup.py for Python 3 - Fix error in setup.py for Python 3
[matthew-brett] [matthew-brett]

View File

@ -85,7 +85,7 @@ def _parse_jp2_header(fp):
mode = None mode = None
bpc = None bpc = None
nc = None nc = None
hio = io.BytesIO(header) hio = io.BytesIO(header)
while True: while True:
lbox, tbox = struct.unpack('>I4s', hio.read(8)) lbox, tbox = struct.unpack('>I4s', hio.read(8))
@ -144,7 +144,7 @@ def _parse_jp2_header(fp):
if size is None or mode is None: if size is None or mode is None:
raise SyntaxError("Malformed jp2 header") raise SyntaxError("Malformed jp2 header")
return (size, mode) return (size, mode)
## ##

View File

@ -11,7 +11,7 @@ Install::
pip install coverage nose pip install coverage nose
If you're using Python 2.6, there's one additional dependency:: If you're using Python 2.6, there's one additional dependency::
pip install unittest2 pip install unittest2
Execution Execution

View File

@ -472,11 +472,11 @@ class TestFileTiff(PillowTestCase):
tmpfile = self.tempfile("temp.tif") tmpfile = self.tempfile("temp.tif")
im.save(tmpfile) im.save(tmpfile)
reloaded = Image.open(tmpfile) reloaded = Image.open(tmpfile)
self.assert_image_equal(im, reloaded) self.assert_image_equal(im, reloaded)
if __name__ == '__main__': if __name__ == '__main__':
unittest.main() unittest.main()

View File

@ -81,7 +81,7 @@ class TestImageOps(PillowTestCase):
def test_scale(self): def test_scale(self):
# Test the scaling function # Test the scaling function
i = hopper("L").resize((50, 50)) i = hopper("L").resize((50, 50))
with self.assertRaises(ValueError): with self.assertRaises(ValueError):
ImageOps.scale(i, -1) ImageOps.scale(i, -1)

View File

@ -119,9 +119,9 @@ getfont(PyObject* self_, PyObject* args, PyObject* kw)
PyMem_Free(filename); PyMem_Free(filename);
return NULL; return NULL;
} }
self->face = NULL; self->face = NULL;
if (filename && font_bytes_size <= 0) { if (filename && font_bytes_size <= 0) {
self->font_bytes = NULL; self->font_bytes = NULL;
error = FT_New_Face(library, filename, index, &self->face); error = FT_New_Face(library, filename, index, &self->face);
@ -246,11 +246,11 @@ font_getsize(FontObject* self, PyObject* args)
y_max = bbox.yMax; y_max = bbox.yMax;
if (bbox.yMin < y_min) if (bbox.yMin < y_min)
y_min = bbox.yMin; y_min = bbox.yMin;
/* find max distance of baseline from top */ /* find max distance of baseline from top */
if (face->glyph->metrics.horiBearingY > yoffset) if (face->glyph->metrics.horiBearingY > yoffset)
yoffset = face->glyph->metrics.horiBearingY; yoffset = face->glyph->metrics.horiBearingY;
last_index = index; last_index = index;
FT_Done_Glyph(glyph); FT_Done_Glyph(glyph);
} }

View File

@ -231,7 +231,7 @@ get_on_pixels(PyObject *self, PyObject* args)
int row_idx, col_idx; int row_idx, col_idx;
int width, height; int width, height;
PyObject *ret = PyList_New(0); PyObject *ret = PyList_New(0);
if (!PyArg_ParseTuple(args, "n", &i0)) { if (!PyArg_ParseTuple(args, "n", &i0)) {
PyErr_SetString(PyExc_RuntimeError, "Argument parsing problem"); PyErr_SetString(PyExc_RuntimeError, "Argument parsing problem");
@ -241,7 +241,7 @@ get_on_pixels(PyObject *self, PyObject* args)
rows = img->image8; rows = img->image8;
width = img->xsize; width = img->xsize;
height = img->ysize; height = img->ysize;
for (row_idx=0; row_idx < height; row_idx++) { for (row_idx=0; row_idx < height; row_idx++) {
UINT8 *row = rows[row_idx]; UINT8 *row = rows[row_idx];
for (col_idx=0; col_idx<width; col_idx++) { for (col_idx=0; col_idx<width; col_idx++) {

View File

@ -24,4 +24,4 @@ e.g.::
$ source ~/vpy27/bin/activate $ source ~/vpy27/bin/activate
$ make install $ make install
$ make test $ make test

View File

@ -29,7 +29,7 @@ RUN apk --no-cache add python \
RUN apk --no-cache add git \ RUN apk --no-cache add git \
bash \ bash \
sudo sudo
RUN git clone https://github.com/python-pillow/Pillow.git /Pillow RUN git clone https://github.com/python-pillow/Pillow.git /Pillow
RUN pip install virtualenv && virtualenv /vpy && source /vpy/bin/activate && pip install nose RUN pip install virtualenv && virtualenv /vpy && source /vpy/bin/activate && pip install nose

View File

@ -295,7 +295,7 @@ Or for Python 3::
In Fedora, the command is:: In Fedora, the command is::
$ sudo dnf install python-devel redhat-rpm-config $ sudo dnf install python-devel redhat-rpm-config
Or for Python 3:: Or for Python 3::
$ sudo dnf install python3-devel redhat-rpm-config $ sudo dnf install python3-devel redhat-rpm-config

View File

@ -15,7 +15,7 @@ The following script loads an image, accesses one pixel from it, then
changes it. changes it.
.. code-block:: python .. code-block:: python
from PIL import Image from PIL import Image
im = Image.open('hopper.jpg') im = Image.open('hopper.jpg')
px = im.load() px = im.load()
@ -28,7 +28,7 @@ Results in the following::
(23, 24, 68) (23, 24, 68)
(0, 0, 0) (0, 0, 0)
:py:class:`PixelAccess` Class :py:class:`PixelAccess` Class
----------------------------------- -----------------------------------
@ -43,9 +43,9 @@ Results in the following::
:param xy: The pixel coordinate, given as (x, y). :param xy: The pixel coordinate, given as (x, y).
:param value: The pixel value. :param value: The pixel value.
.. method:: __getitem__(self, xy): .. method:: __getitem__(self, xy):
Returns the pixel at x,y. The pixel is returned as a single Returns the pixel at x,y. The pixel is returned as a single
value for single band images or a tuple for multiple band value for single band images or a tuple for multiple band
images images
@ -62,9 +62,9 @@ Results in the following::
:param xy: The pixel coordinate, given as (x, y). :param xy: The pixel coordinate, given as (x, y).
:param value: The pixel value. :param value: The pixel value.
.. method:: getpixel(self, xy): .. method:: getpixel(self, xy):
Returns the pixel at x,y. The pixel is returned as a single Returns the pixel at x,y. The pixel is returned as a single
value for single band images or a tuple for multiple band value for single band images or a tuple for multiple band
images images

View File

@ -16,7 +16,7 @@ Example
The following script loads an image, accesses one pixel from it, then changes it. The following script loads an image, accesses one pixel from it, then changes it.
.. code-block:: python .. code-block:: python
from PIL import Image from PIL import Image
im = Image.open('hopper.jpg') im = Image.open('hopper.jpg')
px = im.load() px = im.load()
@ -29,7 +29,7 @@ Results in the following::
(23, 24, 68) (23, 24, 68)
(0, 0, 0) (0, 0, 0)
:py:class:`PyAccess` Class :py:class:`PyAccess` Class
-------------------------- --------------------------

View File

@ -25,7 +25,7 @@ metadata tag numbers, names, and type information.
:param type: Integer type from :py:attr:`PIL.TiffTags.TYPES` :param type: Integer type from :py:attr:`PIL.TiffTags.TYPES`
:param length: Array length: 0 == variable, 1 == single value, n = fixed :param length: Array length: 0 == variable, 1 == single value, n = fixed
:param enum: Dict of name:integer value options for an enumeration :param enum: Dict of name:integer value options for an enumeration
.. method:: cvt_enum(self, value) .. method:: cvt_enum(self, value)
:param value: The enumerated value name :param value: The enumerated value name

View File

@ -161,7 +161,7 @@ _encode_to_pyfd(ImagingEncoderObject* encoder, PyObject* args)
status = encoder->encode(encoder->im, &encoder->state, status = encoder->encode(encoder->im, &encoder->state,
(UINT8*) NULL, 0); (UINT8*) NULL, 0);
result = Py_BuildValue("ii", status, encoder->state.errcode); result = Py_BuildValue("ii", status, encoder->state.errcode);
return result; return result;
@ -291,7 +291,7 @@ _setfd(ImagingEncoderObject* encoder, PyObject* args)
Py_XINCREF(fd); Py_XINCREF(fd);
state->fd = fd; state->fd = fd;
Py_INCREF(Py_None); Py_INCREF(Py_None);
return Py_None; return Py_None;
} }

View File

@ -294,7 +294,7 @@ rgb2hsv(UINT8* out, const UINT8* in, int xsize)
r = in[0]; r = in[0];
g = in[1]; g = in[1];
b = in[2]; b = in[2];
maxc = MAX(r,MAX(g,b)); maxc = MAX(r,MAX(g,b));
minc = MIN(r,MIN(g,b)); minc = MIN(r,MIN(g,b));
uv = maxc; uv = maxc;
@ -324,7 +324,7 @@ rgb2hsv(UINT8* out, const UINT8* in, int xsize)
*out++ = uh; *out++ = uh;
*out++ = us; *out++ = us;
*out++ = uv; *out++ = uv;
} }
*out++ = in[3]; *out++ = in[3];
} }
@ -333,18 +333,18 @@ rgb2hsv(UINT8* out, const UINT8* in, int xsize)
static void static void
hsv2rgb(UINT8* out, const UINT8* in, int xsize) hsv2rgb(UINT8* out, const UINT8* in, int xsize)
{ // following colorsys.py { // following colorsys.py
int p,q,t; int p,q,t;
UINT8 up,uq,ut; UINT8 up,uq,ut;
int i, x; int i, x;
float f, fs; float f, fs;
UINT8 h,s,v; UINT8 h,s,v;
for (x = 0; x < xsize; x++, in += 4) { for (x = 0; x < xsize; x++, in += 4) {
h = in[0]; h = in[0];
s = in[1]; s = in[1];
v = in[2]; v = in[2];
if (s==0){ if (s==0){
*out++ = v; *out++ = v;
*out++ = v; *out++ = v;
@ -360,7 +360,7 @@ hsv2rgb(UINT8* out, const UINT8* in, int xsize)
up = (UINT8)CLIP(p); up = (UINT8)CLIP(p);
uq = (UINT8)CLIP(q); uq = (UINT8)CLIP(q);
ut = (UINT8)CLIP(t); ut = (UINT8)CLIP(t);
switch (i%6) { switch (i%6) {
case 0: case 0:
*out++ = v; *out++ = v;
@ -392,7 +392,7 @@ hsv2rgb(UINT8* out, const UINT8* in, int xsize)
*out++ = up; *out++ = up;
*out++ = uq; *out++ = uq;
break; break;
} }
} }
*out++ = in[3]; *out++ = in[3];
@ -481,7 +481,7 @@ rgba2rgbA(UINT8* out, const UINT8* in, int xsize)
* where any pixel that matches the color will have the * where any pixel that matches the color will have the
* alpha channel set to 0 * alpha channel set to 0
*/ */
static void static void
rgbT2rgba(UINT8* out, int xsize, int r, int g, int b) rgbT2rgba(UINT8* out, int xsize, int r, int g, int b)
{ {
@ -502,7 +502,7 @@ rgbT2rgba(UINT8* out, int xsize, int r, int g, int b)
} }
} }
} }
/* ---------------- */ /* ---------------- */
/* CMYK conversions */ /* CMYK conversions */
@ -1383,7 +1383,7 @@ ImagingConvertTransparent(Imaging imIn, const char *mode,
if (!imIn){ if (!imIn){
return (Imaging) ImagingError_ModeError(); return (Imaging) ImagingError_ModeError();
} }
if (!((strcmp(imIn->mode, "RGB") == 0 || if (!((strcmp(imIn->mode, "RGB") == 0 ||
strcmp(imIn->mode, "L") == 0) strcmp(imIn->mode, "L") == 0)
&& strcmp(mode, "RGBA") == 0)) && strcmp(mode, "RGBA") == 0))

View File

@ -142,7 +142,7 @@ ImagingTranspose(Imaging imOut, Imaging imIn)
} }
ImagingSectionEnter(&cookie); ImagingSectionEnter(&cookie);
if (imIn->image8) if (imIn->image8)
TRANSPOSE(image8) TRANSPOSE(image8)
else else
@ -692,7 +692,7 @@ ImagingScaleAffine(Imaging imOut, Imaging imIn,
x1 = imOut->xsize; x1 = imOut->xsize;
if (y1 > imOut->ysize) if (y1 > imOut->ysize)
y1 = imOut->ysize; y1 = imOut->ysize;
/* malloc check ok, uses calloc for overflow */ /* malloc check ok, uses calloc for overflow */
xintab = (int*) calloc(imOut->xsize, sizeof(int)); xintab = (int*) calloc(imOut->xsize, sizeof(int));
if (!xintab) { if (!xintab) {
@ -873,7 +873,7 @@ ImagingTransformAffine(Imaging imOut, Imaging imIn,
/* FIXME: cannot really think of any reasonable case when the /* FIXME: cannot really think of any reasonable case when the
following code is used. maybe we should fall back on the slow following code is used. maybe we should fall back on the slow
generic transform engine in this case? */ generic transform engine in this case? */
ImagingCopyInfo(imOut, imIn); ImagingCopyInfo(imOut, imIn);
xsize = (int) imIn->xsize; xsize = (int) imIn->xsize;

View File

@ -40,7 +40,7 @@ typedef struct {
/* PRIVATE CONTEXT (set by decoder) */ /* PRIVATE CONTEXT (set by decoder) */
const char *error_msg; const char *error_msg;
} JPEG2KDECODESTATE; } JPEG2KDECODESTATE;
/* -------------------------------------------------------------------- */ /* -------------------------------------------------------------------- */

View File

@ -338,7 +338,7 @@ j2ku_srgb_rgb(opj_image_t *in, const JPEG2KTILEINFO *tileinfo,
UINT8 *row = (UINT8 *)im->image[y0 + y] + x0 * 4; UINT8 *row = (UINT8 *)im->image[y0 + y] + x0 * 4;
for (n = 0; n < 3; ++n) for (n = 0; n < 3; ++n)
data[n] = &cdata[n][csiz[n] * y * w]; data[n] = &cdata[n][csiz[n] * y * w];
for (x = 0; x < w; ++x) { for (x = 0; x < w; ++x) {
for (n = 0; n < 3; ++n) { for (n = 0; n < 3; ++n) {
UINT32 word = 0; UINT32 word = 0;
@ -391,7 +391,7 @@ j2ku_sycc_rgb(opj_image_t *in, const JPEG2KTILEINFO *tileinfo,
UINT8 *row_start = row; UINT8 *row_start = row;
for (n = 0; n < 3; ++n) for (n = 0; n < 3; ++n)
data[n] = &cdata[n][csiz[n] * y * w]; data[n] = &cdata[n][csiz[n] * y * w];
for (x = 0; x < w; ++x) { for (x = 0; x < w; ++x) {
for (n = 0; n < 3; ++n) { for (n = 0; n < 3; ++n) {
UINT32 word = 0; UINT32 word = 0;
@ -445,7 +445,7 @@ j2ku_srgba_rgba(opj_image_t *in, const JPEG2KTILEINFO *tileinfo,
UINT8 *row = (UINT8 *)im->image[y0 + y] + x0 * 4; UINT8 *row = (UINT8 *)im->image[y0 + y] + x0 * 4;
for (n = 0; n < 4; ++n) for (n = 0; n < 4; ++n)
data[n] = &cdata[n][csiz[n] * y * w]; data[n] = &cdata[n][csiz[n] * y * w];
for (x = 0; x < w; ++x) { for (x = 0; x < w; ++x) {
for (n = 0; n < 4; ++n) { for (n = 0; n < 4; ++n) {
UINT32 word = 0; UINT32 word = 0;
@ -497,7 +497,7 @@ j2ku_sycca_rgba(opj_image_t *in, const JPEG2KTILEINFO *tileinfo,
UINT8 *row_start = row; UINT8 *row_start = row;
for (n = 0; n < 4; ++n) for (n = 0; n < 4; ++n)
data[n] = &cdata[n][csiz[n] * y * w]; data[n] = &cdata[n][csiz[n] * y * w];
for (x = 0; x < w; ++x) { for (x = 0; x < w; ++x) {
for (n = 0; n < 4; ++n) { for (n = 0; n < 4; ++n) {
UINT32 word = 0; UINT32 word = 0;
@ -561,13 +561,13 @@ j2k_decode_entry(Imaging im, ImagingCodecState state)
unsigned n; unsigned n;
stream = opj_stream_create(BUFFER_SIZE, OPJ_TRUE); stream = opj_stream_create(BUFFER_SIZE, OPJ_TRUE);
if (!stream) { if (!stream) {
state->errcode = IMAGING_CODEC_BROKEN; state->errcode = IMAGING_CODEC_BROKEN;
state->state = J2K_STATE_FAILED; state->state = J2K_STATE_FAILED;
goto quick_exit; goto quick_exit;
} }
opj_stream_set_read_function(stream, j2k_read); opj_stream_set_read_function(stream, j2k_read);
opj_stream_set_skip_function(stream, j2k_skip); opj_stream_set_skip_function(stream, j2k_skip);
@ -589,13 +589,13 @@ j2k_decode_entry(Imaging im, ImagingCodecState state)
/* Setup decompression context */ /* Setup decompression context */
context->error_msg = NULL; context->error_msg = NULL;
opj_set_default_decoder_parameters(&params); opj_set_default_decoder_parameters(&params);
params.cp_reduce = context->reduce; params.cp_reduce = context->reduce;
params.cp_layer = context->layers; params.cp_layer = context->layers;
codec = opj_create_decompress(context->format); codec = opj_create_decompress(context->format);
if (!codec) { if (!codec) {
state->errcode = IMAGING_CODEC_BROKEN; state->errcode = IMAGING_CODEC_BROKEN;
state->state = J2K_STATE_FAILED; state->state = J2K_STATE_FAILED;
@ -618,7 +618,7 @@ j2k_decode_entry(Imaging im, ImagingCodecState state)
state->state = J2K_STATE_FAILED; state->state = J2K_STATE_FAILED;
goto quick_exit; goto quick_exit;
} }
for (n = 1; n < image->numcomps; ++n) { for (n = 1; n < image->numcomps; ++n) {
if (image->comps[n].dx != 1 || image->comps[n].dy != 1) { if (image->comps[n].dx != 1 || image->comps[n].dy != 1) {
state->errcode = IMAGING_CODEC_BROKEN; state->errcode = IMAGING_CODEC_BROKEN;
@ -626,7 +626,7 @@ j2k_decode_entry(Imaging im, ImagingCodecState state)
goto quick_exit; goto quick_exit;
} }
} }
/* /*
Colorspace Number of components PIL mode Colorspace Number of components PIL mode
------------------------------------------------------ ------------------------------------------------------
@ -635,22 +635,22 @@ j2k_decode_entry(Imaging im, ImagingCodecState state)
gray 1 L or I gray 1 L or I
gray 2 LA gray 2 LA
YCC 3 YCbCr YCC 3 YCbCr
If colorspace is unspecified, we assume: If colorspace is unspecified, we assume:
Number of components Colorspace Number of components Colorspace
----------------------------------------- -----------------------------------------
1 gray 1 gray
2 gray (+ alpha) 2 gray (+ alpha)
3 sRGB 3 sRGB
4 sRGB (+ alpha) 4 sRGB (+ alpha)
*/ */
/* Find the correct unpacker */ /* Find the correct unpacker */
color_space = image->color_space; color_space = image->color_space;
if (color_space == OPJ_CLRSPC_UNSPECIFIED) { if (color_space == OPJ_CLRSPC_UNSPECIFIED) {
switch (image->numcomps) { switch (image->numcomps) {
case 1: case 2: color_space = OPJ_CLRSPC_GRAY; break; case 1: case 2: color_space = OPJ_CLRSPC_GRAY; break;
@ -756,7 +756,7 @@ j2k_decode_entry(Imaging im, ImagingCodecState state)
context->pfile = NULL; context->pfile = NULL;
} }
} }
quick_exit: quick_exit:
if (codec) if (codec)
opj_destroy_codec(codec); opj_destroy_codec(codec);
@ -783,7 +783,7 @@ ImagingJpeg2KDecode(Imaging im, ImagingCodecState state, UINT8* buf, int bytes)
if (state->state == J2K_STATE_START) { if (state->state == J2K_STATE_START) {
state->state = J2K_STATE_DECODING; state->state = J2K_STATE_DECODING;
return j2k_decode_entry(im, state); return j2k_decode_entry(im, state);
} }
@ -806,7 +806,7 @@ ImagingJpeg2KDecodeCleanup(ImagingCodecState state) {
if (context->error_msg) { if (context->error_msg) {
free ((void *)context->error_msg); free ((void *)context->error_msg);
} }
context->error_msg = NULL; context->error_msg = NULL;
return -1; return -1;

View File

@ -70,11 +70,11 @@ j2k_skip(OPJ_OFF_T p_nb_bytes, void *p_user_data)
if (!buffer) { if (!buffer) {
return (OPJ_OFF_T)-1; return (OPJ_OFF_T)-1;
} }
result = _imaging_write_pyFd(state->fd, buffer, p_nb_bytes); result = _imaging_write_pyFd(state->fd, buffer, p_nb_bytes);
free(buffer); free(buffer);
return result ? result : p_nb_bytes; return result ? result : p_nb_bytes;
} }
@ -368,7 +368,7 @@ j2k_encode_entry(Imaging im, ImagingCodecState state)
context->error_msg = NULL; context->error_msg = NULL;
opj_set_default_encoder_parameters(&params); opj_set_default_encoder_parameters(&params);
params.image_offset_x0 = context->offset_x; params.image_offset_x0 = context->offset_x;
params.image_offset_y0 = context->offset_y; params.image_offset_y0 = context->offset_y;

View File

@ -388,7 +388,7 @@ packI16N_I16B(UINT8* out, const UINT8* in, int pixels){
C16B; C16B;
out += 2; tmp += 2; out += 2; tmp += 2;
} }
} }
static void static void
packI16N_I16(UINT8* out, const UINT8* in, int pixels){ packI16N_I16(UINT8* out, const UINT8* in, int pixels){

View File

@ -1114,7 +1114,7 @@ k_means(Pixel *pixelData,
goto error_1; goto error_1;
} }
} }
/* this is enough of a check, since the multiplication n*size is done above */ /* this is enough of a check, since the multiplication n*size is done above */
if (nPaletteEntries > UINT32_MAX / nPaletteEntries) { if (nPaletteEntries > UINT32_MAX / nPaletteEntries) {
goto error_1; goto error_1;
@ -1425,7 +1425,7 @@ quantize2(Pixel *pixelData,
uint32_t *qp; uint32_t *qp;
uint32_t *avgDist; uint32_t *avgDist;
uint32_t **avgDistSortKey; uint32_t **avgDistSortKey;
/* malloc check ok, using calloc */ /* malloc check ok, using calloc */
p=calloc(nQuantPixels, sizeof(Pixel)); p=calloc(nQuantPixels, sizeof(Pixel));
if (!p) return 0; if (!p) return 0;

View File

@ -137,7 +137,7 @@ int ImagingQuantHeapTop(Heap *h,void **r) {
Heap *ImagingQuantHeapNew(HeapCmpFunc cf) { Heap *ImagingQuantHeapNew(HeapCmpFunc cf) {
Heap *h; Heap *h;
/* malloc check ok, small constant allocation */ /* malloc check ok, small constant allocation */
h=malloc(sizeof(Heap)); h=malloc(sizeof(Heap));
if (!h) return NULL; if (!h) return NULL;

View File

@ -59,7 +59,7 @@ ImagingRankFilter(Imaging im, int size, int rank)
if (!(size & 1)) if (!(size & 1))
return (Imaging) ImagingError_ValueError("bad filter size"); return (Imaging) ImagingError_ValueError("bad filter size");
/* malloc check ok, for overflow in the define below */ /* malloc check ok, for overflow in the define below */
if (size > INT_MAX / size || if (size > INT_MAX / size ||
size > INT_MAX / (size * sizeof(FLOAT32))) { size > INT_MAX / (size * sizeof(FLOAT32))) {

View File

@ -906,7 +906,7 @@ unpackI16N_I16B(UINT8* out, const UINT8* in, int pixels){
C16B; C16B;
in += 2; tmp += 2; in += 2; tmp += 2;
} }
} }
static void static void
unpackI16N_I16(UINT8* out, const UINT8* in, int pixels){ unpackI16N_I16(UINT8* out, const UINT8* in, int pixels){
@ -921,7 +921,7 @@ unpackI16N_I16(UINT8* out, const UINT8* in, int pixels){
static void static void
unpackI12_I16(UINT8* out, const UINT8* in, int pixels){ 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 greyscale tiffs.
According to the TIFF spec: According to the TIFF spec:
FillOrder = 2 should be used only when BitsPerSample = 1 and FillOrder = 2 should be used only when BitsPerSample = 1 and
@ -958,7 +958,7 @@ unpackI12_I16(UINT8* out, const UINT8* in, int pixels){
#else #else
out16[1] = pixel; out16[1] = pixel;
#endif #endif
in += 3; out16 += 2; out+=4; in += 3; out16 += 2; out+=4;
} }
if (i == pixels-1) { if (i == pixels-1) {

View File

@ -42,7 +42,7 @@ ImagingZipEncode(Imaging im, ImagingCodecState state, UINT8* buf, int bytes)
state->errcode = IMAGING_CODEC_MEMORY; state->errcode = IMAGING_CODEC_MEMORY;
return -1; return -1;
} }
/* Expand standard buffer to make room for the filter selector, /* Expand standard buffer to make room for the filter selector,
and allocate filter buffers */ and allocate filter buffers */
free(state->buffer); free(state->buffer);

View File

@ -20,11 +20,11 @@ _imaging_read_pyFd(PyObject *fd, char* dest, Py_ssize_t bytes)
if (bytes_result == -1) { if (bytes_result == -1) {
goto err; goto err;
} }
if (length > bytes) { if (length > bytes) {
goto err; goto err;
} }
memcpy(dest, buffer, length); memcpy(dest, buffer, length);
Py_DECREF(result); Py_DECREF(result);
@ -33,7 +33,7 @@ _imaging_read_pyFd(PyObject *fd, char* dest, Py_ssize_t bytes)
err: err:
Py_DECREF(result); Py_DECREF(result);
return -1; return -1;
} }
Py_ssize_t Py_ssize_t
@ -42,7 +42,7 @@ _imaging_write_pyFd(PyObject *fd, char* src, Py_ssize_t bytes)
PyObject *result; PyObject *result;
PyObject *byteObj; PyObject *byteObj;
byteObj = PyBytes_FromStringAndSize(src, bytes); byteObj = PyBytes_FromStringAndSize(src, bytes);
result = PyObject_CallMethod(fd, "write", "O", byteObj); result = PyObject_CallMethod(fd, "write", "O", byteObj);
@ -50,14 +50,14 @@ _imaging_write_pyFd(PyObject *fd, char* src, Py_ssize_t bytes)
Py_DECREF(result); Py_DECREF(result);
return bytes; return bytes;
} }
int int
_imaging_seek_pyFd(PyObject *fd, Py_ssize_t offset, int whence) _imaging_seek_pyFd(PyObject *fd, Py_ssize_t offset, int whence)
{ {
PyObject *result; PyObject *result;
result = PyObject_CallMethod(fd, "seek", "ni", offset, whence); result = PyObject_CallMethod(fd, "seek", "ni", offset, whence);
Py_DECREF(result); Py_DECREF(result);
@ -70,7 +70,7 @@ _imaging_tell_pyFd(PyObject *fd)
{ {
PyObject *result; PyObject *result;
Py_ssize_t location; Py_ssize_t location;
result = PyObject_CallMethod(fd, "tell", NULL); result = PyObject_CallMethod(fd, "tell", NULL);
location = PyInt_AsSsize_t(result); location = PyInt_AsSsize_t(result);

View File

@ -153,7 +153,7 @@ if __name__ == '__main__':
op = "bdist_wininst --user-access-control=auto" op = "bdist_wininst --user-access-control=auto"
elif '--wheel' in opts: elif '--wheel' in opts:
op = "bdist_wheel" op = "bdist_wheel"
if 'PYTHON' in os.environ: if 'PYTHON' in os.environ:
run_one(op) run_one(op)
else: else: