victordomingos / optimize-images

A command-line interface (CLI) utility written in pure Python to help you reduce the file size of images.
https://no-title.victordomingos.com/projects/optimize-images
MIT License
269 stars 49 forks source link

[Question] - Using The Library #44

Closed omarchouman closed 4 months ago

omarchouman commented 4 months ago

Hello There!

I just wanted to ask, is this library exclusively a cli utility.

can I import it in a python console application for example as a function or method.

If so, how exactly ?

Thank you

victordomingos commented 4 months ago

Hi! Thanks for your interest in this project.

Actually this started as a CLI application and was not initially intended to be used as a library, and that's the reason why it's not documented. I understand the usefulness of such a library, though. I have myself started a separate project for a GUI application based on, Optimize Images X:

https://github.com/victordomingos/optimize-images-x

It uses the original optimize-images as a library, so you can check its source code for a practical example on how to use it.

omarchouman commented 4 months ago

It turned out I can just use the optimize_as_batch() function and just do optimize_as_batch(image) and It worked normally. This is okay for me since I just want basic optimization without many options or arguments.

Thank you

victordomingos commented 4 months ago

Glad you find it useful.