Re: access pictures files without knowing the names

eryk sun <[email protected]> Tue, 16 May 2017 19:12:27 +0000
Newsgroups gmane.comp.python.ctypes
Message-ID <CACL+1avpab0OizGJ1vTT0C=g4QpfhYPeUtStpgVVj4+O7-_saA@mail.gmail.com>
On Tue, May 16, 2017 at 6:50 PM, Michael C
<[email protected]> wrote:
> I am running this code so I can do some image manipulation with them.
> The thing is, I have a lot of pictures to go through, so I can't type the
> file names one by one in the code. However, the order of the files to be
> processed doesn't matter, so getting them in a random fashion is alright!
>
> How do I make the python code open picture files? thanks!
>
> ## need to open random png. Any png.
>
> from PIL import Image
>
> ## need to load picture so I can process them. Any pictures is fine as
> ## I need to process every picture in the folder
> im = Image.open('1.png')
>
> ## do my things...

This questions isn't about ctypes. Please ask this on the python-tutor list.

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot