Pleated output

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?".
Post Reply
dugar
Posts: 2
Joined: 2011-04-07T23:06:25-07:00
Authentication code: 8675308

Pleated output

Post by dugar »

I needed some help regarding image manipulation.

The input image is a simple random printed background ( http://img855.imageshack.us/i/picfabric.jpg/).

The output required is a pleated version of it, one end of which is held closely (http://img9.imageshack.us/i/picfabric2.jpg/).

Can you please guide me how this can be achieved. I tried extracting parts, shearing them and then superimposing all, but gives a very discrete effect.

Is there some way I can do this by literally displacing some co-ordinates considering them as vertices.

Thank you.
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: Pleated output

Post by anthony »

This is very hard. But I can see two techniques.

One is to divide and distort each 'fold' separately and join it back together.

The other way is to use an image map that has been distorted (edited) into the desired shape that maps 'destination pixel color' from 'source pixel location.
http://www.imagemagick.org/Usage/mappin ... rtion_maps

Note a -compose Distort method has been created for this (to complement the -compose Displace method) but it the above examples page has not been re-written to example it properly.

Once you have the colors in the right place it is only a matter of masking the background, and adding lighting effects (highlights, shading, and shadows).


Note once you have the first technique of 'direct distortion of pieces', it can be easily converted into the faster second 'distortion map' technique by applying it to two grayscale images, One for X and one for Y. That can even be converted to a third 'displacement map' technique though I don't think that is necessary for this type of thing.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
dugar
Posts: 2
Joined: 2011-04-07T23:06:25-07:00
Authentication code: 8675308

Re: Pleated output

Post by dugar »

Thank you for your suggestion. I will definitely need to increase my ImageMagick knowledge to accomplish this. I will definitely try
to do it.

Any other way/suggestions to do the above shall be helpful.
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: Pleated output

Post by anthony »

Yes. Generate the distortion at a larger scale. That way sharp folds can be smoothed (anti-aliased) by shrinking the final result.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Pleated output

Post by fmw42 »

You could combine -wave with -distort perspective or -distort BilinearForward

Image

convert picfabric2.jpg -wave 30x92 MIFF:- |\
3Drotate tilt=60 bgcolor=white vp="background" auto=out - picfabric2_folds.jpg

Image
Post Reply