As the title says i am looking for a way convert a huge number of images into thumbnails of different sizes , How do i go about doing this in python
This article is a short overview of three ways to generate images with Python: Naive Bayes, GANs, and VAEs. Each uses the MNIST handwritten digit dataset. Images can be generated using Naive Bayes; no fancy neural network is required.
A thumbnail is a small image, either as . png or as . jpg that can be used in an application as a representation of the file, for example as a placeholder for a link that downloads or previews the file.
See: http://www.pythonware.com/products/pil/index.htm
import os, sys
import Image
size = 128, 128
for infile in sys.argv[1:]:
outfile = os.path.splitext(infile)[0] + ".thumbnail"
if infile != outfile:
try:
im = Image.open(infile)
im.thumbnail(size)
im.save(outfile, "JPEG")
except IOError:
print "cannot create thumbnail for", infile
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With