ComfyUI > Nodes > MTB Nodes > Transform Image (mtb)

ComfyUI Node: Transform Image (mtb)

Class Name

Transform Image (mtb)

Category
mtb/transform
Author
melMass (Account age: 3754days)
Extension
MTB Nodes
Latest Updated
2024-07-02
Github Stars
0.35K

How to Install MTB Nodes

Install this extension via the ComfyUI Manager by searching for MTB Nodes
  • 1. Click the Manager button in the main menu
  • 2. Select Custom Nodes Manager button
  • 3. Enter MTB Nodes in the search bar
After installation, click the Restart button to restart ComfyUI. Then, manually refresh your browser to clear the cache and access the updated list of nodes.

Visit ComfyUI Online for ready-to-use ComfyUI environment

  • Free trial available
  • High-speed GPU machines
  • 200+ preloaded models/nodes
  • Freedom to upload custom models/nodes
  • 50+ ready-to-run workflows
  • 100% private workspace with up to 200GB storage
  • Dedicated Support

Run ComfyUI Online

Transform Image (mtb) Description

Versatile image manipulation node for precise transformations and enhancements, ideal for AI artists.

Transform Image (mtb):

The Transform Image (mtb) node is designed to provide a versatile and powerful way to manipulate images through various transformations. This node allows you to apply translations, rotations, zooms, and shears to an image, making it an essential tool for AI artists looking to enhance or modify their visual content. By leveraging this node, you can achieve precise control over the positioning, scaling, and orientation of your images, which can be particularly useful for creating dynamic compositions or preparing images for further processing. The node also offers options for handling image borders and filling areas created by transformations, ensuring that the final output maintains a high-quality appearance.

Transform Image (mtb) Input Parameters:

image

This parameter expects a tensor representation of the image you wish to transform. The image tensor should be in the format of (frames_count, frame_height, frame_width, frame_channel_count). This input is crucial as it serves as the base image upon which all transformations will be applied.

x

This parameter specifies the horizontal translation of the image in pixels. Positive values move the image to the right, while negative values move it to the left. This allows you to shift the image horizontally within the frame. There is no strict minimum or maximum value, but typical values range from -100 to 100 pixels.

y

This parameter specifies the vertical translation of the image in pixels. Positive values move the image downwards, while negative values move it upwards. This allows you to shift the image vertically within the frame. Similar to the x parameter, typical values range from -100 to 100 pixels.

zoom

This parameter controls the scaling factor of the image. A value greater than 1.0 zooms into the image, making it larger, while a value less than 1.0 zooms out, making it smaller. The zoom parameter allows for precise control over the image size, with typical values ranging from 0.5 to 2.0.

angle

This parameter specifies the rotation angle of the image in degrees. Positive values rotate the image clockwise, while negative values rotate it counterclockwise. This parameter is essential for adjusting the orientation of the image, with typical values ranging from -180 to 180 degrees.

shear

This parameter defines the shear factor of the image, which skews the image along the x and y axes. This can create a slanting effect, adding a dynamic perspective to the image. Typical values for shear range from -30 to 30 degrees.

border_handling

This parameter determines how the borders of the image are handled during transformations. Options include "edge" (default), which extends the edge pixels, and other modes like "constant" where a constant color is used to fill the borders. This ensures that the transformed image maintains a visually appealing border.

constant_color

This parameter specifies the color used to fill areas created by transformations when the border_handling is set to "constant". The color should be provided in a hex format (e.g., "#FFFFFF" for white). This parameter ensures that the filled areas blend seamlessly with the rest of the image.

Transform Image (mtb) Output Parameters:

transformed_image

The output is a tensor representation of the transformed image. This tensor maintains the same format as the input image tensor (frames_count, frame_height, frame_width, frame_channel_count). The transformed image reflects all the applied translations, rotations, zooms, and shears, providing a modified version of the original image ready for further use or processing.

Transform Image (mtb) Usage Tips:

  • To achieve a smooth zoom effect, use incremental zoom values close to 1.0, such as 1.1 or 0.9, to avoid drastic changes in image size.
  • When rotating an image, consider using angles that are multiples of 90 degrees to maintain the image's orientation and avoid excessive cropping.
  • Use the border_handling parameter effectively to manage how the edges of the image are treated, especially when applying large transformations that may expose the image borders.

Transform Image (mtb) Common Errors and Solutions:

"Image tensor is empty"

  • Explanation: This error occurs when the input image tensor has no frames or is improperly formatted.
  • Solution: Ensure that the input image tensor is correctly formatted and contains valid image data before passing it to the node.

"Invalid constant color format"

  • Explanation: This error occurs when the constant_color parameter is not provided in a valid hex format.
  • Solution: Provide the constant_color parameter in a proper hex format, such as "#FFFFFF" for white or "#000000" for black.

"Transformation parameters out of range"

  • Explanation: This error occurs when the transformation parameters (x, y, zoom, angle, shear) are set to values that are too extreme.
  • Solution: Adjust the transformation parameters to more reasonable values within typical ranges to ensure the transformations are applied correctly.

Transform Image (mtb) Related Nodes

Go back to the extension to check out more related nodes.
MTB Nodes
RunComfy

© Copyright 2024 RunComfy. All Rights Reserved.

RunComfy is the premier ComfyUI platform, offering ComfyUI online environment and services, along with ComfyUI workflows featuring stunning visuals.