Commit Graph

124 Commits

Author SHA1 Message Date
Andrew Murray
75542fea6d Replaced PyErr_NoMemory with ImagingError_MemoryError 2020-12-20 13:00:10 +11:00
Christoph Gohlke
7673cb7549
Fix dereferencing potential null pointer 2020-12-19 14:57:55 -08:00
Hugo van Kemenade
f9852c0381
Merge branch 'master' into fix-imagingHinclude 2020-10-14 14:50:36 +03:00
Hugo van Kemenade
309cb9e5c4
Merge pull request #4927 from radarhere/tuple 2020-10-12 14:40:22 +03:00
Hugo van Kemenade
15c339470d
Merge pull request #4523 from xtsm/ellipse
Implemented another ellipse drawing algorithm
2020-10-11 18:04:34 +03:00
Andrew Murray
e01081bf8b
Improved error message
Co-authored-by: nulano <nulano@nulano.eu>
2020-09-22 08:36:29 +10:00
Andrew Murray
27c0747518 Allow tuples with one item to give single color value in getink 2020-09-20 14:23:05 +10:00
Axel Huebl
f79379ed7c Imaging.h: confusion with system
The file `libImaging/Imaging.h` gets installed flat on
Ubuntus into the public Python includes.

When building a newer version of Pillow from source and
hinting the Python includes "too early" in includes, e.g.
in package managers, this can confuse the two files and
pick up the external file over the internal one. With
different versions, this mismatch can lead to build errors,
e.g. undefined macros.

The most robust way to avoid this is to pre-fix the internal
include accordingly, so that the relative path to the including
file has to match as well.
2020-09-17 18:06:45 +10:00
nulano
4bb78d53a3 give proper error message for invalid putpixel color type 2020-08-20 00:01:03 +02:00
Stanislau Tsitsianok
7dedb1402f
Merge remote-tracking branch 'upstream/master' into ellipse 2020-06-29 23:31:25 +03:00
Stanislau Tsitsianok
96f69eb287
Replaced drawing algorithm for arcs, chords and pies 2020-06-29 17:21:53 +03:00
nulano
6c1ff252d6 check run-time version numbers where available, add docs 2020-06-21 18:58:39 +10:00
Andrew Murray
3a75e843f4 Added braces 2020-05-11 07:46:12 +10:00
Andrew Murray
c1d9931adc Added braces 2020-05-10 19:56:36 +10:00
Hugo
dda6145fce Since Python 3.3 IOError and WindowsError have been merged into OSError 2020-04-10 12:57:29 +03:00
Hugo van Kemenade
b5cf165f9e
Merge pull request #4260 from nulano/imagegrab_xcb
ImageGrab.grab() for Linux with XCB
2020-03-31 23:03:21 +03:00
nulano
3c39e6fcf6 xcb screengrab support 2020-03-24 19:29:44 +11:00
Dag Wästberg
2e02500fa6 change function names to snake_case 2020-02-19 19:38:53 +11:00
Dag Wästberg
13c1b7070d add Overlay chop 2020-02-19 19:24:36 +11:00
Dag Wästberg
5e5dfbad81 add hardlight and softlight chops 2020-02-19 19:23:09 +11:00
Andrew Murray
f77c409742 Renamed variable 2019-12-31 09:04:25 +11:00
Andrew Murray
34d04d3e82 Replaced distutils with C version check 2019-12-28 09:57:49 +11:00
Alexander
5283141417 Merge branch 'master' into reduce 2019-12-05 14:23:28 +03:00
Alexander
5838d77c0e args test 2019-12-05 03:24:38 +03:00
Alexander
778b5f9fed add box parameter 2019-12-04 23:13:20 +03:00
Alexander
fba833e1f4 final set of special cases 2019-11-26 01:18:48 +03:00
Alexander
335f5431de dummy method 2019-11-24 17:39:49 +03:00
Hugo van Kemenade
5006401d0b
Merge branch 'master' into rm-2.7 2019-11-03 22:48:26 +02:00
Hugo
af770a6c55 Drop support for EOL Python 2.7 2019-10-07 14:30:59 +03:00
nulano
5f4c1e113c add libimagequant to features.py 2019-09-27 00:34:45 +02:00
Andrew Murray
13224bf029 Removed unused argument 2019-07-04 20:07:33 +10:00
Rolf Eike Beer
7a4af2b767 fix unaligned accesses by using memcpy() 2019-06-29 21:04:11 +02:00
Hugo
08c47925d0
Added an image.entropy() method (#3608)
Added an `image.entropy()` method
2019-06-29 10:12:34 +03:00
Andrew Murray
1a71faf8ea Removed variable 2019-06-26 19:15:47 +10:00
Alexander Böhn
7b815a5f1d Added an image.entropy() method
This calculates the entropy for the image, based on the histogram.

Because this uses image histogram data directly, the existing C
function underpinning the `image.histogram()` method was abstracted
into a static function to parse extrema tuple arguments, and a new
C function was added to calculate image entropy, making use of the
new static extrema function.

The extrema-parsing function was written by @homm, based on the
macro abstraction I wrote, during the discussion of my first
entropy-method pull request: https://git.io/fhodS

The new `image.entropy()` method is based on `image.histogram()`,
and will accept the same arguments to calculate the histogram data
it will use to assess the entropy of the image.

The algorithm and methodology is based on existing Python code:

* https://git.io/fhmIU

... A test case in the `Tests/` directory, and doctest lines in
`selftest.py`, have both been added and checked.

Changes proposed in this pull request:

* Added “math.h” include to _imaging.c
* The addition of an `image.entropy()` method to the `Image`
  Python class,
* The abstraction of the extrema-parsing logic of of the C
  function `_histogram` into a static function, and
* The use of that static function in both the `_histogram` and
  `_entropy` C functions.
* Minor documentation addenda in the docstrings for both the
  `image.entropy()` and `image.histogram()` methods were also
  added.
* Removed outdated boilerplate from testing code
* Removed unused “unittest” import
2019-06-26 19:15:47 +10:00
Jayakrishna Menon
37516fb665 adding an upper limit for blocks_max in _set_blocks_max 2019-06-26 19:08:07 +10:00
Andrew Murray
e131fa22e2 Fixed reading and saving for TIFF and IM in PA mode 2019-05-11 14:43:48 +10:00
Andrew Murray
dba38912fb Allow putpalette for LA and PA 2019-03-29 23:13:50 +11:00
Andrew Murray
97c2848963 Fixed deprecation warnings 2019-03-26 13:50:57 +11:00
cgohlke
86afcfd8f9
Fix possible integer overflow 2019-01-25 15:11:22 -08:00
Hugo
78bc4da131
Merge pull request #3350 from radarhere/custom_tags
Added custom int and float TIFF tags
2018-12-26 13:07:46 +02:00
Hugo
55e5b7de6c
Merge pull request #3393 from frenzymadness/CWE_fixes_master
Fixes for issues reported by static code analysis
2018-12-26 13:02:19 +02:00
Andrew Murray
49b23157c4 Include header 2018-12-13 19:18:17 +11:00
Andrew Murray
7172a44caa Added libjpegturbo to check_feature 2018-12-12 21:25:05 +11:00
Andrew Murray
ddf8593e7b Do not write custom tags with libtiff < 4 2018-11-12 06:14:04 +11:00
Nazime
86324a842d Add setting negative pixels and unittest 2018-10-15 12:51:24 +02:00
Nazime
468c405a47 Image pixels negative index 2018-10-14 16:12:58 +02:00
Lumir Balhar
78bf8ea041 Fix potential leaked storage issues (CWE-772) 2018-10-02 14:06:21 +02:00
Hugo
0c71792818
Merge pull request #3251 from radarhere/conversion
Fixed implicit conversion warnings
2018-09-29 17:38:11 +03:00
Andrew Murray
1e305380ae
Merge pull request #3094 from hugovk/add-width-to-shapes
Add line width parameter to rectangle and ellipse-based shapes
2018-09-29 23:21:03 +10:00
Martin Packman
0b3036454c Give correct extrema for I;16 format images
Currently gives None for a 16 bit greyscale image rather than the
true min and max values in the 0-65536 range. The internal
ImagingGetProjection function already supports I;16 but the
_getextrema needs to know to unpack the result.
2018-09-18 13:48:12 +01:00
Hugo
6fc1e79e96 Remove ununsed draw_point. Only draw_points is used by ImageDraw.py 2018-08-25 18:56:50 +03:00
Hugo
bdf2705cd3 Remove ununsed draw_line. Only draw_lines is used by ImageDraw.py 2018-08-25 18:56:50 +03:00
Andrew Murray
f0a5946c6e Fixed implicit conversion warnings 2018-08-25 00:54:29 +10:00
Rolf Eike Beer
b565f45d77 avoid invalid free if out of memory
The surrounding code suggests this should only be freed if it was allocated
locally.
2018-07-04 20:40:12 +02:00
Hugo
d6e3ef85c2 Add width parameter to arc, chord, ellipse, pieslice 2018-07-02 11:26:42 +03:00
Hugo
9dedbff713 Add width parameter to rectangle 2018-07-02 11:21:30 +03:00
Hugo
af552801c2
Merge pull request #3186 from danpla/tga-write-rle
TGA: Add support for writing RLE data
2018-07-01 22:00:03 +03:00
Hugo
2b09e7fa6a
Merge pull request #3099 from uploadcare/lut-numpy
NumPy support for LUTs
2018-07-01 13:18:03 +03:00
Daniel Plakhotich
1d20056234 TGA: Add support for writing RLE data 2018-06-15 23:01:06 +03:00
Andrew Murray
57c7a51b51 Renamed CLIP to CLIP8 2018-04-21 18:14:05 +10:00
Andrew Murray
99dcc57720 Moved CLIP definitions into ImagingUtils.h 2018-04-21 16:35:58 +10:00
Alexander
d117026511 fix float16tofloat32 2018-04-15 01:46:26 +03:00
Alexander
4c983674c0 avoid compilation varnings 2018-04-15 01:20:57 +03:00
Alexander
497e9d8251 full buffer support 2018-04-15 00:33:15 +03:00
Alexander
2c87242027 Support for many many LUT source on C level 2018-04-14 23:12:28 +03:00
Alexander
aba478abba Raise error if it is occurred during conversion in getlist 2018-04-14 17:13:05 +03:00
Alexander
71f643e1ea doesn't affect accuracy, but a bit faster 2018-03-29 11:57:37 +03:00
Alexander
5f0b7ee73e More tests 2018-03-26 22:30:55 +03:00
Alexander
696ae12b37 3D to 3D implementation 2018-03-26 14:14:52 +03:00
Alexander
d2d546d4ae Python to C bridge 2018-03-26 11:26:51 +03:00
Metallicow
22a59ac839 Trim trailing whitespace src dir 2018-01-27 00:02:56 -06:00
Eric Soroos
4bc33d3e4a Remove _imaging.crc32 in favor or builtin python crc32 implementation 2018-01-05 15:53:50 +00:00
wiredfool
0bb3f4fee9 source layout reorg 2017-12-28 14:49:47 +00:00