some of the primary benefits inherent in open source software in general example - pp \gui\pil\viewer_thumbs py ""display all images in directory as thumbnail image buttons that display the full image when clickedrequires pil for jpegs and thumbnail image creationto doadd scrolling if too many thumbs for window""import ossysmath from tkinter import from pil import image from pil imagetk import photoimage <=required for thumbs <=required for jpeg display def makethumbs(imgdirsize=( )subdir='thumbs')""get thumbnail images for all images in directoryfor each imagecreate and save new thumbor load and return an existing thumbmakes thumb dir if neededreturns list of (image filenamethumb image object)caller can also run listdir on thumb dir to loadon bad file types may raise ioerroror othercaveatcould also check file timestamps""thumbdir os path join(imgdirsubdirif not os path exists(thumbdir)os mkdir(thumbdirthumbs [for imgfile in os listdir(imgdir)thumbpath os path join(thumbdirimgfileif os path exists(thumbpath)thumbobj image open(thumbpathuse already created thumbs append((imgfilethumbobj)elseprint('making'thumbpathimgpath os path join(imgdirimgfiletryimgobj image open(imgpathmake new thumb imgobj thumbnail(sizeimage antialiasbest downsize filter imgobj save(thumbpathtype via ext or passed thumbs append((imgfileimgobj)exceptnot always ioerror print("skipping"imgpathreturn thumbs class viewone(toplevel)""open single image in pop-up window when createdphotoimage object must be savedimages are erased if object is reclaimed""def __init__(selfimgdirimgfile)toplevel __init__(selfself title(imgfileimgpath os path join(imgdirimgfileviewing and processing images with pil