phulize


Namephulize JSON
Version 1.1.2 PyPI version JSON
download
home_pagehttps://github.com/zaytiri/photos-bulk-resize
SummaryA python CLI tool to resize images while conserving folder hierarchy and preserving original ones in a different folder.
upload_time2024-09-15 14:51:44
maintainerNone
docs_urlNone
authorzaytiri
requires_python>=3.10.6
licenseNone
keywords photos image processing resize reduce cli folder hierarchy bulk
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            [![Downloads](https://pepy.tech/badge/phulize)](https://pepy.tech/project/phulize)

# Photo Resizer CLI + GUI

## Table of Contents

- [Description](#description)
- [Features](#features)
- [Prerequisites](#prerequisites)
- [Installation](#installation)
- [Usage](#usage)
- [Support](#support)
- [License](#license)
- [Status](#status)

<a name="description"></a>

## Description

Photo Resizer is a CLI (command-line interface) tool which takes a folder full of photos and resizes each photo
recursively depending on the extensions chosen. It does this while conserving folder hierarchy without having to
organize each photo again.

All photos are checked if they are valid or corrupted before the resizing as well as after, to make sure any photos are
resized correctly.

A filter is also available for searching for photos, meaning it's possible to only resize photos which the size is
higher or below the specified. More details below.

All original photos are copied to a different folder which can be configured, also cloning the existent folder
hierarchy. If any image fails to resize, this photo will remain in the original folder.

At the start, a safety question is displayed to make sure the path inserted is the correct one as it will be permanently
modified. This safety question can be disabled.

An option to shut down the device is also available as it can be useful to leave the process running for a long time
without worrying.

When all is finished, an output file will be created with statistics and relevant information, such as:

- list of images resized;
- display original size and resized size of each image;
- display all photos' original size and resized size;
- display how much size was resized between all photos;
- total number of photos resized, increased, unsuccessful and found;
- warning if the photo size increased instead of decreased;

### GUI

Guide coming soon...

Some images for current interface:
![1](https://github.com/zaytiri/photos-bulk-resize/blob/main/readme_imgs/11.png)
![2](https://github.com/zaytiri/photos-bulk-resize/blob/main/readme_imgs/22.png)

### Output file example

```txt
    ... (hidden)

[2023-04-05 17:44:13.979793]
The following photo was resized: C:\Users\<username>\Desktop\example\1subfolder\anothersubfolder\1680170906941
	-The original photo size was: 1.98 MB
	-The resized photo size is: 2.04 MB
        [WARNING] Size increased!

[2023-04-05 17:44:14.209180]
The following photo was resized: C:\Users\<username>\Desktop\example\1subfolder\anothersubfolder\1680170908790
	-The original photo size was: 699.66 KB
	-The resized photo size is: 258.03 KB


[2023-04-05 17:44:14.211177]
Final Statistics:
	Size of all original photos: 9.29 MB
	Size of all resized photos: 4.67 MB
	Space in disk saved: 4.63 MB

	- Total number of photos with reduced size: 6
	- Total number of photos with increased size: 1
	- Total number of photos unsuccessfully reduced: 0
	- Total number of photos found: 7
```

### Folder example

The original folder full of images to be resized:<br>
![1](https://github.com/zaytiri/photos-bulk-resize/blob/main/readme_imgs/1.png)

Content of original folder before resize with pictures' original size:<br>
![5](https://github.com/zaytiri/photos-bulk-resize/blob/main/readme_imgs/5.png)

Both the original folder and the folder created after all is finished, which contains all original images:<br>
![2](https://github.com/zaytiri/photos-bulk-resize/blob/main/readme_imgs/2.png)

Display of both folders containing exactly the same hierarchy:<br>
![3](https://github.com/zaytiri/photos-bulk-resize/blob/main/readme_imgs/3.png)

Content of original folder after resize with pictures' reduced size at 55% quality and the output file:<br>
![4](https://github.com/zaytiri/photos-bulk-resize/blob/main/readme_imgs/4.png)

<a name="features"></a>

## Features

| Feature                                                                              |
|:-------------------------------------------------------------------------------------|
| resize photos in bulk conserving folder hierarchy                                    |
| resize photos depending on specific extension                                        |
| resize photos recursively  within folders                                            |
| checking of invalid or corrupted photos                                              |
| filter photos to resize depending on their size                                      |
| all original photos are preserved in another folder in case of something going wrong |
| creation of a final output file containing relevant information about the process    |
| existence of a safety question                                                       |
| option of shutting down the device when the resizing process is finished             |
| configurations provided will be save for easier usage of the command                 |

Any new features are **_very_** welcomed.

### Future features

Nothing at the moment.

<a name="prerequisites"></a>

## Prerequisites

[Python 3](https://www.python.org/downloads/) must be installed.

<a name="installation"></a>

## Installation

```bash
pip --no-cache-dir install phulize
```

or,

```bash
pip3 --no-cache-dir install phulize
```

## Usage

| Command (shortcut) | Command (full)                         | Required                             | Default value | Description                                                                                                                                      |
|:-------------------|----------------------------------------|--------------------------------------|---------------|:-------------------------------------------------------------------------------------------------------------------------------------------------|
| -r                 | --run                                  | ***REQUIRED*** to start the resizing | ---           | If specified, the resizing will start running using user-defined configurations.                                                                 |
| -p                 | --path                                 | ***REQUIRED*** to resize photos      | empty         | Absolute path of the folder containing images to be resized.                                                                                     |
| -e                 | --extensions                           | ***REQUIRED*** to resize photos      | empty         | Insert the extensions of all the images that should be resized.                                                                                  |
| -q                 | --quality                              | ***OPTIONAL***                       | 55            | The desired quality of the image. An original image has 100% quality, meaning that anything below this value will reduce the size of the images. |
| -f                 | --folder                               | ***OPTIONAL***                       | _ORIGINAL     | The name or path of the folder which will contain all original photos already resized.                                                           |
| -hi                | --higher                               | ***OPTIONAL***                       | 0             | The size in ***Bytes*** of any image that should be resized. Any images' size higher than this value will be resized.                            |
| -b                 | --below                                | ***OPTIONAL***                       | 0             | The size in ***Bytes*** of any image that should be resized. Any images' size below this value will be resized.                                  |
| ---                | --safety-question/--no-safety-question | ***OPTIONAL***                       | True          | Enable or disable the safety question                                                                                                            |
| ---                | --shutdown/--no-shutdown               | ***OPTIONAL***                       | False         | Enable or disable the shutting down device when process is finished.                                                                             |

<a name="before"></a>

### Before
- If possible, **make a backup of the folder to be resized**, in case anything goes wrong. This will ensure no data is lost.
- It's recommended that a trial is made first (with dummy images), to check the best quality to use.

<a name="after"></a>

### After
- **Make sure to check the output file for any unexpected outcomes**, regarding if it resized correctly, as expected, or not.
- **Make sure to check the images resized**, to make sure there is no loss. The program itself checks if an image is or becomes corrupted after resizing, but make sure 

<a name="important"></a>

---
### Important 
- The quality of the image to be resized, by default, is 50%, meaning all images to resize will have, approximately, 50% less quality than the original image. This can be change, adding the '--quality' argument with a number between 0 and 100.
- If the file image has the name in the following format: "IMG_<yyyymmdd>_<hhmmss>", the date is going to be added to the converted image's date-created metadata. This means the metadata of the image is going to be correct in the date_created field. Before this improvement, the date_created would be the date the file was converted since it creates a new file.
---

Any additional help can be provided if the following command is run:
```bash
phulize --help
```

or,
```bash
phulize -h
```
Running the previous command is also useful to make sure the package was downloaded correctly.

Example of an initial command, could be:
```bash
phulize -p "C:\Users\<username>\Desktop\example" -q 60 -e jpg png
```
This will configure the path of the folder containing images to resize, the quality those images should have and the extensions to search for and resize.

Any configuration can also be individually inserted:
```bash
phulize -q 50
```
```bash
phulize -f "CONVERTED" 
```

The following command corresponds to only resizing images that have a size higher than 1MB:
```bash
phulize -hi 1048576
```
The opposite is also true (resizing images that have a size lower than 1MB):
```bash
phulize -b 1048576
```
To disable the previous filters ('--hi' or '--b'), one can simply set them to 0 (zero):
```bash
phulize -b 0
```

The previous configuration can be seen in a file, with the content just like the following:
```txt
below: 0
extensions:
- .jpg
- .png
folder: CONVERTED
higher: 1048576
path: C:\Users\<username>\Desktop\example
quality: 50
```


Usage of boolean arguments:
```bash
phulize --safety-question
phulize --no-safety-question
```
```bash
phulize --shutdown
phulize --no-shutdown
```

To run the resizing after all configurations are done:
```
phulize --run
```

<a name="support"></a>

## Support

If any problems occurs, feel free to open an issue.

<a name="license"></a>

## License

[MIT](https://choosealicense.com/licenses/mit/)

<a name="status"></a>

## Status

Currently maintaining it.

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/zaytiri/photos-bulk-resize",
    "name": "phulize",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.10.6",
    "maintainer_email": null,
    "keywords": "photos, image, processing, resize, reduce, cli, folder, hierarchy, bulk",
    "author": "zaytiri",
    "author_email": null,
    "download_url": "https://files.pythonhosted.org/packages/01/13/1218df4f846ac98de6bcd25a7a843c5ac69f2286d6857f565204d2d556dc/phulize-1.1.2.tar.gz",
    "platform": null,
    "description": "[![Downloads](https://pepy.tech/badge/phulize)](https://pepy.tech/project/phulize)\n\n# Photo Resizer CLI + GUI\n\n## Table of Contents\n\n- [Description](#description)\n- [Features](#features)\n- [Prerequisites](#prerequisites)\n- [Installation](#installation)\n- [Usage](#usage)\n- [Support](#support)\n- [License](#license)\n- [Status](#status)\n\n<a name=\"description\"></a>\n\n## Description\n\nPhoto Resizer is a CLI (command-line interface) tool which takes a folder full of photos and resizes each photo\nrecursively depending on the extensions chosen. It does this while conserving folder hierarchy without having to\norganize each photo again.\n\nAll photos are checked if they are valid or corrupted before the resizing as well as after, to make sure any photos are\nresized correctly.\n\nA filter is also available for searching for photos, meaning it's possible to only resize photos which the size is\nhigher or below the specified. More details below.\n\nAll original photos are copied to a different folder which can be configured, also cloning the existent folder\nhierarchy. If any image fails to resize, this photo will remain in the original folder.\n\nAt the start, a safety question is displayed to make sure the path inserted is the correct one as it will be permanently\nmodified. This safety question can be disabled.\n\nAn option to shut down the device is also available as it can be useful to leave the process running for a long time\nwithout worrying.\n\nWhen all is finished, an output file will be created with statistics and relevant information, such as:\n\n- list of images resized;\n- display original size and resized size of each image;\n- display all photos' original size and resized size;\n- display how much size was resized between all photos;\n- total number of photos resized, increased, unsuccessful and found;\n- warning if the photo size increased instead of decreased;\n\n### GUI\n\nGuide coming soon...\n\nSome images for current interface:\n![1](https://github.com/zaytiri/photos-bulk-resize/blob/main/readme_imgs/11.png)\n![2](https://github.com/zaytiri/photos-bulk-resize/blob/main/readme_imgs/22.png)\n\n### Output file example\n\n```txt\n    ... (hidden)\n\n[2023-04-05 17:44:13.979793]\nThe following photo was resized: C:\\Users\\<username>\\Desktop\\example\\1subfolder\\anothersubfolder\\1680170906941\n\t-The original photo size was: 1.98 MB\n\t-The resized photo size is: 2.04 MB\n        [WARNING] Size increased!\n\n[2023-04-05 17:44:14.209180]\nThe following photo was resized: C:\\Users\\<username>\\Desktop\\example\\1subfolder\\anothersubfolder\\1680170908790\n\t-The original photo size was: 699.66 KB\n\t-The resized photo size is: 258.03 KB\n\n\n[2023-04-05 17:44:14.211177]\nFinal Statistics:\n\tSize of all original photos: 9.29 MB\n\tSize of all resized photos: 4.67 MB\n\tSpace in disk saved: 4.63 MB\n\n\t- Total number of photos with reduced size: 6\n\t- Total number of photos with increased size: 1\n\t- Total number of photos unsuccessfully reduced: 0\n\t- Total number of photos found: 7\n```\n\n### Folder example\n\nThe original folder full of images to be resized:<br>\n![1](https://github.com/zaytiri/photos-bulk-resize/blob/main/readme_imgs/1.png)\n\nContent of original folder before resize with pictures' original size:<br>\n![5](https://github.com/zaytiri/photos-bulk-resize/blob/main/readme_imgs/5.png)\n\nBoth the original folder and the folder created after all is finished, which contains all original images:<br>\n![2](https://github.com/zaytiri/photos-bulk-resize/blob/main/readme_imgs/2.png)\n\nDisplay of both folders containing exactly the same hierarchy:<br>\n![3](https://github.com/zaytiri/photos-bulk-resize/blob/main/readme_imgs/3.png)\n\nContent of original folder after resize with pictures' reduced size at 55% quality and the output file:<br>\n![4](https://github.com/zaytiri/photos-bulk-resize/blob/main/readme_imgs/4.png)\n\n<a name=\"features\"></a>\n\n## Features\n\n| Feature                                                                              |\n|:-------------------------------------------------------------------------------------|\n| resize photos in bulk conserving folder hierarchy                                    |\n| resize photos depending on specific extension                                        |\n| resize photos recursively  within folders                                            |\n| checking of invalid or corrupted photos                                              |\n| filter photos to resize depending on their size                                      |\n| all original photos are preserved in another folder in case of something going wrong |\n| creation of a final output file containing relevant information about the process    |\n| existence of a safety question                                                       |\n| option of shutting down the device when the resizing process is finished             |\n| configurations provided will be save for easier usage of the command                 |\n\nAny new features are **_very_** welcomed.\n\n### Future features\n\nNothing at the moment.\n\n<a name=\"prerequisites\"></a>\n\n## Prerequisites\n\n[Python 3](https://www.python.org/downloads/) must be installed.\n\n<a name=\"installation\"></a>\n\n## Installation\n\n```bash\npip --no-cache-dir install phulize\n```\n\nor,\n\n```bash\npip3 --no-cache-dir install phulize\n```\n\n## Usage\n\n| Command (shortcut) | Command (full)                         | Required                             | Default value | Description                                                                                                                                      |\n|:-------------------|----------------------------------------|--------------------------------------|---------------|:-------------------------------------------------------------------------------------------------------------------------------------------------|\n| -r                 | --run                                  | ***REQUIRED*** to start the resizing | ---           | If specified, the resizing will start running using user-defined configurations.                                                                 |\n| -p                 | --path                                 | ***REQUIRED*** to resize photos      | empty         | Absolute path of the folder containing images to be resized.                                                                                     |\n| -e                 | --extensions                           | ***REQUIRED*** to resize photos      | empty         | Insert the extensions of all the images that should be resized.                                                                                  |\n| -q                 | --quality                              | ***OPTIONAL***                       | 55            | The desired quality of the image. An original image has 100% quality, meaning that anything below this value will reduce the size of the images. |\n| -f                 | --folder                               | ***OPTIONAL***                       | _ORIGINAL     | The name or path of the folder which will contain all original photos already resized.                                                           |\n| -hi                | --higher                               | ***OPTIONAL***                       | 0             | The size in ***Bytes*** of any image that should be resized. Any images' size higher than this value will be resized.                            |\n| -b                 | --below                                | ***OPTIONAL***                       | 0             | The size in ***Bytes*** of any image that should be resized. Any images' size below this value will be resized.                                  |\n| ---                | --safety-question/--no-safety-question | ***OPTIONAL***                       | True          | Enable or disable the safety question                                                                                                            |\n| ---                | --shutdown/--no-shutdown               | ***OPTIONAL***                       | False         | Enable or disable the shutting down device when process is finished.                                                                             |\n\n<a name=\"before\"></a>\n\n### Before\n- If possible, **make a backup of the folder to be resized**, in case anything goes wrong. This will ensure no data is lost.\n- It's recommended that a trial is made first (with dummy images), to check the best quality to use.\n\n<a name=\"after\"></a>\n\n### After\n- **Make sure to check the output file for any unexpected outcomes**, regarding if it resized correctly, as expected, or not.\n- **Make sure to check the images resized**, to make sure there is no loss. The program itself checks if an image is or becomes corrupted after resizing, but make sure \n\n<a name=\"important\"></a>\n\n---\n### Important \n- The quality of the image to be resized, by default, is 50%, meaning all images to resize will have, approximately, 50% less quality than the original image. This can be change, adding the '--quality' argument with a number between 0 and 100.\n- If the file image has the name in the following format: \"IMG_<yyyymmdd>_<hhmmss>\", the date is going to be added to the converted image's date-created metadata. This means the metadata of the image is going to be correct in the date_created field. Before this improvement, the date_created would be the date the file was converted since it creates a new file.\n---\n\nAny additional help can be provided if the following command is run:\n```bash\nphulize --help\n```\n\nor,\n```bash\nphulize -h\n```\nRunning the previous command is also useful to make sure the package was downloaded correctly.\n\nExample of an initial command, could be:\n```bash\nphulize -p \"C:\\Users\\<username>\\Desktop\\example\" -q 60 -e jpg png\n```\nThis will configure the path of the folder containing images to resize, the quality those images should have and the extensions to search for and resize.\n\nAny configuration can also be individually inserted:\n```bash\nphulize -q 50\n```\n```bash\nphulize -f \"CONVERTED\" \n```\n\nThe following command corresponds to only resizing images that have a size higher than 1MB:\n```bash\nphulize -hi 1048576\n```\nThe opposite is also true (resizing images that have a size lower than 1MB):\n```bash\nphulize -b 1048576\n```\nTo disable the previous filters ('--hi' or '--b'), one can simply set them to 0 (zero):\n```bash\nphulize -b 0\n```\n\nThe previous configuration can be seen in a file, with the content just like the following:\n```txt\nbelow: 0\nextensions:\n- .jpg\n- .png\nfolder: CONVERTED\nhigher: 1048576\npath: C:\\Users\\<username>\\Desktop\\example\nquality: 50\n```\n\n\nUsage of boolean arguments:\n```bash\nphulize --safety-question\nphulize --no-safety-question\n```\n```bash\nphulize --shutdown\nphulize --no-shutdown\n```\n\nTo run the resizing after all configurations are done:\n```\nphulize --run\n```\n\n<a name=\"support\"></a>\n\n## Support\n\nIf any problems occurs, feel free to open an issue.\n\n<a name=\"license\"></a>\n\n## License\n\n[MIT](https://choosealicense.com/licenses/mit/)\n\n<a name=\"status\"></a>\n\n## Status\n\nCurrently maintaining it.\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "A python CLI tool to resize images while conserving folder hierarchy and preserving original ones in a different folder.",
    "version": "1.1.2",
    "project_urls": {
        "Changelog": "https://github.com/zaytiri/photos-bulk-resize/blob/main/CHANGELOG.md",
        "GitHub": "https://github.com/zaytiri/photos-bulk-resize",
        "Homepage": "https://github.com/zaytiri/photos-bulk-resize"
    },
    "split_keywords": [
        "photos",
        " image",
        " processing",
        " resize",
        " reduce",
        " cli",
        " folder",
        " hierarchy",
        " bulk"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "d3413cde527dd3450c346c32e966153987d279cb855dafc0c3446c2d7c27a915",
                "md5": "c80b4b09713fe6750744c17d3e72316b",
                "sha256": "e8742a5830d81be944bf4a6cebad6224605a8377aa6c7c5e370fa6a94dcc1776"
            },
            "downloads": -1,
            "filename": "phulize-1.1.2-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "c80b4b09713fe6750744c17d3e72316b",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.10.6",
            "size": 16714,
            "upload_time": "2024-09-15T14:51:43",
            "upload_time_iso_8601": "2024-09-15T14:51:43.257193Z",
            "url": "https://files.pythonhosted.org/packages/d3/41/3cde527dd3450c346c32e966153987d279cb855dafc0c3446c2d7c27a915/phulize-1.1.2-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "01131218df4f846ac98de6bcd25a7a843c5ac69f2286d6857f565204d2d556dc",
                "md5": "1aee356c838a5c70b9dcb1ffe8820f84",
                "sha256": "cd39bf29d396af03f3eb49c148ad2eced9fff8d8cf2f5f4d9bef03f9828d3b17"
            },
            "downloads": -1,
            "filename": "phulize-1.1.2.tar.gz",
            "has_sig": false,
            "md5_digest": "1aee356c838a5c70b9dcb1ffe8820f84",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.10.6",
            "size": 16766,
            "upload_time": "2024-09-15T14:51:44",
            "upload_time_iso_8601": "2024-09-15T14:51:44.642111Z",
            "url": "https://files.pythonhosted.org/packages/01/13/1218df4f846ac98de6bcd25a7a843c5ac69f2286d6857f565204d2d556dc/phulize-1.1.2.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-09-15 14:51:44",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "zaytiri",
    "github_project": "photos-bulk-resize",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "requirements": [],
    "lcname": "phulize"
}
        
Elapsed time: 0.35818s