Home Technical Talk

Image to gradient in Photoshop

People of the internet,

I find myself looking for a way to turn an image into a gradient, for the purposes of gradient mapping onto a texture. Is this possible at all, and if so: using standard photoshop tools, or is there a script that can help me?

The obvious problem I see is that several pixels with the same luminosity can have different hue/saturation values applied to them, but I'm hoping there would be the option of averaging the values or taking the one most encountered.

I know about 'apply image' by the way, and while that's nice, the idea is to get a reusable gradient that I can easily tweak.

Additionally, when working with gradients/gradient maps, is there a way to have a newly inserted point just fit into the gradient? Like if it's just a black to white gradient and I click at the halfway point, it will be 50% grey?

Replies

  • Farfarer
    I'm not entirely certain I get you. You're after something that'll rearrange all the colours in the image into some sort of gradient?
  • Froyok
    Offline / Send Message
    Froyok greentooth
    Use kuler to get the most important colors (you can load an image for this) and then make a manual gradient ?

    https://kuler.adobe.com/
  • Michael Knubben
    I'd be using them for a gradient map, so to remap colours, depending on their luminosity values. I'm hoping to find a way to quickly make a rudimentary gradient from an image, for example: a texture has deep purple shadows, brown mids and blue highlights, it will turn this into a gradient preset that goes from purple to brown to blue.

    edit: Ah, Froyok posted while I was typing. That seems like more work than just manually picking the colours in photoshop. The problem with this manual approach is that it's a pain in the ass to place the colours correctly so that if you'd apply the obtained gradient as a gradient map to the same image, it will look mostly the same.
  • pior
    Offline / Send Message
    pior grand marshal polycounter
    Image - Mode - Indexed Color (type in your desired number of palette colors)
    and then
    Image - Mode - Color Table to edit, load and save palettes.

    That's the closest I can think of! Of course if you are starting from a photograph or an heavily rendered painting it won't work too well. But with a design with simple coloring (something like a logo or an anime-type image) it will work surprisingly well with as little as a dozen palleted colors.
  • Sage
    Offline / Send Message
    Sage polycounter lvl 19
    hmm you can try to pick a section of the image like a one pixel strip then scale that horizontally... that will produce a gradient, but it might not be what you want at all.
  • Michael Knubben
    Pior: huh, interesting approach as well, but like the Apply Image thing (which is cool as well, give it a go if you don't know it. It's in the Image menu) it's not as flexible as what I'd want.

    The thing is, I can do this manually, but it's hard to get right, and I'm just looking to save time on doing so.

    Which is why I'm glad to have Farfarer's technical eye on this! Is what I'm asking possible with a script at all, or am I just shit out of luck?

    edit: made a quick image that hopefully explains things better:
    gradientmaptool.jpg
    Imagine the sphere is my image, and I've got a grayscale sphere I want to apply those colours to. The bottom gradient is what I'd want to get, and the reason I want it as a gradient preset is because I can then easily edit it to work with whatever I'm applying it to.
  • tharle
    Offline / Send Message
    tharle polycounter lvl 9
    i looked into this a little while ago and couldnt find any way of automatically creating gradient maps from an image - be really interested if you do!
  • Michael Knubben
    Tharle: If I do find a way, I'll post it here. For now, I'm just handpicking them. I set my color-palette to lab so I can see the Luminosity at a glance, so when it says 50 I put the colour at the mid-point of the gradient.

    Even just a way of handpicking colours from the gradient dialog, and having them inserted at the correct location according to their luminosity would be very helpful.
  • Farfarer
    I dunno, I'm stumped. I don't know of any way to do this easily, let alone inside of Photoshop.

    The method Pior mentioned is probably the easiest way.
  • kio
    Offline / Send Message
    kio polycounter lvl 15
    no working solution just thinking - maybe grab colors with http://lokeshdhakar.com/projects/color-thief/ and sort them in a pleasing way?
Sign In or Register to comment.