PDF4me icon

PDF4me

Comprehensive PDF and document processing: generate barcodes, convert files, extract data, manipulate images, and automate workflows with the PDF4ME API

Actions80

Overview

This node operation "Rotate Image" allows users to rotate an image file by a specified angle. It supports multiple input methods for the image, including binary data from a previous node, a base64 encoded string, or a direct URL to the image. The node processes the image rotation with options to maintain aspect ratio and set a background color for the rotated image. This is useful in workflows where images need to be programmatically adjusted for orientation, such as preparing photos for display, correcting scanned documents, or automating image preprocessing before further analysis.

Practical examples:

  • Rotating a photo uploaded via a form to correct its orientation.
  • Automatically rotating images fetched from URLs before saving or processing.
  • Adjusting scanned document images to the correct angle before OCR or archival.

Properties

Name Meaning
Input Data Type Choose how to provide the image file to rotate: Binary Data (from previous node), Base64 String, or URL.
Input Binary Field Name of the binary property containing the image file (used if Input Data Type is Binary Data).
Base64 Image Content Base64 encoded string of the image content (used if Input Data Type is Base64 String).
Image URL URL pointing to the image file to rotate (used if Input Data Type is URL).
Output File Name Desired filename for the output rotated image file.
Background Color Hex color code used as the background color during rotation (e.g., "#FFFFFF" for white).
Proportionate Resize Boolean flag to maintain the image proportions during rotation.
Rotation Angle Numeric value specifying the rotation angle in degrees (e.g., 90, 180, 270).
Async Boolean flag to enable asynchronous processing of the rotation operation.
Binary Data Output Name Custom name for the binary data field in the node's output.

Output

The node outputs the rotated image as binary data under a customizable binary property name (default is "data"). The output includes the rotated image file with the specified output filename. The JSON output contains metadata about the processed image, while the binary output holds the actual image content ready for downstream nodes or export.

If the input was binary data or base64, the output will be the rotated image in binary format. If the input was a URL, the node fetches the image, rotates it, and outputs the rotated image similarly.

Dependencies

  • Requires access to the image source depending on the input type (binary data from previous node, base64 string, or external URL).
  • No explicit external API keys or services are required based on the provided code.
  • The node relies on internal image processing libraries bundled within the node's implementation (not detailed here).

Troubleshooting

  • Common issues:
    • Invalid or inaccessible image URL may cause failures fetching the image.
    • Incorrect base64 string format can lead to decoding errors.
    • Specifying a non-existent binary property name when using binary data input will result in missing image data.
    • Unsupported image formats might not be processed correctly.
  • Error messages:
    • Errors related to image loading or decoding typically indicate problems with the input data.
    • Rotation angle values outside expected ranges might cause unexpected results; ensure angles are valid degrees.
  • Resolutions:
    • Verify URLs are reachable and point directly to image files.
    • Confirm base64 strings are properly encoded without extra characters.
    • Double-check binary property names match those from previous nodes.
    • Use supported image formats like PNG, JPEG, etc.

Links and References

Discussion