https://github.com/insality/nine-patch-optimizer
Tool to make 9patch from images. Optimize image size
https://github.com/insality/nine-patch-optimizer
Last synced: about 1 year ago
JSON representation
Tool to make 9patch from images. Optimize image size
- Host: GitHub
- URL: https://github.com/insality/nine-patch-optimizer
- Owner: Insality
- Created: 2022-03-19T15:36:41.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2022-05-15T08:56:54.000Z (about 4 years ago)
- Last Synced: 2025-02-06T05:18:32.175Z (over 1 year ago)
- Language: Python
- Size: 32.2 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Nine Patch Image Optimiser
The python script to check image to make nine patch image and reduce it size.

# Usage
The script using the [imagemagick Wand](https://docs.wand-py.org/en/0.6.7/). To install it use next command:
```
$ pip install Wand
```
You can pass folder with images, the output folder will be created nearby with script file
`python parse_directory.py ./path_to_image_folder`
You can pass single image and pass the output name (or it will create the same image nearby script file)
`python parse_file.py ./path_to_image.png ./path_to_output_image.png`
The image output:

# Output
For every processed image you will get the next output (I recommend you to store all processed info to single file to check image settings later)
```
Image: button_purple.png Output: button_purple.png Origin Size: 368x128 New Size: 122x128 9Patch side: [60, 0, 60, 0] Saved: 66.85%
```
To use image as before, set in the editor nine patch settings:
`60 (from left) 0 (from top) 60 (from right) 0 (from bottom)`
And set node size to origin size:
`Origin Size: 368x128`