Skip navigation
Currently Being Moderated


Feb 8, 2013 5:50 AM

Does anyone know if there's an Illustrator equivalent to Photoshop’s Displacement Map?


I need to be able to horizontally displace an area of vertical stripes using a specific greyscale displacement map.

It’s fairly simple in Photoshop but I would much prefer vector output.


O.k., I could do it in Photoshop and then vectorize the result with Live Trace, but is there a less roundabout method?

  • Currently Being Moderated
    Feb 9, 2013 3:00 AM   in reply to Steve Fairbairn

    I don't think it's possible in AI, Steve. The only thing that even remotely comes close would be an envelope mesh, but that would take careful manual manipulation. I don't think there's anything automated anywhere.

    Mark as:
  • Currently Being Moderated
    Feb 9, 2013 4:05 AM   in reply to Steve Fairbairn



    My excuse for being as silly as follows is the return of something white.


    For such a moderate displacement as the one shown, I might consider this:


    1) A series of straight stroked (grey) paths (ungrouped expanded effect or something),

    2) Changing the shape of key path(s) to follow (the local part of) the displacement map (maybe reshape (at one/a few position(s) maybe with adjustment of handles) + dragging out handles at top and bottom, with fewest possible Anchor Points),

    3) Deleting intermediate paths (to be replaced by displaced ones),

    4) Creating blend(s) between key path(s) and undisplaced ones and possibly adjusting by adjusting key paths (maybe with repeated reshaping at same or new Anchor Points and/or adjusting handles),

    5) Expanding blends.

    Mark as:
  • Currently Being Moderated
    Feb 9, 2013 10:34 AM   in reply to Steve Fairbairn

    Just maybe it can be scripted...


    What sort of greyscale displacement map would you use? In what direction should lines be displaced -- only horizontally, as in your example image? How much per unit of gray?


    Is your input all straight lines, with just two anchors, and would the script thus need to divide it into segments of an appropriate length, or are they already divided up? Would you want straight line segments only, or curved ones?

    Mark as:
  • Currently Being Moderated
    Feb 9, 2013 12:51 PM   in reply to Steve Fairbairn





    Sigur Ros   A chance has come up to possibly attend a concert by them (sorry for the lack of proper accents). Do they do a good show? They will be touring the US in coming months and friends who are visiting us from London in April suggested this.

    Mark as:
  • Currently Being Moderated
    Feb 9, 2013 1:45 PM   in reply to Steve Fairbairn

    Thanks, Steve. Only saw the Stones once live in 1972 with Stevie Wonder as the opening act.

    Mark as:
  • Currently Being Moderated
    Feb 10, 2013 3:50 PM   in reply to Steve Fairbairn

    Just as I initially thought: it is possible using scripting -- and in particular, using Scriptographer, as this extends Illustrator's fairly poor scripting abilities up to handling bitmap graphics with grace.


    See this image: left is a bitmap copied straight out of Photoshop, right is a grid of lines using the image as displacement map.


    Unfortunately, my lack of Illustrator scripting skills betray me (again!), and I cannot get a good grip on how to adjust existing artwork along the lines of the same map. So far, I got this code:


    /* Poor Man's Displacement Map */
    /* A Jongware Script 10-Feb-2013 */
    var rasters = document.getItems({
        type: Raster,
        selected: true
    var image = null;
    if (rasters.length < 1)
              url = Dialog.fileOpen ('Select a displacement map', '*.png', new File("~/Desktop"));
              if (url != null)
                        image = new PlacedFile(url);
                        image = image.embed();
    } else
              image = rasters[0];
    sampleWidth = 200;
    for (x=0; x<sampleWidth; x++)
              xsample = x*image.width/sampleWidth;
              // Add a vertical line
              var myPath = new Path();
              myPath.add(new Point(x, 0));
              myPath.add(new Point(x, 100));
              myPath.strokeColor = new RGBColor(0,0,0);
              seg = 1;
              for (y=1; y<100; y++)
                        // image coordinates are reverse of Illustrator's
                        // hence the 100-y
                        ysample = (100-y)*image.height/100;
                        value = 1-image.getPixel(xsample, ysample).gray;
                        myPath.insert(seg, new Point(x-8*value, y));


    .. feel free to post it on the Scripting forum; perhaps someone else can leverage it up to something you can use.


    This is not regular Javascript! It uses Jürg Lehni's (and others) Scriptographer plugin for Illustrator CS4. Unfortunately, Jürg discontinued working on Scriptographer for CS6; see the web site for his argumentation. (It's a pity Adobe doesn't want to discuss integrating Sg into Illustrator, as its capabilities vastly surpass their own script integration, as this my short script shows.)


    Signing off for now with a displaced signature:

    Screen Shot 2013-02-11 at 12.45.52 AM.png

    Mark as:
  • Currently Being Moderated
    Feb 13, 2013 11:47 AM   in reply to [Jongware]

    Just a confirmation, Jongware: Your script does work inside the Scriptographer environment. Admittedly with some astonishing results.


    Perhaps Steve has some suggestions for improvement ?

    Mark as:
  • Currently Being Moderated
    Feb 13, 2013 12:25 PM   in reply to Kurt Gold

    Kurt, I have some ideas on how to continue towards Steve's ultimate goal. It should be possible to put an image behind native artwork, have the script find intersections of this artwork with the image, then add and displace single vertexes according to the gray scale values.


    As things go, my time is limited, my resources scant, and Illy is really a troubling beast to script -- even with the added leverage of Sg.

    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points