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 )希望您会发现它有用! ?