メインコンテンツへスキップ

画像のサイズを変更する n8n

画像のサイズを変更する は PDF4me ノードアクション n8n 画像を元のサイズの割合で拡大縮小するか、ピクセル単位で正確な幅と高さに拡大縮小するかを選択でき、アスペクト比の維持は切り替え可能です。サムネイルの生成、ユーザーアップロード画像のハウスサイズへの正規化、ストレージに保存される前の大きすぎる写真の縮小などに使用できます。

このノードの機能

PDF4me画像サイズ変更 バイナリデータから画像を取得します。 Base64 Stringまたは URL そして、スケーリングされたコピーを返します。 サイズ変更タイプ フィールドによって方法が決まります。 パーセンテージ 元のサイズに比例して拡大縮小するため、様々なサイズの入力に適しています。 特定の 固定レイアウトスロットに対して、ピクセル単位で正確な幅と高さを指定します。このノードは入力アイテムごとに1回実行されるため、1つの設定済みノードでバッチ全体を同じ設定でリサイズできます。

関連ブログ記事
この機能に関するブログ記事はまだありません。近日公開予定です。
その間、PDF4me ブログを閲覧して、あらゆるプラットフォームのチュートリアルやワークフローをご覧ください。
ブログをご覧ください →

認証 API リクエスト​

毎 PDF4me ノード n8n 有効な 接続するための認証情報. 作成または選択して、 PDF4me API ワークフローがサイズ変更リクエストを安全に認証できるようにするためのキー。

見逃してはならない重要な事実​

サイズ変更タイプによって表示されるフィールドが決まります
「パーセンテージ」を選択すると、サイズ変更率が表示されます。「具体的な値」を選択すると、代わりに幅と高さが表示されます。両方のセットを入力することはありません。
アスペクト比を維持することで歪みを防ぎます
意図的に非比例寸法が必要な場合を除き、このトグルをオンにしておいてください。オフにすると、幅と高さが一致しない場合、画像が引き伸ばされます。
拡大しても細部は作り出せない
100%を超える値を設定すると、ピクセルサイズは大きくなりますが、鮮明度は変わりません。常に利用可能な最高解像度のソースから始めてください。
n8n の PDF4me ノードは、アクション「画像のサイズ変更」、入力データタイプ「バイナリデータ」、入力バイナリフィールド「データ」、出力ファイル名「resize_image_output.jpg」、サイズ変更タイプ「パーセンテージ」、サイズ変更率「50」に設定され、「アスペクト比の維持」と「非同期」の切り替えが有効になっています。

PDF4me 画像パラメータパネルのサイズ変更 n8nパーセンテージモードで表示

パーセンテージ指定と数値指定:どちらのサイズ変更方法を使うべきか?​

これら2つのモードはそれぞれ異なる問題を解決するものであり、誤ったモードを選択することが、予期しない出力サイズが発生する最も一般的な原因です。

サイズ変更タイプ入力するフィールド最適なフィット感
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

画像サイズ変更に必要なパラメータは何ですか?​

必須: アクション、入力データタイプ、その入力タイプに一致するフィールド、出力ファイル名、リサイズタイプ、およびリサイズタイプによって明らかになるディメンションフィールド。 Async バイナリデータ出力名には、動作中のデフォルト値が設定されています。

パラメータ必須その機能例
Input Data TypeRequiredChoose how to provide the image file to resize. Options: Binary Data, Base64 String, URL. Default is `Binary Data`.Binary Data
Input Binary FieldConditionalName of the binary property that contains the image file. Shown when Input Data Type is Binary Data. Default is `data`.data
Base64 Image ContentConditionalBase64 encoded image content. Shown when Input Data Type is Base64 String./9j/4AAQSkZJRgAB...
Image URLConditionalURL to the image file to resize. Shown when Input Data Type is URL.https://example.com/photo.jpg
Output File NameOptionalName for the output resized image file. Default is `resize_image_output.jpg`.resize_image_output.jpg
Resize TypeRequiredResize type: by percentage or specific dimensions. Options: Percentage, Specific. Default is `Percentage`.Percentage
Resize PercentageConditionalResize percentage (used if Resize Type is Percentage). Shown when Resize Type is Percentage. Default is `50`.50
WidthConditionalWidth in pixels (used if Resize Type is Specific). Shown when Resize Type is Specific. Default is `800`.800
HeightConditionalHeight in pixels (used if Resize Type is Specific). Shown when Resize Type is Specific. Default is `600`.600
Maintain Aspect RatioOptionalWhether to maintain aspect ratio when resizing. Default is `Yes`.Yes
AsyncOptionalNot used: the node always sends the request to PDF4me as asynchronous (IsAsync true), whatever this is set to. Default is `Yes`.Yes
Binary Data Output NameOptionalCustom name for the binary data in n8n output. Default is `data`.data

出力フィールド​

成功したランは1 n8n サイズ変更された画像とその寸法レポートを含むアイテム。

出力​

ノードが返すフィールド。

分野タイプ内容物
successBooleanTrue when the operation succeeded.
messageStringStatus message, `Image resized successfully`.
fileNameStringFile name of the resulting file.
mimeTypeStringAlways `image/jpeg`, whatever the format of the input image.
fileSizeNumberSize of the resulting file in bytes.
resizeTypeStringResize Type that was used (Percentage or Specific).
dataBinaryThe resized image.

画像サイズ変更の設定方法 n8n?​

  1. 追加 PDF4me あなたの n8n ワークフローを選択し、 画像のサイズを変更する アクション。
  2. で 接続するための認証情報選択してください PDF4me 認証情報またはクリック 新しい認証情報を作成する そしてあなたの API 鍵。
  3. セット 入力データタイプ に バイナリデータ (デフォルト)、 Base64 String、 または URL そして、対応するソース画像フィールドを指定します。
  4. セット サイズ変更タイプ に パーセンテージ 記入する サイズ変更率または 特定の 記入する 幅 そして 身長。
  5. 離れる アスペクト比を維持する ストレッチを回避し、 Async 大きな画像や大量のデータを処理する場合に便利です。
  6. セット 出力ファイル名ノードを実行し、確認します。 newDimensions 出力結果を確認する。

典型的な構成​

ワークフローの例Common n8n workflow patterns using Resize Image.
商品アップロードからのサムネイル
  1. 新製品の画像がクラウドストレージに保存される。
  2. 画像サイズ変更は、サムネイルグリッドの寸法に合わせて特定モードで実行されます。
  3. サムネイル画像は、フルサイズのオリジナル画像の横に書き込まれています。
サイズが大きすぎるユーザーアップロードを縮小する
  1. ウェブフックは、フォームを通じて送信された写真を受け取ります。
  2. 画像サイズ変更はパーセンテージモードで実行され、比例的に縮小されます。
  3. より小さなファイルが保存されるため、ストレージ容量と帯域幅の使用量を抑えることができます。
画像ライブラリを一括正規化する
  1. 「アイテムのループ」ノードは、様々なサイズの画像を含む既存のフォルダを反復処理します。
  2. 画像サイズ変更は、すべてのアイテムに一貫した設定を適用します。 Async 有効になっています。
  3. 誰もエディターを開かなくても、図書館は均一化してしまう。
ウェブ用にサイズ変更してから圧縮します。
  1. 編集用画像はCMSから取得されます。
  2. 画像サイズ変更機能は、まず表示幅に合わせて画像を縮小します。
  3. 画像を圧縮すると、公開前にファイルサイズがさらに縮小されます。

実践的なヒント​

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.

チートシート​

分野価値
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

よくある質問​

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.

関連アクション​

他のプラットフォームでの同じタスク​

ヘルプが必要な場合​