I have an image, and each pixel is unique color. What I want to do is warp the image as if it were a cloth on a flat surface (no crumples/folds) and the cursor is my hand. I want to be able to pinch a point on the cloth and move it. This makes it do that I don't stretch/contract any part of the image, just create folds/crumples. In the end, what I am looking for is the output having all unique pixels. Some will be lost because of folds on top of other parts of the image. And some parts (on the sides) will be transparent because some portion got folded moving the side away from edge.

Is there any software that can do this?

  • I really do not understand your question. I do not understand what is that unique pixels things, two pixels with the same hex color, etc. We do not know the file size, how may colors you have... Post your source image for example.
    – Rafael
    Aug 2, 2015 at 17:11
  • 1
    I'm not clear what this is asking but you might want to look into Processing or OpenFrameworks. It sounds like this might be something to use a base but really not sure: openprocessing.org/sketch/20140
    – Ryan
    Aug 3, 2015 at 13:21
  • 1
    Do you have an example image of what you want to achieve? That would help wonders getting a good answer. Thanks!
    – Vincent
    Aug 3, 2015 at 13:25
  • That is not how real fabric works. In real life, cloth does stretch, otherwise it would remain rigid like metal or wood. Therefore, the same "pixel" of cloth would necessarily stretch to occupy more than one pixel's worth of space at the trailing region behind the point of distortion. Secondly, I'm having a hard time imagining a scenario wherein this kind of effect will be possible AND one will be able to tell each pixel is a unique color. I'm really curious to know why the pixels must be unique if the effect is really what you're after. At any rate, good luck with your project.
    – 13ruce
    Oct 21, 2015 at 11:52

3 Answers 3


If you really want it to look and behave like a folded cloth, maybe you should look into 3D software like Blender or 3DMax.

  • 1
    Yes in fact 3d texturing works on this principle.
    – joojaa
    Oct 21, 2015 at 13:29

Seems to me, that you want it to work more like paper folding than cloth. Cloth actually stretches, paper far less so*. This means you might be interested in origami or 3D texturing. Basically this is how UV texturing works.

enter image description here

Image 1: a quick test of folding**. Note that due to the limited palette of a GIF its not unique color. But it is unique in a full 16 bit palette.

Your requirement that every pixel is different can mean many things. For this to hold true, would mean:

  • no antialiasation
  • and/or interpolation may happen.

Fine no problem for antialiasation but interpolation is already a bit painful. If you are pedantic about this then it means that all we can do is move pixels in a group. This makes all standard approaches problematic. You would need to ensure quite many things. Certainly 3D apps can be tweaked to accomodate this. Especially if your not obsessed by the colors themselves, and permit the program to make new colors within this range just as long as no duplicate exsist.

In any case you would probably get a better answer if you could provide some info on why your restrictions are what they are.

* Note im a mechanical engineer as far as i am concerned, everything stretches. Even high grade steel.

** The start is a bit off because I only had 10 minutes time to spare


From how I understand your question, the Puppet Warp Tool should give you the control to to create the effect that you're looking for. Here's a howto and another one.

  • I've seen it but its not what I want. I don't want the result to have any two pixels that have the same hex color. The warp tool stretches/contracts parts of the image and fills it with same color pixels causing duplicates.
    – omega
    Aug 2, 2015 at 17:05
  • It's like folding a cloth in real life, it doesn't stretch/contract, it just moving the same parts around.
    – omega
    Aug 2, 2015 at 17:06
  • that's kind of what the smudge tool does.. Aug 2, 2015 at 17:07
  • That causes blurs and guarantees duplicate color pixels
    – omega
    Aug 2, 2015 at 17:08
  • I want the result to maintain "every" pixel being a unique hex color...
    – omega
    Aug 2, 2015 at 17:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.