access pictures files without knowing the names
Michael C <[email protected]> Tue, 16 May 2017 11:50:33 -0700
| Newsgroups | gmane.comp.python.ctypes |
|---|---|
| Message-ID | <CANyKM1gSQbtAMmjiUWjkd7HTigGFZO7ef3LoyZwzvznsLg7kAA@mail.gmail.com> |
--===============3106391243201050732==
Content-Type: multipart/alternative; boundary="001a113ed2be8c0265054fa8a547"
--001a113ed2be8c0265054fa8a547
Content-Type: text/plain; charset="UTF-8"
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...
--001a113ed2be8c0265054fa8a547
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr"><span style=3D"font-size:12.8px">I am running this code so=
I can do some image manipulation with them.</span><div style=3D"font-size:=
12.8px">The thing is, I have a lot of pictures to go through, so I can'=
t type the file names=C2=A0</div><div style=3D"font-size:12.8px">one by one=
in the code. However, the order of the files to be processed doesn't=
=C2=A0</div><div style=3D"font-size:12.8px">matter, so getting them in a ra=
ndom fashion is alright!</div><div style=3D"font-size:12.8px"><br></div><di=
v style=3D"font-size:12.8px">How do I make the python code open picture fil=
es? thanks!</div><div style=3D"font-size:12.8px"><br></div><div style=3D"fo=
nt-size:12.8px"><br></div><div style=3D"font-size:12.8px"><br></div><div st=
yle=3D"font-size:12.8px"><br></div><div style=3D"font-size:12.8px"><br></di=
v><div style=3D"font-size:12.8px"><br></div><div style=3D"font-size:12.8px"=
><br></div><div style=3D"font-size:12.8px"><br></div><div style=3D"font-siz=
e:12.8px"><div>## need to open random png. Any png.</div><div><br></div><di=
v>from PIL import Image</div><div><br></div><div><br></div><div>## need to =
load picture so I can process them. Any pictures is fine as</div><div>## I =
need to process every picture in the folder</div><div>im =3D Image.open(=
9;1.png')</div><div><br></div><div>## do my things...</div></div></div>
--001a113ed2be8c0265054fa8a547--
--===============3106391243201050732==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
--===============3106391243201050732==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
_______________________________________________
ctypes-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ctypes-users
--===============3106391243201050732==--