Are there different versions of pillow? - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: Python Coding (https://python-forum.io/forum-7.html) +--- Forum: General Coding Help (https://python-forum.io/forum-8.html) +--- Thread: Are there different versions of pillow? (/thread-25760.html) |
Are there different versions of pillow? - Pedroski55 - Apr-11-2020 I made a program to watermark pdfs. Worked great! (Past tense) Yesterday, I also made a program to wipe out watermarks. It uses PIL. It just inspects every pixel. If the pixel is in a grey range, it paints the pixel white. Works great! I installed pdf2image to crack the pdf into jpgs, then look for grey colours in each jpg. However, I noticed that, when I used pip3 to install pdf2image, it also installed pillow. I think this must be a custom version of pillow. Now, my beautiful watermarking program crashes with the error below. Until yesterday, it worked great! I tried using a jpg as the watermark and that works fine, but jpg has no transparency, it covers all the text!!! If I reinstall pillow, I think my watermarking program will work again, but maybe not my de-watermarking program. At the moment, I am trying to install idle on and old laptop and try out my watermarking program there. Any tips please??
RE: Are there different versions of pillow? - buran - Apr-11-2020 you can use virtual environment to test in a clean environment (you should be using one anyway, instead of working with /installing in system install.) pdf2image install requires pillow, but it's the standard one, even there is no version requirement. If you had pillow installed it would not install new version Can you check what pip list what packages and versions are installed? Did you upgrade pillow lately? I guess you did at some point and it stopped working. Image.VERSION was removed like 15 months ago, in version 6.00 (it was depreciated before that). I guess before you had version 5 of Pillow and it worked. The problem is with reportlab - they didn't change their code to reflect the change in pillow. One should report a bug. the workaround is to downgrade your pillow to 5.4.1. And to answer the question in the title, although it's irrelevant to your problem, there is pillow-simd, which is drop-in replacement of pillow, that claim performance improvements in certain operations. But it follows pillow 100%. EDIT see my post - the problem is with old reportlab version. upgrade reportlab RE: Are there different versions of pillow? - Pedroski55 - Apr-11-2020 Thanks! I don't know what a virtual environment is, or how to get it! I just finished installing idle in my old laptop, reportlab was already present. I needed to get PyPDF2. After that, I ran my watermarking program, worked great! No problems. Something is wrong with the version of pillow that pdf2image installed. This is all for the gf! She works for an adult education agency, get a bachelor degree online. They need to provide their students a lot of old exams. Some have watermarks. Some do not have watermarks. If she's happy, my life is better! I'm just worried, if I reinstall pillow, the dewatermarking program will not work. RE: Are there different versions of pillow? - buran - Apr-11-2020 (Apr-11-2020, 06:05 AM)Pedroski55 Wrote: Something is wrong with the version of pillow that pdf2image installed.You didn't answer my question - what version of pillow is installed. As I already explained - if you had pillow installed beforehand (that was my understanding) pdf2image would not install anything. It will just check that requirement is satisfied. To make it work: uninstall pillow install version 5.4.1 - last before Image.VERSION is removed. Use pip install pillow==5.4.1 and it should work. You may report bug to reportlababout virtualenvironments - read https://docs.python.org/3/tutorial/venv.html EDIT: Look at my next post - the problem is in reportlab being old version, no need to downgrade pillow RE: Are there different versions of pillow? - Pedroski55 - Apr-11-2020 Thanks again! The version: Quote:pedro@pedro-512ssd:~/pdfs$ pip3 install -I pillow I want to completely purge python from this laptop and reinstall. Something is wrong. The last 2 pdfs I de-watermarked have the pages in the wrong order. Like I said, on my old laptop, the watermarking program works perfectly. I just ran 26 pdfs through it, no problems, using the latest version of pillow. How can I remove all python and python modules? I tried to force a reinstall, but it keeps installing from the cached file instead of downloading. RE: Are there different versions of pillow? - buran - Apr-11-2020 Please, tell me what version of reportlab do you have? In their latest version they have this line: if getattr(Image,'VERSION','').startswith('1.1.7'): im.load() They reflected the change in pillow in their code. In your traceback it's a different line - from an older version: forget about what I said to downgrade pillow to 5.4.1. Just upgrade reportlab to latest version.
RE: Are there different versions of pillow? - Pedroski55 - Apr-11-2020 Thanks again! Quote:Just upgrade reportlab to latest version. Funny, I thought of doing that about 30 minutes ago. I'm trying, but I'm in China and the connection is a bit iffy. The download keeps crashing. I'll wait till tomorrow 5am, the net is less busy then. I connected with a vpn, installed reportlab, now my watermark program is working on my newer laptop again! Don't know what went wrong really, but if it works, gf is happy, so I'm happy! Thanks for your time and advice! |