How to Manipulate Patterns with Imagemagick Distort

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
User avatar
fmw42
Posts: 22485
Joined: 2007-07-02T17:14:51-07:00
Location: Sunnyvale, California, USA

Re: How to Manipulate Patterns with Imagemagick Distort

Post by fmw42 » 2017-12-27T19:14:36-07:00

That link is the best I know.

You can make a mask for each part where it bends and rotate the texture. Then put the texture onto that part and composite all the parts together again.

User avatar
fmw42
Posts: 22485
Joined: 2007-07-02T17:14:51-07:00
Location: Sunnyvale, California, USA

Re: How to Manipulate Patterns with Imagemagick Distort

Post by fmw42 » 2018-01-03T17:38:03-07:00

I have created a script, outfit, to warp texture onto an image of some clothing or garment or outfit. See my link below.

Note that it only applies one pattern to one full garment/outfit. If there are multiple parts to the outfit that need different orientations of the texture pattern or different texture patterns, then the script will need to be run multiple times for each part and the results composited together.

I will work on a script that will take the exported information from outfit and inport it to a script that will not need to re-create the displacement or lighting image. That way the latter can be run subsequently and faster for any other texture that needs to be placed on the same garment/outfit.

dandan8888
Posts: 11
Joined: 2017-12-21T00:05:01-07:00
Authentication code: 1152

Re: How to Manipulate Patterns with Imagemagick Distort

Post by dandan8888 » 2018-01-05T01:11:08-07:00

Thank you very much, this can be achieved for most fabric replacements that do not require partial bending. I've compared some of the fabric replacement systems that can be used for partial bending and 3D simulation (most of the fabric design CAD / CAM) [3Dmap http://datacomm.info/?page_id=15356, 3D design https://www.textronic.com/design-3D.html], but most do not command synthetic scripts. Perhaps in the 3D map mode synthesis, such as the 2D model maps into 3D files, they will be part of the local application layer of a network of free-drag distorted points, and then applied to the layer. My initial idea was to do this part of the need for a visual tool to control these can be distorted points. And then save the information and import into the IM script, the script image synthesis.I want to achieve an im program, try to be the best results。

snibgo
Posts: 9619
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: How to Manipulate Patterns with Imagemagick Distort

Post by snibgo » 2018-01-05T02:22:41-07:00

The methods we generally use in IM simulate the effect of 3D by stretching and shrinking the image. When we wear a loose but rumpled garment such as a tee-shirt, there is apparent shrinkage (due to perspective) but not stretching. When the rumpling is such that parts of the cloth are obscured, an IM script won't spot this and won't create the required discontinuities.

However, the simulation is good enough for many purposes, especially if the distorted image doesn't have an obvious grid pattern.

If we need accurate photo-realism, we can build 3D models. When they are built, we can quickly wrap images around them. The tricky part is building the models. Doing that automatically from a number of photos taken at the same time is possible. Otherwise, it's a manual job.
snibgo's IM pages: im.snibgo.com

dandan8888
Posts: 11
Joined: 2017-12-21T00:05:01-07:00
Authentication code: 1152

Re: How to Manipulate Patterns with Imagemagick Distort

Post by dandan8888 » 2018-01-05T06:31:47-07:00

Yes, I now the main problem is the plaid fabric of the map, arm, skirt in this place, the real clothes must be bent down. This is easy to see flaws. My other problem is. Export documents through the 3d software can be wrapped with im it. The best way to order the script. Thank you for your answer.

snibgo
Posts: 9619
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: How to Manipulate Patterns with Imagemagick Distort

Post by snibgo » 2018-01-05T07:03:21-07:00

I'm not sure what you are asking. Do you use 3D modelling software to create a 3D model of the garment? If so, then that software will have a method to "paint" an image on a garment, so it can be rendered with the correct folds and shadows.

If you have users who can upload images to be painted on garments, that method will work, but needs 3D-processing for each image. An alternative needs more work upfront, but just a simple ImageMagick 2D command per user image.

The method is to paint an identity absolute displacement map on the garment and to render that with only diffuse (ambient) light, so the rendering doesn't change the colours. You also need a rendering of a white garment in ordinary light, and one of specular reflections (if any), and a mask. Then, after a user uploads an image, IM can distort the image according to the displaced map, and combine it with the other renderings.
snibgo's IM pages: im.snibgo.com

dandan8888
Posts: 11
Joined: 2017-12-21T00:05:01-07:00
Authentication code: 1152

Re: How to Manipulate Patterns with Imagemagick Distort

Post by dandan8888 » 2018-01-05T08:02:16-07:00

I'm inclined to say what you are saying, but I looked at the shirt's approach before the forum (using a diamond-shaped mapping to produce a bend). It's not easy to feel partial bending. Not like a visual tool to drag a good positioning of the fabric stripes and elbows bent together. This figure1 is more realistic dress show. For example, I have another model similar to the one below. I have a little bit to try this curved angle. For example, body shape caused by the fabric lines bent. Similar to the first figure model shoulder wider. Waist narrow. On the other hand, I just got in touch with IM, and it may be relatively difficult for me to distort the details of a particular model. Thank you

figure1
Image

figure2
Image

dandan8888
Posts: 11
Joined: 2017-12-21T00:05:01-07:00
Authentication code: 1152

Re: How to Manipulate Patterns with Imagemagick Distort

Post by dandan8888 » 2018-01-06T02:20:07-07:00


User avatar
fmw42
Posts: 22485
Joined: 2007-07-02T17:14:51-07:00
Location: Sunnyvale, California, USA

Re: How to Manipulate Patterns with Imagemagick Distort

Post by fmw42 » 2018-01-06T10:27:55-07:00

Is that a question or a statement? No, ImageMagick is a 2D image system and not a 3D texture mapping system.

Post Reply