Un convertisseur d'images vers ASCII à partir d'URLs Unsplash
Project description
🎨 Artbot – Convertisseur d'images en ASCII
Artbot est un outil Python permettant de :
- Scraper les images d'une page web (comme Unsplash),
- Télécharger une image à un index donné,
- Appliquer un redimensionnement et un flou optionnel,
- Convertir l'image en ASCII art,
- Générer un fichier HTML,
- Ou servir le résultat via une API FastAPI.
🚀 Installation
Assurez-vous d’avoir Python 3.8+ installé.
1. Cloner le dépôt
git clone <url-du-repo>
cd ArtBot
2. Installer le projet
pip install -e .
Cela installe toutes les dépendances et rend la commande CLI artbot disponible.
💻 Utilisation en ligne de commande
artbot --url <PAGE_URL> --index <N> [--blur <RAYON>] [--size <LARGEUR>]
Paramètres :
--url: URL d'une page contenant des images (ex: unsplash.com/fr)--index: Position de l'image à télécharger (1 = première image)--blur: (optionnel) Rayon de flou à appliquer (par défaut : 0)--size: (optionnel) Largeur de l'ASCII art en caractères (par défaut : 100)
Exemple :
artbot --url https://unsplash.com/fr --index 3 --blur 2 --size 80
➡ Cela télécharge la 3e image, applique un flou, et génère un fichier ascii_art.html.
🌐 Utilisation en API (FastAPI)
Lancer le serveur API :
artbot --serve
Endpoints disponibles :
POST /ascii
Retourne le contenu HTML du fichier ascii_art.html (généré préalablement par la CLI).
- Méthode :
POST - Réponse : HTML affichant l’art ASCII
📂 Structure du projet
artbot/
├── __main__.py # Point d'entrée CLI + API
├── api.py # Serveur FastAPI
├── fetch_images.py # Scraping & téléchargement
├── pixel_to_ascii.py # Conversion image → ASCII
img/
├── img.jpg # Image téléchargée
├── processed_img.jpg # Image redimensionnée/floutée
result/
├── ascii_art.html # Résultat ASCII au format HTML
setup.py
README.md
🧠 Détails techniques
-
fetch_images.py:- Scrape les balises
<img>d'une page HTML. - Télécharge l'image selon l’index spécifié.
- Scrape les balises
-
pixel_to_ascii.py:- Convertit une image PIL en ASCII avec une largeur définie.
- Gère la conversion vers un fichier HTML stylisé.
-
api.py:- Expose
/asciivia FastAPI pour afficher le HTML.
- Expose
-
__main__.py:- Sert d’interface CLI principale (
--url,--index,--blur,--size) - Ou lance l’API (
--serve)
- Sert d’interface CLI principale (
📄 Licence
Ce projet est sous licence MIT.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file artbot_philippe_noa-0.1.5.tar.gz.
File metadata
- Download URL: artbot_philippe_noa-0.1.5.tar.gz
- Upload date:
- Size: 5.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
90f2f5ef570f6e51bb1651860ea79e577b9458eafa54bf8b4731a3c7ff59ce5d
|
|
| MD5 |
6c7231e2f5708c6c61ebc3570e6e73d5
|
|
| BLAKE2b-256 |
de827982b773e38e9eeb981a34867048f90d8311c6fb3acf4ad10264e07e2f22
|
File details
Details for the file artbot_philippe_noa-0.1.5-py3-none-any.whl.
File metadata
- Download URL: artbot_philippe_noa-0.1.5-py3-none-any.whl
- Upload date:
- Size: 6.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b925fd49b8cc1a8507ace7effee3da0527e763a0dd283157b161692e5d04d67b
|
|
| MD5 |
ba1969cfa8d31157b6f235b2fef4bc54
|
|
| BLAKE2b-256 |
59dd8f3942e4c075c5e1ee35decd5a2cd76f82d2ee389df099093228764b3cb8
|