
الإنجليزية | 简体中文
PY-SIC يرمز إلى "محول صورة بسيط لـ Python". يمكن اعتباره غلافًا بسيطًا من وسادة مكتبة Python Python الشهيرة ، ولكنه يحتوي على تصحيح لجودة تحويل GIF أفضل ، وذلك بفضل الحل البديل الذي توفره egocarib. فكرة الحفاظ على هذا المستودع تأتي من عملية إعادة إنشاء البرامج النصية في مستودع آخر من الألغام المسمى Weibo Emoji. الغرض الأساسي هو الأتمتة ، حيث وجدت أنه يستغرق وقتًا طويلاً لتحويل الصور والحفاظ على بنية الملف الأصلية يدويًا. باختصار ، يمكن أن يساعدك PY-SIC بشكل أساسي في:
يرجى ملاحظة أن الرمز مرخص بموجب ترخيص GPL-3.0.
هل لي انتباهك الرجاء؟
بحلول 17 أكتوبر 2021 ، يبدو كل شيء جيدًا مع 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 في إصداره الفائق ألفا.
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 )آمل أن تجدها مفيدة! ؟