Closed RemBrandNL closed 3 years ago
Hi. It seems that Optimize Images was not able to import Pillow. Are you sure Optimize Images was installed using the same Python version (or virtual environment if it's the case) as Pillow? Please check with the command:
python3.7 -m pip list
Also, please specify it you installed Optimize Images 1.4.0 from PyPI (using pip
) or if you have downloaded and installed the current development snapshot from this Github repo.
Hi Victor,
Thank you for the quick reply. I installed it using pip3 install pillow
as in above snapshot. As you requested, I ran pip list with python3.7 -m pip list
which returned:
pi@camerapi:~ $ python3.7 -m pip list
Package Version
-------------------- ---------
Adafruit-DHT 1.4.0
asn1crypto 0.24.0
bcrypt 3.2.0
certifi 2018.8.24
cffi 1.14.5
chardet 3.0.4
click 7.1.2
cryptography 2.6.1
entrypoints 0.3
idna 2.6
keyring 17.1.1
keyrings.alt 3.1.1
optimize-images 1.4.0
paramiko 2.7.2
picamera 1.13
piexif 1.1.3
Pillow 8.1.0
pip 18.1
pycparser 2.20
pycrypto 2.6.1
PyGObject 3.30.4
PyNaCl 1.4.0
pysftp 0.2.9
python-apt 1.8.4.3
pyxdg 0.25
requests 2.21.0
RPi.GPIO 0.7.0
SecretStorage 2.3.1
sensirion-i2c-driver 1.0.0
sensirion-i2c-sht 0.2.1
setuptools 40.8.0
six 1.12.0
speedtest-cli 2.1.2
ssh-import-id 5.7
urllib3 1.24.1
wheel 0.32.3
Looks like indeed version 1.4.0 is installed and Pillow v8.1.0. Kind regards, Remco
I found an alternate solution to my issue with below function:
from PIL import Image
def compress_image(file=False):
if file:
img = Image.open(file)
img.save(file, optimize=True, quality=60)
This gives me the simple compression I was looking for. Thanks for your time, but not need to chase this. All the best, Remco
Thanks for you report. I will try to review the error message and the usage of Pillow, thought, since the same issue could be happening to other users.
Sorry for getting back to a closed issue. Just a quick notice to let you know that I have found a similar behaviour on my Mac, right after pip installing Optimize Images. It would not find Pillow. However, after exiting the shell and opening it again, it worked as expected.
Describe the bug Installed this on an updated RaspiOS install on RPI Zero. Running the app tells me to install Pillow even though it's installed?
To Reproduce Steps to reproduce the behavior:
Expected behavior I expect to optimize the JPEGs in the given directory.
Screenshots
Desktop (please complete the following information):
Additional context Add any other context about the problem here. If issue happens with a specific image file, if possible please attach a sample file (please make sure you don't upload any confidential image or information).