Lewati ke konten utama

Ubah Ukuran Gambar di n8n

Ubah Ukuran Gambar adalah sebuah PDF4me tindakan node di n8n Fitur ini mengubah ukuran gambar baik berdasarkan persentase dari ukuran aslinya atau ke lebar dan tinggi piksel yang tepat, dengan opsi mempertahankan rasio aspek yang dapat diaktifkan/dinonaktifkan. Gunakan fitur ini untuk membuat thumbnail, menormalkan unggahan pengguna ke ukuran standar, atau mengecilkan foto yang terlalu besar sebelum disimpan.

Fungsi node ini

PDF4meUbah Ukuran Gambar mengambil gambar dari Data Biner, sebuah Base64 String, atau sebuah URL dan mengembalikan salinan yang diskalakan. Itu Jenis Pengubahan Ukuran Bidang tersebut menentukan metodenya: Persentase skala relatif terhadap aslinya, yang cocok untuk input dengan ukuran campuran, sementara Spesifik menargetkan lebar dan tinggi yang tepat dalam piksel untuk slot tata letak tetap. Karena node berjalan sekali per item yang masuk, satu node yang dikonfigurasi mengubah ukuran seluruh batch dengan pengaturan yang identik.

Postingan Blog Terkait
Belum ada postingan blog untuk fitur ini — akan segera hadir.
Sementara itu, jelajahi blog PDF4me untuk menemukan tutorial dan alur kerja di berbagai platform.
Kunjungi blog ini

Memverifikasi Identitas Anda API Meminta

Setiap PDF4me simpul di n8n memerlukan validitas Kredensial untuk terhubung denganBuat atau pilih salah satu yang sesuai dengan kebutuhan Anda. PDF4me API kunci agar alur kerja dapat mengautentikasi permintaan pengubahan ukuran dengan aman.

Fakta Penting yang Tidak Boleh Anda Lewatkan

Jenis Pengubahan Ukuran menentukan bidang mana yang akan ditampilkan.
Memilih Persentase akan menampilkan Persentase Pengubahan Ukuran. Memilih Spesifik akan menampilkan Lebar dan Tinggi. Anda tidak perlu mengisi kedua set kolom tersebut.
Mempertahankan rasio aspek mencegah distorsi.
Biarkan opsi ini tetap aktif kecuali Anda memang membutuhkan dimensi yang tidak proporsional. Jika dimatikan, lebar dan tinggi yang tidak sesuai akan meregangkan gambar.
Pembesaran tidak dapat menciptakan detail.
Persentase di atas 100 meningkatkan dimensi piksel tetapi tidak meningkatkan ketajaman. Selalu mulai dari sumber resolusi tertinggi yang tersedia.
Node PDF4me di n8n diatur ke Aksi Ubah Ukuran Gambar, Tipe Data Masukan Data Biner, Bidang Biner Masukan data, Nama File Keluaran resize_image_output.jpg, Tipe Ubah Ukuran Persentase, Persentase Ubah Ukuran 50, dengan opsi Pertahankan Rasio Aspek dan Asinkron diaktifkan.

PDF4me Panel parameter Ubah Ukuran Gambar di n8n, ditampilkan dalam mode Persentase

Persentase vs Spesifik: Jenis Pengubahan Ukuran Mana yang Harus Anda Gunakan?

Kedua mode tersebut menyelesaikan masalah yang berbeda, dan memilih mode yang salah adalah penyebab paling umum dari ukuran output yang tidak terduga.

Jenis Pengubahan UkuranKolom yang Anda isiPaling cocok
PercentageResize Percentage, for example 50 to halve or 200 to doubleMixed-size inputs that should all shrink or grow by the same proportion, keeping their relative differences
SpecificWidth and Height in pixelsA fixed layout slot, thumbnail grid, or platform that demands exact dimensions regardless of the source size

Parameter apa saja yang dibutuhkan untuk mengubah ukuran gambar?

Diperlukan: Aksi, Tipe Data Masukan, kolom yang sesuai dengan tipe masukan tersebut, Nama File Keluaran, Tipe Pengubahan Ukuran, dan kolom dimensi yang diungkapkan oleh Tipe Pengubahan Ukuran. Async dan Nama Keluaran Data Biner membawa nilai default yang berfungsi.

ParameterDiperlukanApa fungsinya?Contoh
ActionRequiredSelects the PDF4me node action to run. Choose Resize Image.Resize Image
Input Data TypeRequiredFormat of the source image input. Choose Binary Data (from a previous node), Base64 String, or URL.Binary Data
Input Binary FieldConditionalName of the binary property on the incoming n8n item that holds the image. Required when Input Data Type is Binary Data. Defaults to data.data
Base64 Image ContentConditionalBase64-encoded content of the source image. Required when Input Data Type is Base64 String./9j/4AAQSkZJRgAB...
Image URLConditionalPublicly reachable HTTPS URL to the source image. Required when Input Data Type is URL.https://example.com/photo.jpg
Output File NameRequiredFilename for the resized image. Include the extension matching the output format.resize_image_output.jpg
Resize TypeRequiredScaling method. Percentage scales relative to the original size, Specific targets exact pixel dimensions. Your choice decides which fields appear next.Percentage
Resize PercentageConditionalScaling percentage relative to the original. Below 100 reduces, above 100 enlarges. Required when Resize Type is Percentage.50
WidthConditionalTarget width in pixels. Required when Resize Type is Specific.800
HeightConditionalTarget height in pixels. Required when Resize Type is Specific.600
Maintain Aspect RatioOptionalToggle that preserves the original proportions so the image is not stretched. Leave enabled unless you need forced dimensions.true
AsyncOptionalToggle that runs the resize in the background instead of holding the workflow execution open. Useful for large images or long batches.true
Binary Data Output NameOptionalName of the binary property the output item exposes. Defaults to data.data

Bidang Keluaran

Satu kali lari yang sukses akan menghasilkan satu n8n item yang memuat gambar yang telah diubah ukurannya dan laporan dimensinya.

BidangJenisIsi di dalamnya
Binary (data)BinaryThe resized image, under Binary Data Output Name (default data).
fileNameStringGenerated filename, matching Output File Name.
mimeTypeStringMIME type of the output image, for example image/jpeg or image/png.
fileSizeNumberSize of the resized image in bytes.
originalDimensionsStringWidth and height of the source image in pixels, for example 1920x1080.
newDimensionsStringWidth and height after resizing, for example 960x540. Compare it against your target to confirm aspect ratio behaviour.
successBooleanTrue when the resize completed, false on failure. Use it to branch error handling.
messageStringHuman-readable status message, carrying success confirmation or error detail.

Bagaimana Cara Mengatur Pengubahan Ukuran Gambar di n8n?

  1. Menambahkan PDF4me untuk Anda n8n alur kerja dan pilih Ubah Ukuran Gambar tindakan.
  2. Di dalam Kredensial untuk terhubung dengan, pilih milikmu PDF4me kredensial atau klik Buat Kredensial Baru dan tempelkan milik Anda API kunci.
  3. Mengatur Tipe Data Masukan ke Data Biner (bawaan), Base64 String, atau URL dan menyediakan kolom gambar sumber yang sesuai.
  4. Mengatur Jenis Pengubahan Ukuran ke Persentase dan isi Persentase Pengubahan Ukuran, atau untuk Spesifik dan isi Lebar Dan Tinggi.
  5. Meninggalkan Pertahankan Rasio Aspek memungkinkan untuk menghindari peregangan, dan memungkinkan Async untuk gambar berukuran besar atau batch yang panjang.
  6. Mengatur Nama File Output, jalankan node tersebut, dan periksa newDimensions pada output untuk mengkonfirmasi hasilnya.

Pengaturan Umum

Contoh Alur KerjaCommon n8n workflow patterns using Resize Image.
Gambar mini dari unggahan produk
  1. Gambar produk baru telah tersimpan di penyimpanan cloud.
  2. Pengubahan Ukuran Gambar berjalan dalam mode Spesifik pada dimensi kisi thumbnail.
  3. Gambar mini tersebut ditulis ulang di samping gambar asli berukuran penuh.
Kecilkan ukuran unggahan pengguna yang terlalu besar.
  1. Webhook menerima foto yang dikirimkan melalui formulir.
  2. Fungsi Ubah Ukuran Gambar berjalan dalam mode Persentase untuk mengurangi ukurannya secara proporsional.
  3. File yang lebih kecil akan disimpan, sehingga menghemat ruang penyimpanan dan bandwidth.
Normalisasi batch pada pustaka gambar.
  1. Node Loop Over Items mengiterasi folder yang sudah ada berisi gambar dengan ukuran campuran.
  2. Ubah Ukuran Gambar menerapkan satu pengaturan yang konsisten untuk setiap item, dengan Async diaktifkan.
  3. Perpustakaan akhirnya menjadi seragam tanpa ada yang membuka editor.
Ubah ukuran lalu kompres untuk web.
  1. Gambar editorial diambil dari CMS.
  2. Mengubah ukuran gambar akan mengecilkannya hingga selebar layar terlebih dahulu.
  3. Kompres gambar lalu kurangi ukuran file lebih lanjut sebelum dipublikasikan.

Tips Praktis

Resize before you compress, not after
Reducing dimensions first means the compressor has less data to work on, which usually gives a better result than compressing a full-size image.
Leave Maintain Aspect Ratio on by default
Turning it off only makes sense when a target slot genuinely demands non-proportional dimensions. Otherwise it silently stretches faces and logos.
Use Percentage for mixed-size inputs
When sources vary, a fixed pixel target crops or pads inconsistently. A percentage keeps every image in proportion to where it started.
Read newDimensions rather than assuming
The output reports both original and new dimensions, which is the fastest way to confirm aspect ratio handling did what you expected.
Match the Output File Name extension to the format
Naming a PNG output with a .jpg extension confuses downstream nodes and any application that opens the file by extension.
Enable Async for large batches
Long-running batches are exactly where a synchronous call risks timing out, and Async keeps the execution from being held open.

Lembar Panduan Singkat

BidangNilai
ActionResize Image
Input Data TypeBinary Data
Input Binary Fielddata
Output File Nameresize_image_output.jpg
Resize TypePercentage
Resize Percentage50
Width / Height (Specific mode)800 / 600
Maintain Aspect Ratiotrue
Asynctrue
Binary Data Output Namedata

Pertanyaan Umum

Should I resize by percentage or by exact pixel dimensions?+
Use Percentage when the source images vary in size and you want them all reduced or enlarged by the same proportion, for example halving every upload. Use Specific when a target slot demands fixed dimensions, such as a thumbnail grid or a platform that requires an exact width and height.
What happens if I turn off Maintain Aspect Ratio?+
With Maintain Aspect Ratio on, the original proportions are preserved so the image is never stretched. Turning it off lets the width and height you supply be applied independently, which will distort the picture if the target aspect ratio differs from the source. Leave it on unless you specifically need to force non-proportional dimensions.
Does enlarging an image with a percentage above 100 improve its quality?+
No. Scaling above 100 percent increases the pixel dimensions but cannot add detail that was never captured, so an enlarged image will look softer than a natively larger original. Enlarge only when a layout demands the dimensions, and prefer starting from the highest-resolution source you have.
When should I enable Async on the Resize Image node?+
Async Processing runs the resize in the background rather than holding the workflow execution open, which helps with large source images or long batch runs where a synchronous call might otherwise time out.
How do I resize many images in one n8n workflow?+
Feed the images in as multiple items, for example from a folder listing or a Loop Over Items node, and place Resize Image after it. The node runs once per item, so a single configured node handles the whole batch with identical settings rather than needing one node per file.

Tindakan Terkait

Tugas yang Sama di Platform Lain

Dapatkan Bantuan