from pathlib import Path from PIL import Image,ImageDraw p=Path(__file__).resolve().parent im=Image.new("RGBA",(120,60),(0,0,0,0));d=ImageDraw.Draw(im);d.rectangle((40,10,79,49),fill=(35,77,58,255));d.rectangle((58,10,61,49),fill=(206,239,115,255));im.save(p/"wide-parcel.png") small=im.resize((48,24),Image.Resampling.LANCZOS);pad=Image.new("RGBA",(48,48));pad.alpha_composite(small,(0,12));pad.save(p/"reference-pad.png") im.resize((48,48),Image.Resampling.LANCZOS).save(p/"reference-stretch.png")