
Inglés | 简体中文
Py-Sic significa "un convertidor de imagen simple para Python". Podría verse como un envoltorio simple de la popular almohada de la biblioteca de imágenes de Python, pero contiene un parche para una mejor calidad de conversión de GIF, gracias a la solución proporcionada por @egocarib. La idea de mantener este repositorio proviene del proceso de refactorización de los scripts en otro repositorio mío llamado Weibo Emoji. El propósito principal es la automatización, ya que me pareció mucho tiempo convertir imágenes y mantener la estructura del archivo original manualmente. En resumen, Py-Sic puede ayudarlo principalmente con:
Tenga en cuenta que el código tiene licencia bajo la licencia GPL-3.0.
¿Puedo tener su atención por favor?
Para el 17 de octubre de 2021, todo se ve bien con Pycharm 2021.2.2 + Python 3.10.0. Definitivamente podría usar el código Visual Studio, pero es posible que deba ajustar el comportamiento de importación en algunos scripts para que se ejecuten correctamente.
Py-Sic debería admitir Python 3.6+, y se basa en los paquetes que se enumeran a continuación. Para construir el paquete usted mismo, consulte los requisitos del paquete para este proyecto.
| Nombre | Versión |
|---|---|
| Almohada | ≥ 8.4.0 |
| TQDM | ≥ 4.62.2 |
TODO: Esta parte tendrá cambios significativos ya que Py-Sic está en su liberación súper alfa.
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 )¡Espero que lo encuentres útil! ?