Package: wallpaste
WallPasteA tool that allows you to paste multiple images onto a background with respect of their aspect ratio.This project is both a Python library/module and a CLI utility.RequirementspillowInstallationpip:pip3 install wallpastecloning the repo and runningpip3 install -r requirements.txtCLIExample usage:# If installed by PIPpython3-mwp-i~/Images-o~/out.jpg-c8# orpython3-mwp--input~/Images--output~/out.jpg--count8# If installed manually (git clone)python3/path/to/wp.py--input="~/Images"--output="~/out.jpg"--count=8FlagsFlagShorthandDescriptionRequired--input-iPath to input directoryyes--output-oPath to output fileno--background-bBackground coloryes*--backgroundpath-bpPath to background imageyes*--strictness-sStrictness numberno--factor-fStarting scale factorno--width-wTarget width (in px)yes--height-heTarget height (in px)yes--count-cNumber of images to mergeno--margin-mMin distance between the edge and imagesno--padding-pMin distance between any side of a pic to another picnobackgroundpathonly needs to be specified whenbackgroundis notModule usageIf you've installed this package using pip, you can import it like this:importwallpaste# orfromwallpasteimportcombine_images,generate_imageThere are numerous function parameters to each function. No point in listing it all here, but their docs are located
next to their definition inthewallpaperproject.py.defcombine_images(input_path=None,images=None,output_path=None,target_size=None,strictness=50,count=2,fact_main=2,margin=0,padding=0,permutations=5,bg_color="#eeeeee",background=None,background_path=None):"""This function will calculate the corresponding image sizes and their coordinates and paste them onthe background image without them intersecting.:param input_path: input directory where source images are located:param count: number of images to use (used with input_path):param images: list of full paths of images (does not have to be in the same directory):param output_path: output path where the generated image will be saved:param target_size: tuple representing the target (width, height):param background: PIL Image object which will be used as the background:param background_path: Path to the image that will be used as the background (use only if background is not specified):param bg_color: if background PIL image is not specified, use this to specify the background color:param target_size: target image resolution:param permutations: number of image order shuffles before changing the scaling factor by one:param strictness: number of tries before making a permutation:param fact_main: starting scaling factor:param margin: minimal distance between the edges and placed images (in px):param padding: minimal distance between each image (in px):return:"""defgenerate_image(images,sizes,image_coords,output_path=None,background=None,background_path=None,bg_color="#eeeeee",target_size=(1920,1080)):"""Paste images onto the background and output it to the output_path if defined,if not, open the generated image in an image viewer.:param images: list of full image paths:param sizes: list of (width, height) tuples relating to every image:param image_coords: list of (x,y) tuples representing the top left coordinates of every image:param background: PIL Image which will be used as the background:param background_path: Path to the image that will be used as the background (use only if background is not specified):param bg_color: if background PIL image is not specified, use this to specify the background color (used only with target_size):param target_size: target image resolution (used only with bg_color):param output_path: The generated image will be saved here"""Author👤Mišo BarišićWebsite:https://www.misobarisic.comGitHub:@misobarisicGitLab:@misobarisicShow your supportGive a ⭐️ if this project helped you!📝 LicenseThis project isMITlicensed.