Page 2 of 2

Re: How to Manipulate Patterns with Imagemagick Distort

Posted: 2017-12-27T19:14:36-07:00
by fmw42
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.

Re: How to Manipulate Patterns with Imagemagick Distort

Posted: 2018-01-03T17:38:03-07:00
by fmw42
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.

Re: How to Manipulate Patterns with Imagemagick Distort

Posted: 2018-01-05T01:11:08-07:00
by dandan8888
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。

Re: How to Manipulate Patterns with Imagemagick Distort

Posted: 2018-01-05T02:22:41-07:00
by snibgo
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.

Re: How to Manipulate Patterns with Imagemagick Distort

Posted: 2018-01-05T06:31:47-07:00
by dandan8888
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.

Re: How to Manipulate Patterns with Imagemagick Distort

Posted: 2018-01-05T07:03:21-07:00
by snibgo
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.

Re: How to Manipulate Patterns with Imagemagick Distort

Posted: 2018-01-05T08:02:16-07:00
by dandan8888
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

Re: How to Manipulate Patterns with Imagemagick Distort

Posted: 2018-01-06T02:20:07-07:00
by dandan8888

Re: How to Manipulate Patterns with Imagemagick Distort

Posted: 2018-01-06T10:27:55-07:00
by fmw42
Is that a question or a statement? No, ImageMagick is a 2D image system and not a 3D texture mapping system.

Re: How to Manipulate Patterns with Imagemagick Distort

Posted: 2018-10-18T09:11:34-07:00
by MrLimon15
fmw42 wrote: ↑2017-12-21T01:49:01-07:00 The basic idea is as follows (unix syntax)

1) extract or make a mask (here I make it from your image, since the coat image did not have transparent background)
2) convert the coat image to grayscale, apply the mask into the alpha channel and then get the average gray level of the opaque pixels
3) compute the amount needed to add or subtract so that the average grayscale is 50% and increased the contrast. This is needed for the hard light composite
4) shrink your texture image and tile it out to the size of the coat image
5) combine the modified grayscale coat image with the tiled texture image and mask using -compose hard light to bring out the detail from the coat image
Is it possible to do this/translate this unix syntax to PHP Imagick API syntax? I've been following this guide for a couple of days: https://www.imagemagick.org/discourse-s ... 0&start=15

But I'm struggling with the creation of the Displacement Map with php. I have ImageMagick version 7.0.7
Thanks!

Re: How to Manipulate Patterns with Imagemagick Distort

Posted: 2018-10-18T11:07:55-07:00
by fmw42
Sorry, I do not know PHP Imagick. But you can run my script, outfit, using PHP exec(), if that helps.