0

I'm trying to create a stepped gradient with Photoshop from black to white made of vertical bands. I can more or less achieve this by using the posterize feature but the cut between colors is not neat.

This is what I get: enter image description here

Each time the gradient goes from one color to the next one, I get a line of another color. I have posterized the picture with 50 steps which means that I should only have 50 colors but when I check them programmatically I get 344 colors because of those lines.

Is there another way of creating a neat stepped gradient with Photoshop without the blur between the colors? Posterize with only 4 to 10 colors work but beyond that, I get a blur.

Is there another feature from Photoshop I should use?

Thanks

Laurent

7
  • 1
    I'd use a blend in Illustrator for something so specific. - then copy/paste to Photoshop as Smart Object if necessary. – Scott Apr 19 at 7:00
  • 1
    I think you're getting a blur and extra colours because it's a JPG. Try outputting as PNG instead. JPGs use lossy compression, PNGs are lossless. – Billy Kerr Apr 19 at 7:06
  • @BillyKerr I have also tried PNG but it's the same. The blur is clearly visible in Photoshop before saving the image. – Laurent Apr 19 at 7:16
  • 1
    I think it might be the posterize filter. Try converting to Indexed colour mode, set 50 colours, then convert back to RGB, export as PNG. I checked in Image Magick. Definitely 50 colours using this method. – Billy Kerr Apr 19 at 7:25
  • @BillyKerr it works! Thanks! Could you add it as a solution so that I can mark it as solved? – Laurent Apr 19 at 16:43
1

I think the problem is the posterize filter.

Instead, try converting to Indexed colour mode, set 50 colours, then convert back to RGB mode. Then export as PNG.

I tested this method, and checked the output using Image Magick, and it definitely shows only 50 colours.

If you've installed Image Magick the command to check the number of colours is as follows:

magick identify -format %k filename.png
2

A simple way of making sure you only have a certain number of colors in a gradient is to create the gradient in a document that only has as many pixels as you want colors.

So if you for example want 23 colors, you create a document with the dimensions 23 × 1 px.

Then you select the colors you want as foreground and background color and add a linear Gradient Fill.

Afterwards you simply flatten the image and scale the image with Nearest Neighbor interpolation to the wanted size. Multiply the width with an integer to make sure all bands have the same width.

Here I've scaled the example image to 2000% × 16000% to get 20 × 160 px bands:

2
  • 1
    I realize that this question already have an accepted answer, but I just think this method is so basic that it had to be mentioned. – Wolff Apr 19 at 18:10
  • Thanks it was really worth mentionning, it's a nice way to achieve the same result! – Laurent Apr 19 at 20:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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