Skip to content

RAGFlow is an agent-native database: a Retrieval-Augmented Generation (RAG) engine that grew into context infrastructure.

Fixed bug: Prevent 400 errors from Image2Text providers by skipping images smaller than 11px on any side during figure enhancement. (#12868)

LIRUI YUc8bd413e4cee
diff --git a/rag/app/picture.py b/rag/app/picture.py
index c60b7e85e1..d8332fd768 100644
--- a/rag/app/picture.py
+++ b/rag/app/picture.py
@@ -105,6 +105,12 @@ def vision_llm_chunk(binary, vision_model, prompt=None, callback=None):
txt = ""
try:
+ # Skip tiny crops that fail provider image-size limits.
+ if hasattr(img, "size"):
+ min_side = 11
+ if img.size[0] < min_side or img.size[1] < min_side:
+ callback(0.0, f"Skip tiny image for VLM: {img.size[0]}x{img.size[1]}")
+ return ""
with io.BytesIO() as img_binary:
try:
img.save(img_binary, format="JPEG")