Skip to content

Image Processing

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

9 modules

ModuleDescription
Kompres GambarKompres gambar untuk mengurangi ukuran file sambil menjaga kualitas
Konversi GambarKonversi gambar ke format berbeda (PNG, JPEG, WEBP, dll.)
Potong GambarPotong gambar ke koordinat yang ditentukan
Unduh GambarUnduh gambar dari URL ke file lokal
Ekstrak Teks OCREkstrak teks dari gambar menggunakan OCR
Hasilkan Kode QRHasilkan kode QR dari teks, URL, atau data
Ubah Ukuran GambarUbah ukuran gambar ke dimensi tertentu dengan berbagai algoritma
Putar GambarPutar gambar dengan derajat yang ditentukan
Tambahkan WatermarkTambahkan watermark teks atau gambar ke gambar

Modules

Kompres Gambar

image.compress

Kompres gambar untuk mengurangi ukuran file sambil menjaga kualitas

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_pathstringPath ke gambar terkompres
original_size_bytesnumberPath ke gambar terkompres
compressed_size_bytesnumberUkuran file asli dalam bytes
compression_rationumberUkuran file terkompres dalam bytes

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

Konversi Gambar

image.convert

Konversi gambar ke format berbeda (PNG, JPEG, WEBP, dll.)

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
pathstringPath ke gambar terkonversi
sizenumberPath ke gambar terkonversi
formatstringPath ke gambar terkonversi
dimensionsobjectUkuran file dalam bytes

Example: Convert PNG to JPEG

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

Potong Gambar

image.crop

Potong gambar ke koordinat yang ditentukan

Parameters:

NameTypeRequiredDefaultDescription
input_pathstringYes-Jalur ke gambar input
output_pathstringYes-Jalur untuk gambar output
leftnumberYes-Koordinat kiri area pemotongan
topnumberYes-Koordinat atas area pemotongan
rightnumberYes-Koordinat kanan area pemotongan
bottomnumberYes-Koordinat bawah area pemotongan

Output:

FieldTypeDescription
output_pathstringJalur ke gambar yang dipotong
widthintegerLebar gambar yang dipotong
heightintegerTinggi gambar yang dipotong
original_widthintegerLebar gambar asli
original_heightintegerTinggi gambar asli

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

Unduh Gambar

image.download

Unduh gambar dari URL ke file lokal

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
pathstringPath file lokal gambar yang diunduh
sizenumberPath file lokal gambar yang diunduh
content_typestringPath file lokal gambar yang diunduh
filenamestringUkuran file dalam bytes

Example: Download image from URL

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

Ekstrak Teks OCR

image.ocr

Ekstrak teks dari gambar menggunakan OCR

Parameters:

NameTypeRequiredDefaultDescription
image_pathstringYes-Jalur ke file gambar
languagestringNoengKode bahasa untuk OCR (mis. eng, chi_sim)
psmnumberNo3Mode segmentasi halaman Tesseract
output_typeselect (text, data, boxes)NotextJenis output OCR (teks atau data)

Output:

FieldTypeDescription
textstringTeks yang diekstrak dari gambar
confidencenumberSkor kepercayaan OCR
languagestringBahasa yang digunakan untuk OCR

Example: Extract text from image

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

Hasilkan Kode QR

image.qrcode_generate

Hasilkan kode QR dari teks, URL, atau data

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_pathstringPath ke gambar kode QR yang dihasilkan
file_sizenumberPath ke gambar kode QR yang dihasilkan
dimensionsobjectUkuran file output dalam bytes

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

Ubah Ukuran Gambar

image.resize

Ubah ukuran gambar ke dimensi tertentu dengan berbagai algoritma

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_pathstringPath ke gambar yang diubah ukurannya
original_sizeobjectPath ke gambar yang diubah ukurannya
new_sizeobjectPath ke gambar yang diubah ukurannya

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

Putar Gambar

image.rotate

Putar gambar dengan derajat yang ditentukan

Parameters:

NameTypeRequiredDefaultDescription
input_pathstringYes-Jalur ke gambar input
output_pathstringYes-Jalur untuk gambar output
anglenumberYes-Sudut rotasi dalam derajat
expandbooleanNoTruePerluas output untuk menampung seluruh gambar yang diputar
fill_colorstringNo#000000Warna untuk mengisi area kosong setelah rotasi

Output:

FieldTypeDescription
output_pathstringJalur ke gambar yang diputar
widthintegerLebar gambar yang diputar
heightintegerTinggi gambar yang diputar
anglenumberSudut gambar diputar

Example: Rotate 90 degrees

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

Tambahkan Watermark

image.watermark

Tambahkan watermark teks atau gambar ke gambar

Parameters:

NameTypeRequiredDefaultDescription
input_pathstringYes-Jalur ke gambar input
output_pathstringYes-Jalur untuk gambar output
textstringNo-Teks yang digunakan sebagai watermark
watermark_imagestringNo-Jalur ke file gambar yang digunakan sebagai watermark
positionselect (center, top-left, top-right, bottom-left, bottom-right)Nobottom-rightPosisi watermark pada gambar
opacitynumberNo0.5Opasitas watermark (0.0 hingga 1.0)
font_sizenumberNo36Ukuran font untuk watermark teks

Output:

FieldTypeDescription
output_pathstringJalur ke gambar dengan watermark
watermark_typestringJenis watermark yang diterapkan (teks atau gambar)

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.