Skip to content

Image Processing

Resize, crop, compress, convert, OCR, QR codes, and watermarks.

9 modules

ModuleDescription
บีบอัดรูปภาพบีบอัดรูปภาพเพื่อลดขนาดไฟล์โดยรักษาคุณภาพ
แปลงรูปภาพแปลงรูปภาพเป็นรูปแบบอื่น (PNG, JPEG, WEBP ฯลฯ)
ครอบตัดรูปภาพครอบตัดรูปภาพตามพิกัดที่กำหนด
ดาวน์โหลดรูปภาพดาวน์โหลดรูปภาพจาก URL ไปยังไฟล์ในเครื่อง
OCR ดึงข้อความดึงข้อความจากรูปภาพด้วย OCR
สร้าง QR Codeสร้าง QR code จากข้อความ, URL หรือข้อมูล
ปรับขนาดรูปภาพปรับขนาดรูปภาพตามขนาดที่กำหนดด้วยอัลกอริทึมต่างๆ
หมุนรูปภาพหมุนรูปภาพตามองศาที่กำหนด
เพิ่มลายน้ำเพิ่มลายน้ำข้อความหรือรูปภาพลงในรูปภาพ

Modules

บีบอัดรูปภาพ

image.compress

บีบอัดรูปภาพเพื่อลดขนาดไฟล์โดยรักษาคุณภาพ

Parameters:

NameTypeRequiredDefaultDescription
input_pathstringYes-Path to the input image file
output_pathstringNo-Path where the processed image will be saved
qualitynumberNo85Quality level (1-100, higher is better)
optimizebooleanNoTrueApply additional optimization
max_size_kbnumberNo-Target maximum file size in KB
formatselect (png, jpeg, webp, gif, bmp, tiff)NopngOutput image format

Output:

FieldTypeDescription
output_pathstringพาธไปยังรูปภาพที่บีบอัด
original_size_bytesnumberพาธไปยังรูปภาพที่บีบอัด
compressed_size_bytesnumberขนาดไฟล์ต้นฉบับเป็นไบต์
compression_rationumberขนาดไฟล์ที่บีบอัดเป็นไบต์

Example: Compress with quality setting

yaml
input_path: /path/to/image.jpg
quality: 75

Example: Compress to target size

yaml
input_path: /path/to/image.png
max_size_kb: 500

แปลงรูปภาพ

image.convert

แปลงรูปภาพเป็นรูปแบบอื่น (PNG, JPEG, WEBP ฯลฯ)

Parameters:

NameTypeRequiredDefaultDescription
input_pathstringYes-Path to the input image file
output_pathstringNo-Path where the processed image will be saved
formatselect (png, jpeg, webp, gif, bmp, tiff)YespngOutput image format
qualitynumberNo85Quality level (1-100, higher is better)
resizeobjectNo-Resize options:

Output:

FieldTypeDescription
pathstringพาธไปยังรูปภาพที่แปลง
sizenumberพาธไปยังรูปภาพที่แปลง
formatstringพาธไปยังรูปภาพที่แปลง
dimensionsobjectขนาดไฟล์เป็นไบต์

Example: Convert PNG to JPEG

yaml
input_path: /tmp/image.png
format: jpeg
quality: 90

ครอบตัดรูปภาพ

image.crop

ครอบตัดรูปภาพตามพิกัดที่กำหนด

Parameters:

NameTypeRequiredDefaultDescription
input_pathstringYes-เส้นทางไปยังรูปภาพต้นฉบับ
output_pathstringYes-เส้นทางสำหรับรูปภาพที่ส่งออก
leftnumberYes-พิกัดด้านซ้ายของพื้นที่ครอบตัด
topnumberYes-พิกัดด้านบนของพื้นที่ครอบตัด
rightnumberYes-พิกัดด้านขวาของพื้นที่ครอบตัด
bottomnumberYes-พิกัดด้านล่างของพื้นที่ครอบตัด

Output:

FieldTypeDescription
output_pathstringเส้นทางไปยังรูปภาพที่ถูกครอบตัด
widthintegerความกว้างของรูปภาพที่ถูกครอบตัด
heightintegerความสูงของรูปภาพที่ถูกครอบตัด
original_widthintegerความกว้างของรูปภาพต้นฉบับ
original_heightintegerความสูงของรูปภาพต้นฉบับ

Example: Crop center region

yaml
input_path: /path/to/image.png
output_path: /path/to/cropped.png
left: 100
top: 100
right: 500
bottom: 400

ดาวน์โหลดรูปภาพ

image.download

ดาวน์โหลดรูปภาพจาก URL ไปยังไฟล์ในเครื่อง

Parameters:

NameTypeRequiredDefaultDescription
urlstringYes-URL of the image to download
output_pathstringNo-Path where the processed image will be saved
output_dirstringNo/tmpDirectory where output files will be saved
headersobjectNo{}HTTP request headers as key-value pairs
timeoutnumberNo30Maximum time to wait in seconds

Output:

FieldTypeDescription
pathstringพาธไฟล์ในเครื่องของรูปภาพที่ดาวน์โหลด
sizenumberพาธไฟล์ในเครื่องของรูปภาพที่ดาวน์โหลด
content_typestringพาธไฟล์ในเครื่องของรูปภาพที่ดาวน์โหลด
filenamestringขนาดไฟล์เป็นไบต์

Example: Download image from URL

yaml
url: https://example.com/photo.jpg
output_dir: /tmp/images

OCR ดึงข้อความ

image.ocr

ดึงข้อความจากรูปภาพด้วย OCR

Parameters:

NameTypeRequiredDefaultDescription
image_pathstringYes-เส้นทางไปยังไฟล์รูปภาพ
languagestringNoengรหัสภาษาสำหรับ OCR (เช่น eng, chi_sim)
psmnumberNo3โหมดการแบ่งหน้า Tesseract
output_typeselect (text, data, boxes)Notextประเภทของผลลัพธ์ OCR (ข้อความหรือข้อมูล)

Output:

FieldTypeDescription
textstringข้อความที่ดึงจากรูปภาพ
confidencenumberคะแนนความมั่นใจของ OCR
languagestringภาษาที่ใช้สำหรับ OCR

Example: Extract text from image

yaml
image_path: /path/to/document.png
language: eng

สร้าง QR Code

image.qrcode_generate

สร้าง QR code จากข้อความ, URL หรือข้อมูล

Parameters:

NameTypeRequiredDefaultDescription
datastringYes-Text, URL, or data to encode
output_pathstringNo-Path where the processed image will be saved
formatselect (png, svg)NopngOutput image format
sizenumberNo300Size in pixels
colorstringNo#000000Color of the QR code (hex or name)
backgroundstringNo#FFFFFFBackground color (hex or name)
error_correctionselect (L, M, Q, H)NoMError correction level
bordernumberNo4Border width in modules (quiet zone)
versionnumberNo-QR code version 1-40 (leave empty for auto-detect)
logo_pathstringNo-Path to logo image to embed in center

Output:

FieldTypeDescription
output_pathstringพาธไปยังรูปภาพ QR code ที่สร้าง
file_sizenumberพาธไปยังรูปภาพ QR code ที่สร้าง
dimensionsobjectขนาดไฟล์เอาต์พุตเป็นไบต์

Example: Generate URL QR code

yaml
data: https://flyto.dev
output_path: /tmp/flyto_qr.png

Example: Custom styled QR code

yaml
data: Hello World
color: #6366F1
size: 500
error_correction: H

Example: SVG QR code

yaml
data: https://flyto.dev
format: svg
border: 2

ปรับขนาดรูปภาพ

image.resize

ปรับขนาดรูปภาพตามขนาดที่กำหนดด้วยอัลกอริทึมต่างๆ

Parameters:

NameTypeRequiredDefaultDescription
input_pathstringYes-Path to the input image file
output_pathstringNo-Path where the processed image will be saved
widthnumberNo-Target width in pixels
heightnumberNo-Target height in pixels
scalenumberNo-Scale factor (e.g., 0.5 for half, 2.0 for double)
algorithmselect (lanczos, bicubic, bilinear, nearest)NolanczosResampling algorithm for resize
maintain_aspectbooleanNoTrueMaintain original aspect ratio

Output:

FieldTypeDescription
output_pathstringพาธไปยังรูปภาพที่ปรับขนาด
original_sizeobjectพาธไปยังรูปภาพที่ปรับขนาด
new_sizeobjectพาธไปยังรูปภาพที่ปรับขนาด

Example: Resize to specific dimensions

yaml
input_path: /path/to/image.png
width: 800
height: 600

Example: Scale by factor

yaml
input_path: /path/to/image.png
scale: 0.5

หมุนรูปภาพ

image.rotate

หมุนรูปภาพตามองศาที่กำหนด

Parameters:

NameTypeRequiredDefaultDescription
input_pathstringYes-เส้นทางไปยังรูปภาพต้นฉบับ
output_pathstringYes-เส้นทางสำหรับรูปภาพที่ส่งออก
anglenumberYes-มุมการหมุนเป็นองศา
expandbooleanNoTrueขยายผลลัพธ์เพื่อรองรับรูปภาพที่หมุนทั้งหมด
fill_colorstringNo#000000สีเติมพื้นที่ว่างหลังจากหมุน

Output:

FieldTypeDescription
output_pathstringเส้นทางไปยังรูปภาพที่ถูกหมุน
widthintegerความกว้างของรูปภาพที่ถูกหมุน
heightintegerความสูงของรูปภาพที่ถูกหมุน
anglenumberมุมที่รูปภาพถูกหมุน

Example: Rotate 90 degrees

yaml
input_path: /path/to/image.png
output_path: /path/to/rotated.png
angle: 90

เพิ่มลายน้ำ

image.watermark

เพิ่มลายน้ำข้อความหรือรูปภาพลงในรูปภาพ

Parameters:

NameTypeRequiredDefaultDescription
input_pathstringYes-เส้นทางไปยังภาพต้นฉบับ
output_pathstringYes-เส้นทางสำหรับภาพผลลัพธ์
textstringNo-ข้อความที่ใช้เป็นลายน้ำ
watermark_imagestringNo-เส้นทางไปยังไฟล์ภาพที่ใช้เป็นลายน้ำ
positionselect (center, top-left, top-right, bottom-left, bottom-right)Nobottom-rightตำแหน่งของลายน้ำบนภาพ
opacitynumberNo0.5ความโปร่งใสของลายน้ำ (0.0 ถึง 1.0)
font_sizenumberNo36ขนาดตัวอักษรสำหรับลายน้ำข้อความ

Output:

FieldTypeDescription
output_pathstringเส้นทางไปยังภาพที่มีลายน้ำ
watermark_typestringประเภทของลายน้ำที่ใช้ (ข้อความหรือภาพ)

Example: Add text watermark

yaml
input_path: /path/to/image.png
output_path: /path/to/watermarked.png
text: © 2026 Company
position: bottom-right
opacity: 0.5

Released under the Apache 2.0 License.