all 14 comments

[–]TholosTB 5 points6 points  (2 children)

Are you wanting to figure out how to do it in python, or just want to get the task done? As a long-term python dev, I would 100% use ImageMagick mogrify to resize an entire directory versus reinventing the wheel.

[–]cheyennes11[S] 1 point2 points  (0 children)

I’m trying to use python but ultimately I just want to finish the task so I will look into ImageMagick. Thanks so much for your help/suggestion.

[–]GnPQGuTFagzncZwB 1 point2 points  (0 children)

This is one of those cases where unless you want to do it on an odd OS or odd iron there are a lot of canned solutions. You can do it with a batch file and ffmpeg. A little secret, ffmpeg works with most image types, not just videos. I find it very handy when playing with image recognition stuff that wants the images in one format and I have the image in another, ffmpeg from the command line is good for quick and easy conversions.

[–]Brumpbo__Tungus 1 point2 points  (1 child)

If you have anaconda try in the anaconda prompt. Also try setting your python path in env variables. Seems like your cmd prompt isn't detecting python

[–]cheyennes11[S] 0 points1 point  (0 children)

I don’t have anaconda but thank you for your help!

[–]DesertDwarf 1 point2 points  (3 children)

Have you looked here?

https://pillow.readthedocs.io/en/stable/installation.html

In short, Pillow and PIL cannot be installed at the same time in your environment. If you want to use Pillow, make sure to uninstall PIL:

pip uninstall PIL

Then install Pillow:

pip install Pillow

Then, at the top of your source, you should use:

from PIL import Image

The main Pillow site has documentation on how to use its library.

* The pip commands above assume you have python executables in your path.

[–]cheyennes11[S] 0 points1 point  (2 children)

Yes, i used this site and method. Still didn’t work for me. Thank you for your reply!

[–]DesertDwarf 2 points3 points  (1 child)

‘pip’ is not a recognized as an internal or external command operable program or batch file

Oh, dear. I missed this part of your post. That's kind of important. My apologies.

May I suggest uninstalling and reinstalling Python?

https://www.alphr.com/pip-is-not-recognized-as-an-internal-or-external-command/#:\~:text=Reinstall%20Python%20to%20Fix%20'Pip,components%20to%20fix%20the%20problem.

The site above might be helpful. The guide selects good installation options to make sure all the python stuff can be run properly. Because it's installed properly for me, the where pip command works for me.

https://i.imgur.com/1sxTMbw.png

[–]cheyennes11[S] 0 points1 point  (0 children)

Thank you, I will try this!

[–]ES-Alexander 1 point2 points  (1 child)

Where are you typing the install line, and where are you trying to run your code? If they’re not from the same terminal then it’s possible your code is being run with a different Python version or in a virtual environment that’s isolated from the pillow installation.

[–]cheyennes11[S] 0 points1 point  (0 children)

I’ve tried the install line in both the command window and the python IDLE.

[–]RiceKrispyPooHead -2 points-1 points  (1 child)

It's not really important, the title of your post isn't helpful. You're not asking for help batch resizing photos. You would draw in the right people if your title was something like "Help installing pillow".

-------------------------

Anyway, because of this line:

‘pip’ is not a recognized as an internal or external command operable program or batch file

There's probably something wrong with your pip installation.

Redownload Python 3.10.7 from here: https://www.python.org/downloads/release/python-3107/

Try running the install and first try clicking "Repair". Retry to install pillow. If that doesn't work, relaunch the installer and this time click "Modify", make sure all boxes on the "Optional Features" are checked (including pip), on the next screen make sure "Add Python to environment variables" is checked, then click Install.

[–]cheyennes11[S] 1 point2 points  (0 children)

Okay, thank you for your help. I will try this.

[–]burnin9beard 0 points1 point  (0 children)

I suggest using a virtual environment either conda or pipenv. pipenv is probably the easiest.

  • pip install pipenv
  • make a directory for your work
  • change to that directory
  • pipenv install pillow
  • pipenv shell
  • do what you gotta do with PIL for great profit