ComfyUI  >  Nodes  >  MTB Nodes >  Sharpen (mtb)

ComfyUI Node: Sharpen (mtb)

Class Name

Sharpen (mtb)

Category
mtb/image processing
Author
melMass (Account age: 3754 days)
Extension
MTB Nodes
Latest Updated
7/2/2024
Github Stars
0.3K

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

Sharpen (mtb) Description

Enhance image clarity and detail with a sharpening filter for AI artists to emphasize edges and fine details.

Sharpen (mtb):

The Sharpen (mtb) node is designed to enhance the clarity and detail of an image by applying a sharpening filter using a Gaussian kernel. This node is particularly useful for AI artists who want to emphasize edges and fine details in their images, making them appear crisper and more defined. The sharpening process involves adjusting the intensity of the pixels based on their surrounding pixels, which helps to highlight transitions and contours within the image. By controlling various parameters, you can fine-tune the sharpening effect to achieve the desired level of detail and contrast, making your images stand out with improved visual sharpness.

Sharpen (mtb) Input Parameters:

image

This parameter represents the input image that you want to sharpen. The image should be provided as a tensor, which is a multi-dimensional array commonly used in deep learning frameworks.

sharpen_radius

This parameter controls the radius of the sharpening kernel. A larger radius will affect a broader area around each pixel, resulting in a more pronounced sharpening effect. The value must be an integer between 1 and 31, with a default value of 1.

sigma_x

This parameter defines the standard deviation of the Gaussian function in the x-direction. It influences the spread of the kernel in the horizontal direction, affecting how the sharpening is applied. The value must be a float between 0.1 and 10.0, with a default value of 1.0.

sigma_y

This parameter defines the standard deviation of the Gaussian function in the y-direction. It influences the spread of the kernel in the vertical direction, affecting how the sharpening is applied. The value must be a float between 0.1 and 10.0, with a default value of 1.0.

alpha

This parameter controls the intensity of the sharpening effect. A higher alpha value will result in a stronger sharpening effect, making edges and details more pronounced. The value must be a float between 0.0 and 5.0, with a default value of 1.0.

Sharpen (mtb) Output Parameters:

IMAGE

The output is the sharpened image, provided as a tensor. This image will have enhanced edges and details, making it appear crisper and more defined compared to the original input image. The sharpening effect is applied based on the specified input parameters, allowing for customizable levels of detail enhancement.

Sharpen (mtb) Usage Tips:

  • To achieve a subtle sharpening effect, use a lower alpha value and a smaller sharpen_radius.
  • For images with fine details that need to be highlighted, increase the sharpen_radius and alpha values.
  • Adjust sigma_x and sigma_y to control the spread of the sharpening effect in different directions, which can help in achieving a more balanced sharpening.

Sharpen (mtb) Common Errors and Solutions:

ValueError: SigmasX must have same length as image, sigmasX is {len(sigmasX)} but the batch size is {image.size(0)}

  • Explanation: This error occurs when the length of the sigmasX array does not match the batch size of the input image.
  • Solution: Ensure that the sigmasX array has the same number of elements as the batch size of the input image.

IndexError: index out of range in self

  • Explanation: This error may occur if the sharpen_radius is set to a value that is too large for the given image dimensions.
  • Solution: Reduce the sharpen_radius value to ensure it is within the acceptable range for the image dimensions.

RuntimeError: Expected 4-dimensional input for 4-dimensional weight [out_channels, in_channels/groups, kH, kW], but got 3-dimensional input of size [batch_size, height, width] instead

  • Explanation: This error occurs when the input image tensor does not have the correct number of dimensions.
  • Solution: Ensure that the input image tensor is in the format [batch_size, height, width, channels] before passing it to the node.

Sharpen (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.