PY SIC
1.0.0

英語| 簡體中文
PY-SIC代表“ Python的簡單圖像轉換器”。它可以看作是流行的Python Imaging庫枕頭的簡單包裝器,但由於@Egocarib提供的解決方法,它包含一個可以更好的GIF轉換質量的補丁。維護此存儲庫的想法來自在我的另一個名為Weibo Emoji的存儲庫中重構腳本的過程。主要目的是自動化,因為我發現它很耗時以轉換圖像並手動保持原始文件結構。總而言之,PY-SIC主要可以幫助您:
請注意,該代碼是根據GPL-3.0許可證獲得許可的。
我可以請您的注意嗎?
到2021年10月17日,Pycharm 2021.2.2 + Python 3.10.0看起來一切都很好。您絕對可以使用Visual Studio代碼,但是您可能需要調整某些腳本中的導入行為以使其正確運行。
PY-SIC應支持Python 3.6+,並依靠以下列出的軟件包。要自己構建包裹,請參考此項目的包裹要求。
| 姓名 | 版本 |
|---|---|
| 枕頭 | ≥8.4.0 |
| TQDM | ≥4.62.2 |
TODO:由於PY-SIC在其超級alpha釋放中,這部分將會發生重大變化。
pip install py-sic # Use pip3 if required. from pysic . engine import SIC
from pysic . errors import EmptyInputError
from pysic . pillow_gif_patch import ALPHA_THRESHOLD
FAIL = "Fail:"
sic = SIC (
has_pbar = True , # A flag indicating whether to show the progress bar or not.
input_path = "your/path/to/input" # The path to an input image or the directory for locating the input image(s).
)
try :
sic . convert (
alpha_threshold = ALPHA_THRESHOLD , # The threshold for the alpha channel.
has_init_output = False , # A flag indicating if the output directory should be cleaned up first.
has_input_structure = True , # A flag indicating if the file structure of the input directory should be kept.
output_dir = "your/path/to/output" # The output directory for the converted image(s).
to_fmt = to_fmt # The target image format for conversion.
)
except EmptyInputError as empty_input :
print ( FAIL , empty_input )
except FileExistsError as file_exists :
print ( FAIL , file_exists )
except FileNotFoundError as input_not_found :
print ( FAIL , input_not_found )
except ValueError as value :
print ( FAIL , value )希望您會發現它有用! ?