Suppose you want to stretch or squish an image. You could simply used the free transform tool and size the image however you would like.
Now suppose you want to stretch the same image but you want to do it in such a way that the left side of the image is anchored and the right side is moveable and the stretch occurs in a "gradient" from right to left such that the right side has the most stretch and decreases stretch as you travel from right to left so that the left side has no stretch at all.
I have made a very simple jpg to illustrate the point. The upper lines represent the original picture and the lower lines represent the stretched picture (of course the lines would also increase in thickness from left to right). Now in this instance I could have selected each line and transformed it but what I'm looking for is the ability to do this smoothly across the whole image.
This would have many very useful applications including simulating an image wrapping around a cylinder.
Maybe there's an easy answer but I haven't been able to find it.
i can think of two possibilities here. one, use the liquify tool (if you're using PS) or the warp mesh (if you're using psp). and two, make a custom displacement map and use the displacement map tool (PS and PSP).
Regarding liquify: I use it a lot when I'm trying to deform text over a surface that recedes or curves away from the viewing plane, i.e. a logo on a football or basketball Use a large brush, large enough to cover the areas being deformed, a high Brush Density setting and a low Brush Pressure. The high density will minimize the natural tendency of the brush effect to be stronger in the middle, with the edges dragging along behind. Low pressure allows you to start with a small stroke at the edge and repeat, each time extending the sweep of the brush.
Another possibility: if you're actually trying for a perspective effect, and have CS2, pasting your gradient into a grid using the perspective tool would accomplish the task effortlessly. If you don't want the vanishing point, you still might be able to stretch the sides back out, depending on the type of image.
Thanks for the tips. That's about as close as I've come myself. I was just hoping there was some more precise way of doing this type of transform. I think it would be useful for quite a few situations.
I tried with the displace filter. This meant a lot of tries because there is no visual feedback with this filter. I can now say that other ways like spherize, transform or liquify would be easier.
Basically I used the foreground-to-background gradient from 50% grey to black as the displacement map. I filled the rest of the map with 50% grey (for no displacement). This gives a full tube effect rather than the half tube you requested, but I figure that's even better if you want to wrap around a cylinder anyway.
I applied the map with displacement 350 horizontal and 0 vertical. That's where working blind was a pain. I had to try many values until I found 350. Note that this would change if the image size changed.
In the attachment, I show the displace map I built below. The result is on top.
The glass filter is similar to displace and gives visual feedback, but it does not seem to segregate horizontal and vertical displacements to separate channels (red and green) like displace; it seems to work only with the red channel to displace both directions at once.
So in the end, I would recommend something else if you want a non-linear transform.
To get a half-tube effect with a displacement map, using a foreground-to-background gradient of 50% grey to 25% grey doesn't work. It only gets you a full-tube effect half the size of the 50% to 0% gradient.
What you have to do is stretch the 50% to 0% gradient to twice the size of the selection. I've attached an example.
I had to fiddle with the horizontal displacement number again. I thought that since 350 worked for the full tube, 700 would work for the half-tube. The number I had to use was 585 .
Last edited by Panpan; 10-24-2005 at 05:06 AM.
Thanks for the attempts Pierre. You got a lot farther than I did. I was wondering why there were multiple lines in your results and how that would translate to an actual photograph. In any event it's an innovative and impressive solution.
It's disappointing that Photoshop wouldn't come with a more straightforward filter for this sort of application. It seems like the type of situation people would fall into pretty frequently.
Stroker, looks like it's all in the displacement maps! Thanks for the links. I'll have to check them out at length when I have more time.
Stroker writes some great stuff but he really Jumps in at the deep end. I tried reading his links but it just went way over my head.
This link is far more novice friendly and gives enough information to get this job done.
I really want to learn about this filter as it is going to be useful with my next little project (Brush Strokes)
Here is a little summary of what I think I have learned so far. From Goldenmean, Worth and Stroker. I hope someone will correct me if I’m wrong.
A D-Map is a PSD file which will manipulate the pixels in another file.
Black moves pixels to the right and/or down. White moved pixels left and/or up
Mid gray in the D-Map produces no movement.
Channel one (Red) produces horizontal movement
Channel Two (Green) produces Vertical movement
The blue channel has no effect.
Goose wants to make a gradient going from no shift at the left to maximum shift at the right. Therefore you will need to construct a D-Map going from mid grey to black
You will only need channel one (Red) as you do not need to change the height.
I tried using your example but it was confusing because there is no reference. So I used a ruler (Courtesy of Stock Exchange)
If you want to play along please download 296245_8226.jpg (Attached)
Open 296245_8226.jpg. Click the channels. Fill the Blue and Green channels with 50% grey as they are not needed.
Fill the red channel with the gradient. Grey at the left and black at the right.
This should give you an image like in my attachment. (converted to jpg)
Save this as 296245_8226DM.PSD. (must be a PSD)
We now have our D-Map.
What we need to do now is enlarge our canvas to make room for the enlarged image so that it won’t get clipped.
Copy it to a new layer. Now go back to the bottom (background layer) and enlarge the canvas size.
Set the background colour to mid grey
Image > Canvas Size
Make the new canvas size 11 Inches Wide which will give plenty of room.
Anchor the picture at the left as we are expanding to the right.
You should have something similar to my attachment.
We are now ready to apply the D-Map.
Select (click) the top layer
Filter > Distort > Displace.
This brings up a box and the settings are important.
Horizontal Scale (this will control the effect we want) Set it to 300
Vertical Scale. Set to 0
Stretch to Fit Checked
Repeat Edge Pixels Checked
Click OK and navigate to 296245_8226DM.PSD
And there you Go!
You should now have something similar to my last attachment
A Gradually stretched Image.
I hope this helps. I have certainly learnt a lot from this.
Any questions. Just ask and I’ll learn some more
Stroker where is that rock? This is really simple stuff to you but to a novice (me) it’s heavy going to start with.
Last edited by Cameraken; 10-26-2005 at 08:29 PM.
|Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)|
|Thread||Thread Starter||Forum||Replies||Last Post|
|Gradient Map Corrections||snapshot||Hidden Power Support||2||09-22-2007 06:29 PM|
|Gradient tool generates stripes||stefan kanya||Input/Output/Workflow||4||08-05-2006 01:24 AM|
|Replacing the Sky -- Using a Radial Gradient||gmitchel||Photo Restoration||0||10-16-2004 08:38 PM|
|Smoothing Large Blotches||kthurner||Image Help||15||01-14-2003 12:02 PM|
|Gradient Layer Mask||Doug Nelson||Photo Compositing||0||05-20-2002 12:28 AM|