search
HomeWeb Front-endPS TutorialImage deformation algorithm: Implementing the forward deformation tool in the Photoshop Liquify toolbox

Many times, we need to adjust parts of an image, and this adjustment must be smooth and interactive. The Forward Warp tool in Photoshop’s Liquify filter is such a tool and it’s very useful. A similar tool has the face-slimming function of Meitu Xiuxiu. This article describes the principles and algorithms behind such tools.

Let’s take Meitu Xiuxiu as an example to briefly describe the forward transformation function.

First, use the mouse to control a circular selection.

Image deformation algorithm: Implementing the forward deformation tool in the Photoshop Liquify toolbox

Then, click the left mouse button and drag in a certain direction to produce a smooth forward deformation picture:

Image deformation algorithm: Implementing the forward deformation tool in the Photoshop Liquify toolbox

With this tool, you can adjust parts of the picture, and the degree of freedom is relatively large, so it is more practical.

The following explains the principles of this type of algorithm.

Image deformation algorithm: Implementing the forward deformation tool in the Photoshop Liquify toolbox

In the above figure, the shaded ring represents a circular selection with a radius of rmax. Among them, point C is the point when the mouse is clicked, which is the center of the circular selection. Drag the mouse from C to M, causing point U in the image to transform to point X. Therefore, the key issue is to find the inverse transformation of the above transformation - when a point , find the pixel value of U. In this way, each pixel in the circular selection is evaluated to obtain the transformed image.

Andreas Gustafsson's Interactive Image Warping article gives this inverse transformation formula:

Image deformation algorithm: Implementing the forward deformation tool in the Photoshop Liquify toolbox

The characteristics of this deformation algorithm are:

1 Only the image within the circular selection is deformed

2 The closer to the center of the circle, the greater the deformation, the closer to the edge the smaller the deformation, and there is no deformation at the boundary

3 The deformation is smooth

The specific implementation steps are as follows:

1 For each pixel in the circular selection, take out its R, G, and B components and store them in 3 Buffs (rBuff, gBuff, bBuff) (That is, the three Buffs respectively store the values ​​of the R, G, and B channels of the original image in the selection)

2 For each pixel X in the circular selection,

2.1 According to the above formula, calculate the exact position coordinate value U

before its deformation. 2.2 Use the interpolation method to calculate R at the position of U based on the position of U and the values ​​​​in rBuff, gBuff, and bBuff. G, B and other components

2.3 Synthesize R, G, B and other components into new pixels as the pixel value at , it can be easily written based on the above text - to solve this kind of problem, what is important is not the code, but the ideas and algorithms.

The following is my implementation demonstration:

Image deformation algorithm: Implementing the forward deformation tool in the Photoshop Liquify toolboxIn the above picture, the upper left corner is the original image, and the lower right corner is the deformed image. The red circle encircles the deformation area. As you can see, the deformation is very smooth. I introduced the deformation strength s(strength) in the above algorithm, strength=20 in the above picture.

Introducing strength, the formula must be modified. Here is my modified version of the formula:

Image deformation algorithm: Implementing the forward deformation tool in the Photoshop Liquify toolboxLook at the result——

Original Picture:

Image deformation algorithm: Implementing the forward deformation tool in the Photoshop Liquify toolboxDeformation, strength=20:

Transformation, strength=120:

Image deformation algorithm: Implementing the forward deformation tool in the Photoshop Liquify toolbox

This function in photoshop and Meituxiu Xiu can continuously transform. I guess that this continuous deformation is connected in series by a series of basic deformations. That is, dragging the mouse from M0 to Mn position does not only calculate the M0->Mn transformation, but introduces a series of intermediate ones on the mouse trajectory. Point, M1, M2...Mn-1, and then perform a series of transformations on the image, such as M0->M1, M1->M2,..., Mn-1->Mn.

For more image deformation algorithms: Implementing the forward deformation tool in the Photoshop liquefaction toolbox, please pay attention to the PHP Chinese website for related articles!


Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Image Editing Essentials: Key Features of PhotoshopImage Editing Essentials: Key Features of PhotoshopMay 09, 2025 am 12:05 AM

Photoshop's core features include layers, selection tools, and adjustment tools. 1. The layer allows independent editing of image parts and supports layer style. 2. Selection tools such as lasso, magic wand and quick selection tools provide precise editing. 3. Adjustment tools such as color level, curve and hue/saturation can adjust images non-destructively.

My Purpose: Assisting with Photoshop-Related TasksMy Purpose: Assisting with Photoshop-Related TasksMay 08, 2025 am 12:18 AM

In Photoshop, the role of layer masks is to allow hidden or displayed portions of layers in a non-destructive manner. 1. The working principle of layer mask is to control the visibility of the layer through black, white and grayscale. 2. The basic usage includes image synthesis, such as synthesising the character image into a new background. 3. Advanced usage can be achieved by using gradient masks to achieve smooth image transition.

Photoshop and Free Alternatives: A Comparative LookPhotoshop and Free Alternatives: A Comparative LookMay 06, 2025 am 12:12 AM

Photoshop's powerful features include smart objects and neural filters, while free alternatives such as GIMP, Krita and Photopea do well in specific fields such as GIMP's layer functionality, Krita's digital paintings and online editing of Photopea.

Photoshop Color Grading: Elevate Your Images with Pro TechniquesPhotoshop Color Grading: Elevate Your Images with Pro TechniquesMay 05, 2025 am 12:07 AM

Color adjustment in Photoshop can be achieved through adjustment layers to make the image more professional. 1. Use color level, curve, hue/saturation and other tools to adjust the hue, saturation and brightness. 2. Apply LUT to create unique color effects. 3. Use adjustment layers to avoid image distortion and use the History panel to track adjustment steps.

Photoshop in the Real World: Examples of Its Diverse UsesPhotoshop in the Real World: Examples of Its Diverse UsesMay 04, 2025 am 12:15 AM

Photoshop's applications in the real world include artistic creation, scientific research and commercial marketing. 1) In artistic creation, it is used for digital painting and illustration. 2) In scientific research, it is used for image processing and data visualization. 3) In commercial marketing, it is used for advertising design and brand image shaping. The versatility of this software makes it widely used in various fields.

Beyond Editing: Photoshop's Creative CapabilitiesBeyond Editing: Photoshop's Creative CapabilitiesMay 03, 2025 am 12:12 AM

Adobe Photoshop goes beyond simple editing and becomes a creative tool for artists and designers. 1) It provides a wealth of tools such as brushes, stamp tools, blend modes and layer styles, supporting adjustments from basic images to complex digital paintings and 3D designs. 2) These tools implement functions through pixel-level operations, allowing users to create unique visual effects.

Photoshop: Exploring Pricing Models and OptionsPhotoshop: Exploring Pricing Models and OptionsMay 02, 2025 am 12:12 AM

Photoshop offers two pricing models: single purchase and subscription service. 1. Single purchase: Pay $699 in one lump sum, permanent use, but no updates and cloud services. 2. Subscription service: $20.99 per month or $239.88 per year, and the latest version and cloud services are available. 3. Enterprise plan: $33.99 per user per month, including team management and additional cloud storage. 4. Educational Offer: Students and teachers are $19.99 per month, including multiple CreativeCloud applications.

Photoshop: Mastering Layers and CompositionPhotoshop: Mastering Layers and CompositionMay 01, 2025 am 12:05 AM

The method to create a new layer in Photoshop is: 1. Click the "New Layer" button at the bottom of the layer panel; 2. Use the shortcut keys Ctrl Shift N (Windows) or Command Shift N (Mac). The layers are like transparent sheets on canvas, allowing design elements to be managed separately, non-destructive editing and experimenting, and improving design levels.

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

SecLists

SecLists

SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.

DVWA

DVWA

Damn Vulnerable Web App (DVWA) is a PHP/MySQL web application that is very vulnerable. Its main goals are to be an aid for security professionals to test their skills and tools in a legal environment, to help web developers better understand the process of securing web applications, and to help teachers/students teach/learn in a classroom environment Web application security. The goal of DVWA is to practice some of the most common web vulnerabilities through a simple and straightforward interface, with varying degrees of difficulty. Please note that this software

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

SublimeText3 English version

SublimeText3 English version

Recommended: Win version, supports code prompts!

SublimeText3 Linux new version

SublimeText3 Linux new version

SublimeText3 Linux latest version