A lightweight Streamlit image text editor that lets you select a text area on an uploaded image, cover that area, render new Korean or English text, and download the edited result as a PNG.
- Image Upload: Supports PNG, JPG, JPEG, and WEBP files
- Canvas Area Selection: Draws a rectangle over the text area to edit
- Local Text Replacement: Covers only the selected area and renders replacement text
- Korean Font Support: Loads
.ttf,.otf, and.ttcfonts from thefonts/directory - Text Styling Controls: Adjusts font, size, color, alignment, and line spacing
- Background Cover Options: Uses surrounding average color or a manually selected solid color
- PNG Export: Downloads the edited image locally
- Python 3.9+
- Streamlit
- streamlit-drawable-canvas
- Pillow
- NumPy
git clone https://github.com/CrabAI/image_text_editor_agent.git
cd image_text_editor_agentpython -m venv .venv
source .venv/bin/activatepip install -r requirements.txtstreamlit run app.pyOpen the Streamlit URL, upload an image, draw a rectangle over the text you want to replace, adjust the edit settings, apply the change, and download the PNG result.
Image text editor
1. Upload a PNG, JPG, JPEG, or WEBP image
2. Draw a rectangle around the text area
3. Enter replacement text
4. Choose font, size, color, alignment, spacing, and cover mode
5. Apply the edit to the selected area
6. Download the edited image as PNG
edited_image.png: Downloaded PNG created from the current edited image
The app does not save uploaded or edited images to the repository by default.
image_text_editor_agent/
├── app.py
├── requirements.txt
├── .gitignore
├── README.md
├── fonts/
│ ├── Paperlogy-1Thin.ttf
│ ├── Paperlogy-2ExtraLight.ttf
│ ├── Paperlogy-3Light.ttf
│ ├── Paperlogy-4Regular.ttf
│ ├── Paperlogy-5Medium.ttf
│ ├── Paperlogy-6SemiBold.ttf
│ ├── Paperlogy-7Bold.ttf
│ ├── Paperlogy-8ExtraBold.ttf
│ └── Paperlogy-9Black.ttf
└── image_text_editor/
├── __init__.py
├── editor.py
├── font_manager.py
├── image_io.py
└── text_layout.py
Korean text needs a Korean-capable font in fonts/. This repository includes Paperlogy font files for local rendering. You can also add fonts such as Noto Sans KR, Pretendard, or NanumGothic.
Uploaded image
|
v
Canvas rectangle selection
|
v
Normalize selected box to source image coordinates
|
v
Cover selected area with average or solid background color
|
v
Wrap and render replacement text inside the box
|
v
Download edited PNG
.envand.streamlit/secrets.tomlare not tracked- Local output, upload, download, log, cache, and virtual environment files are not tracked
- Uploaded images are handled in the Streamlit session and are not saved by the app by default
- Avoid committing personal photos, customer screenshots, confidential documents, or generated private outputs
- Review edited images before sharing them externally
- Make sure the font file exists in
fonts/ - Use
.ttf,.otf, or.ttcfont files - Confirm the font supports the characters you want to render
- Increase the rectangle size
- Reduce the font size
- Reduce line spacing
- Use a shorter replacement phrase
- Try the manual solid color option
- Select a slightly larger rectangle around the original text
- Complex gradients or textured backgrounds may need manual image editing
MIT