{"id":22355150,"url":"https://github.com/jubelcassio/imageprocessing","last_synced_at":"2025-03-26T12:42:47.919Z","repository":{"id":232077051,"uuid":"140188855","full_name":"jubelcassio/ImageProcessing","owner":"jubelcassio","description":"General use scripts for image processing using Python's Image Library.","archived":false,"fork":false,"pushed_at":"2019-01-26T15:23:10.000Z","size":95,"stargazers_count":0,"open_issues_count":3,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-01-31T13:44:25.182Z","etag":null,"topics":["image-processing","pil","python"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jubelcassio.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":"roadmap","authors":null,"dei":null}},"created_at":"2018-07-08T17:34:57.000Z","updated_at":"2019-01-26T15:23:11.000Z","dependencies_parsed_at":"2024-04-07T21:22:31.650Z","dependency_job_id":"9c70d859-b3df-4335-90a3-b25b0168d7d2","html_url":"https://github.com/jubelcassio/ImageProcessing","commit_stats":null,"previous_names":["jubelcassio/imageprocessing"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jubelcassio%2FImageProcessing","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jubelcassio%2FImageProcessing/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jubelcassio%2FImageProcessing/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jubelcassio%2FImageProcessing/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jubelcassio","download_url":"https://codeload.github.com/jubelcassio/ImageProcessing/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245658981,"owners_count":20651519,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["image-processing","pil","python"],"created_at":"2024-12-04T13:16:50.855Z","updated_at":"2025-03-26T12:42:47.898Z","avatar_url":"https://github.com/jubelcassio.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n## Image Processing\n\nScripts for image processing using the Pillow library  \n\n#### Requirements:  \nPython 3.6.3  \nPillow == 5.2.0  \n\nFor the tests:  \natomicwrites==1.1.5  \nattrs==18.1.0  \nmore-itertools==4.2.0  \npluggy==0.6.0  \npy==1.5.4  \npytest==3.6.3  \nsix==1.11.0  \n\n\n#### Install:\nJust clone the repository anywhere and call it by the full path while invoking python:\n` python /home/user/scripts/ImageProcessing/process_img.py ... `\n\nAlternatively, you can set the program in your PATH variable, so its accessible from anywhere in the system:  \n\n**Linux:**  \nClone the repository into a directory of your choice (for example, /home/username/scripts)  \n` git clone https://github.com/jubelcassio/ImageProcessing.git `  \nAdd the chosen directory into your PATH variable  \nSet the permissions for the process_img.py file inside the ImageProcessing folder.  \n` chmod +wx process_img.py `  \nCreate a symlink on the scripts directory to the process_img.py file  \n` ln -s ImageProcess/process_img.py process_img.py`  \nNow you can call the process_img file from any other directory on your system.  \n`process_img [action] [file/directory] [arguments] `  \nThe tree of your directories should look like this:\n\u003cpre\u003e\n/home/username/scripts  \n                  |---ImageProcessing  \n                            |---process_img.py  \n                            |--- ...  \n                  |---process_img.py          \u003c--- symlink  \n\u003c/pre\u003e\n\n**Windows:**  \nClone the repository into a directory of your choice (for example, C:\\user_scripts\\)  \nAdd the program's directory (C:\\user_scripts\\ImageProcessing) into your user PATH variable  \nNow you can call the process_img file from any other directory on your system.  \n`process_img.py ...`\n\n\n#### Usage:\n\nAfter Installation:  \n` process_img [action] [file/directory] [arguments] `  \nOr by summoning python manually:\n`python process_img.py [action] [file/directory] [arguments] `  \n\\[file/directory] must be a single image or a directory containing image files to be processed.\n\nAlso you can use:  \n`python process_img.py -h `  \nFor a general help message or \n`python process_img.py [action] -h `  \nFor a help message about an specific module\n\n\n#### Supported Formats:\nThe supported file types for both, reading and writing are:  \nbmp, eps, gif, ico, jpg, jpeg, png, tiff\n\n\n#### Available commands:\n* **convert**: Converts image(s) to given format.  \n`process_img convert [file/directory] [save as] [optional arguments]`  \n`[save as]` must be one of the supported formats, listed above and in lower case  \n**optional arguments**  \n`--mode=[mode]` The color mode to use when saving the image (RGB, RGBA, CMYK, ...)  \nIf the mode of the original image is not supported by the given format it will be saved in RGB or RGBA, depending on the image type.  \n`--save_folder=[folder]` The directory where the images will be saved.  \n`-optimize` If passed, the resulting images will be optimized for a smaller file size. Only works for jpg and png images.  \n`--background` The color to use when saving a image with a mode that has alpha channel to a image mode that does NOT have alpha channel. The transparent area on the original image will be filled with the given color.  \n**example usage**  \nConvert a directory of png images to jpg  \n`process_img convert /png_images jpg`  \nReplaces the transparency of a png image with a pink color  \n`process_img convert transparent_img.png png --mode=RGB --background=255,0,255`  \n\n\n* **resize**: Resizes image(s) to given width and height.  \n`process_img resize [file/directory] [width] [height] [optional arguments]`  \n`[width]` and `[height]` must be integers.  \n**optional arguments**  \n`--save_as=[format]` must be one of the supported formats, listed above and in lower case  \n`--mode=[mode]` The color mode to use when saving the image (RGB, RGBA, CMYK, ...)  \nIf the mode of the original image is not supported by the given format it will be saved in RGB or RGBA, depending on the image type.  \n`--save_folder=[folder]` The directory where the images will be saved.  \n`--resample=[resampling filter]` The resampling filter to be used when resizing the images. The filters available are:  \n\"NEAREST\", \"LANCZOS\", \"BILINEAR\", \"BICUBIC\", \"BOX\", \"HAMMING\"  \n`-optimize` If passed, the resulting images will be optimized for a smaller file size. Only works for jpg and png images.   \n`--background` The color to use when saving a image with a mode that has alpha channel to a image mode that does NOT have alpha channel. The transparent area on the original image will be filled with the given color.  \n**example usage**  \nResize all images of a directory to a size of 336 x 280.  \n`process_img resize /images 336 280`  \nResize images to a size 336 x 280 while converting them to jpg and optimizing for web.  \n`process_img resize /images 336 280 --save_as=jpg -optimize`  \n\n\n* **scale**: Scale image(s) by given scalar.  \n`process_img scale [file/directory] [scalar] [optional arguments]`  \n`[scalar]` must be a decimal or integer, the image's width and height will be multiplied by this number.  \n**optional arguments**  \n`--save_as=[format]` must be one of the supported formats, listed above and in lower case  \n`--mode=[mode]` The color mode to use when saving the image (RGB, RGBA, CMYK, ...)  \nIf the mode of the original image is not supported by the given format it will be saved in RGB or RGBA, depending on the image type.  \n`--save_folder=[folder]` The directory where the images will be saved.  \n`--resample=[resampling filter]` The resampling filter to be used when resizing the images. The filters available are:  \n\"NEAREST\", \"LANCZOS\", \"BILINEAR\", \"BICUBIC\", \"BOX\", \"HAMMING\"  \n`-optimize` If passed, the resulting images will be optimized for a smaller file size. Only works for jpg and png images.  \n`--background` The color to use when saving a image with a mode that has alpha channel to a image mode that does NOT have alpha channel. The transparent area on the original image will be filled with the given color.  \n**example usage**  \nScale images of a directory by twice their size.  \n`process_img scale /images 2`  \n\n\n* **fit**: Resize an image to a given width / height while maintaining its aspect ratio. The offset area is transparent or filled with a white background, depending on the mode of the original image.  \n`process_img fit [file/directory] [width] [height] [optional arguments]`  \n`[width]` and `[height]` must be integers.  \n`[color]` May be a hexadecimal color value (\"#aabbcc\" or \"#aabbccff\") or the rgb code for the chosen color, with each number separated by a comma and without spaces (\"50,50,50\" or \"50,50,50,255\")\n`--save_as=\\[format]` Optional argument for the format to use while saving the image. Must be one of the supported formats.  \n**optional arguments**  \n`--color=[color]` A color to be used as the background of the resulting image. Must be in hex code format (\"#fff\", \"#ffffff\", \"#ffffffff\") or as a list of rgb/rgba values, separated by a comma (\"255,255,255\" or \"255,255,255,255\")  \n`--save_as=[format]` must be one of the supported formats, listed above and in lower case  \n`--mode=[mode]` The color mode to use when saving the image (RGB, RGBA, CMYK, ...)  \nIf the mode of the original image is not supported by the given format it will be saved in RGB or RGBA, depending on the image type.  \n`--save_folder=[folder]` The directory where the images will be saved.  \n`--resample=[resampling filter]` The resampling filter to be used when resizing the images. The filters available are:  \n\"NEAREST\", \"LANCZOS\", \"BILINEAR\", \"BICUBIC\", \"BOX\", \"HAMMING\"  \n`-optimize` If passed, the resulting images will be optimized for a smaller file size. Only works for jpg and png images.  \n`--background` The color to use when saving a image with a mode that has alpha channel to a image mode that does NOT have alpha channel. The transparent area on the original image will be filled with the given color.  \n**example usage**  \nFit images into a 400x400 image with white background. Useful for creating a grids of thumbnails that must have the same dimensions.  \n`process_img fit /images 400 400 --color=255,255,255 --background=255,255,255`  \nSame usage as the previous, but now we save the images as jpg and optimize their file size.  \n`process_img fit /images 400 400 --color=255,255,255 --background=255,255,255 --save_as=jpg -optimize`  \n\n\n* **info**: Prints the path, format, color mode and dimensions of the given image.  \n`process_img info [file/directory]`\n\n\n* **dessaturate**: Grayscales the image.  \n`process_img dessaturate [file/directory] [optional arguments]`  \n**optional arguments**  \n`--save_as=[format]` must be one of the supported formats, listed above and in lower case  \n`--mode=[mode]` The color mode to use when saving the image (RGB, RGBA, CMYK, ...)  \nIf the mode of the original image is not supported by the given format it will be saved in RGB or RGBA, depending on the image type.  \n`--save_folder=[folder]` The directory where the images will be saved.  \n`-optimize` If passed, the resulting images will be optimized for a smaller file size. Only works for jpg and png images.  \n`--background` The color to use when saving a image with a mode that has alpha channel to a image mode that does NOT have alpha channel. The transparent area on the original image will be filled with the given color.  \n**example usage**  \nGrayscaling all images of a directory:  \n`process_img dessaturate /images`  \n\n\n* **invert**: Invert the colors of the image.  \n`process_img invert [file/directory] [optional arguments]`  \n**optional arguments**  \n`--save_as=[format]` must be one of the supported formats, listed above and in lower case  \n`--mode=[mode]` The color mode to use when saving the image (RGB, RGBA, CMYK, ...)  \nIf the mode of the original image is not supported by the given format it will be saved in RGB or RGBA, depending on the image type.  \n`--save_folder=[folder]` The directory where the images will be saved.  \n`-optimize` If passed, the resulting images will be optimized for a smaller file size. Only works for jpg and png images.  \n`--background` The color to use when saving a image with a mode that has alpha channel to a image mode that does NOT have alpha channel. The transparent area on the original image will be filled with the given color.  \n**example usage**  \nInvert the colors of all images of a directory:  \n`process_img invert /images`  \n\n\n* **mirror**: Mirrors the images, by horizontal, vertical or both axis.  \n`process_img mirror [file/directory] [mirror_mode] [optional arguments]`  \n`[mirror mode]` Can be \"v\" for vertical, \"h\" for horizontal, or \"vh\" / \"hv\" for both.  \n**optional arguments**  \n`--save_as=[format]` must be one of the supported formats, listed above and in lower case  \n`--mode=[mode]` The color mode to use when saving the image (RGB, RGBA, CMYK, ...)  \nIf the mode of the original image is not supported by the given format it will be saved in RGB or RGBA, depending on the image type.  \n`--save_folder=[folder]` The directory where the images will be saved.  \n`-optimize` If passed, the resulting images will be optimized for a smaller file size. Only works for jpg and png images.  \n`--background` The color to use when saving a image with a mode that has alpha channel to a image mode that does NOT have alpha channel. The transparent area on the original image will be filled with the given color.  \n**example usage**  \nVertically mirroring of all images of a directory:  \n`process_img mirror /images v`  \nVertically and Horizontally mirroring of all images of a directory:  \n`process_img mirror /images vh`  \n\n\n* **optimize**: Minimizes the image size.  \n`process_img optimize [file/directory] [optional arguments]`  \n**optional arguments**  \n`--save_as=[format]` must be one of the supported formats, listed above and in lower case  \n`--mode=[mode]` The color mode to use when saving the image (RGB, RGBA, CMYK, ...)  \nIf the mode of the original image is not supported by the given format it will be saved in RGB or RGBA, depending on the image type.  \n`--save_folder=[folder]` The directory where the images will be saved.  \n`--background` The color to use when saving a image with a mode that has alpha channel to a image mode that does NOT have alpha channel. The transparent area on the original image will be filled with the given color.  \n**example usage**  \nOptimize all images of a directory and save them as jpg:  \n`process_img optimize /images --save_as=jpg`  \n\n\n* **colorswap**: Replaces the color of all pixels of the image with another.  \n`process_img colorswap [file/directory] [before_color] [after_color] [optional arguments]`  \n`[before_color]` and `[after_color]` must be a list of integers for each color value or a hexadecimal color name between quotes.  \n**optional arguments**  \n`--save_as=[format]` must be one of the supported formats, listed above and in lower case  \n`--save_folder=[folder]` The directory where the images will be saved.  \n`--mode=[mode]` The color mode to use when saving the image (RGB, RGBA, CMYK, ...)  \nIf the mode of the original image is not supported by the given format it will be saved in RGB or RGBA, depending on the image type.  \n`--background` The color to use when saving a image with a mode that has alpha channel to a image mode that does NOT have alpha channel. The transparent area on the original image will be filled with the given color.  \n`-optimize` If passed, the resulting images will be optimized for a smaller file size. Only works for jpg and png images.  \n**example usage**  \nSwaps the pink background of an image with transparent:  \n`process_img colorswap pink_bg_image.png 255,0,255,255 255,255,255,0`  \nSwaps the transparent background of an image with a white one.  \n`process_img colorswap transparent_bg_image.png 255,255,255,0 255,255,255,255`  \nSwaps the transparent background of an image with a white one and save them as optimized jpg.  \n`process_img colorswap transparent_bg_image.png 255,255,255,0 255,255,255,255 --save_as=jpg -optimize`  \n\n\n* **colorinfo**: Counts how many pixels of each color are in the image or in the given area from the image.  \n`process_img colorinfo [file/directory] [optional arguments]`  \n**optional arguments**  \n`[--box]` A box of coordinates (left, upper, right, lower) representing the area to count the pixels  \n`[--pixel]` The coordinates of a single pixel, prints the color of that pixel.  \n**example usage**  \nCount the colors of the whole image.  \n`process_img colorinfo image.png`  \nCount the colors of a 100 x 100 px square located at the top left of the image.  \n`process_img colorinfo image.png --box=0,0,100,100`  \nCheck the color of a pixel at 255,100 coordinates.  \n`process_img colorinfo image.png --pixel=255,100`  \n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjubelcassio%2Fimageprocessing","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjubelcassio%2Fimageprocessing","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjubelcassio%2Fimageprocessing/lists"}