mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-01-27 01:34:24 +03:00
Only import numpy when necessary
This commit is contained in:
parent
f91f93e246
commit
188d4f6b6a
|
@ -16,11 +16,6 @@
|
||||||
#
|
#
|
||||||
import functools
|
import functools
|
||||||
|
|
||||||
try:
|
|
||||||
import numpy
|
|
||||||
except ImportError: # pragma: no cover
|
|
||||||
numpy = None
|
|
||||||
|
|
||||||
|
|
||||||
class Filter:
|
class Filter:
|
||||||
pass
|
pass
|
||||||
|
@ -369,6 +364,13 @@ class Color3DLUT(MultibandFilter):
|
||||||
items = size[0] * size[1] * size[2]
|
items = size[0] * size[1] * size[2]
|
||||||
wrong_size = False
|
wrong_size = False
|
||||||
|
|
||||||
|
numpy = None
|
||||||
|
if hasattr(table, "shape"):
|
||||||
|
try:
|
||||||
|
import numpy
|
||||||
|
except ImportError: # pragma: no cover
|
||||||
|
pass
|
||||||
|
|
||||||
if numpy and isinstance(table, numpy.ndarray):
|
if numpy and isinstance(table, numpy.ndarray):
|
||||||
if copy_table:
|
if copy_table:
|
||||||
table = table.copy()
|
table = table.copy()
|
||||||
|
|
Loading…
Reference in New Issue
Block a user