|
1 | 1 | # HEIC2PNG
|
2 | 2 |
|
3 |
| -[](https://github.com/NatLee/HEIC2PNG/actions/workflows/test.yml)[](https://github.com/NatLee/HEIC2PNG/actions/workflows/release.yml) |
| 3 | +[](https://github.com/NatLee/HEIC2PNG/actions/workflows/test.yml) |
| 4 | +[](https://github.com/NatLee/HEIC2PNG/actions/workflows/release.yml) |
4 | 5 |
|
5 |
| -This is a tool for converting format of HEIC image to PNG by using Python. |
6 |
| - |
7 |
| -And it can be used with simple CLI mode. |
8 |
| - |
9 |
| -I used the pypi package template to generate this repo, you can check it in the [references](#References). |
| 6 | +This is a tool for converting the format of HEIC images to PNG using Python. It now supports quality adjustment and has an option to overwrite existing files, enhancing the flexibility and usability of the tool. |
10 | 7 |
|
11 | 8 | ## Installation
|
12 | 9 |
|
13 | 10 | ```bash
|
14 | 11 | pip install heic2png
|
15 | 12 | ```
|
16 | 13 |
|
17 |
| -You can visit it on https://pypi.org/project/HEIC2PNG/ . |
| 14 | +Visit [HEIC2PNG on PyPI](https://pypi.org/project/HEIC2PNG/) for more details. |
18 | 15 |
|
19 | 16 | ## Usage
|
20 | 17 |
|
21 |
| -Common use with code below. |
| 18 | +### As a Library |
| 19 | + |
| 20 | +You can use HEIC2PNG in your Python code as shown below: |
22 | 21 |
|
23 | 22 | ```python
|
24 | 23 | from heic2png import HEIC2PNG
|
25 | 24 |
|
26 | 25 | if __name__ == '__main__':
|
27 |
| - heic_img = HEIC2PNG('test.heic') |
28 |
| - heic_img.save() # it'll show as `test.png` |
29 |
| - |
| 26 | + heic_img = HEIC2PNG('test.heic', quality=90) # Specify the quality of the converted image |
| 27 | + heic_img.save() # The converted image will be saved as `test.png` |
30 | 28 | ```
|
31 | 29 |
|
32 |
| -And, you can try CLI with this. |
| 30 | +### Command Line Interface |
| 31 | + |
| 32 | +HEIC2PNG also provides a CLI for easy conversion of HEIC images to PNG. Here are some examples: |
| 33 | + |
| 34 | +Convert a HEIC image to PNG with a specified output path: |
33 | 35 |
|
34 | 36 | ```bash
|
35 |
| -heic2png --input_path test.heic --output_path test.png |
| 37 | +heic2png -i test.heic -o test.png -q 90 # -q is used to specify the quality |
36 | 38 | ```
|
37 | 39 |
|
38 |
| -Or, you want to keep original name, just use this. |
| 40 | +If you want to keep the original name, use the command below. It will generate `test.png` for you: |
39 | 41 |
|
40 | 42 | ```bash
|
41 |
| -heic2png --input_path test.heic |
| 43 | +heic2png -i test.heic -q 90 |
42 | 44 | ```
|
43 | 45 |
|
44 |
| -It'll generate `test.png` for you. |
| 46 | +To overwrite an existing PNG file, use the `-w`` flag: |
45 | 47 |
|
| 48 | +```bash |
| 49 | +heic2png -i test.heic -o test.png -q 90 -w |
| 50 | +``` |
46 | 51 | ## References
|
47 | 52 |
|
48 | 53 | - [Example PyPi Package](https://github.com/tomchen/example_pypi_package)
|
49 | 54 | - [Pillow HEIF](https://github.com/bigcat88/pillow_heif)
|
| 55 | +- [pngquant](https://pngquant.org/) |
0 commit comments