Illustrator: change Gradient color to grayscale

Hi All

I want to change Gradient CMYK color to Grayscale.

I mean to say change Gradient color to Grayscale.

Thanks inadvance…


If you don’t have time to develop it yourself then try posting on

Hi Macrajeev

if this is in illustrator try downloading the illustrator scripting guide from adobe, this maybe
a good starting point,

I have that scripting guide, but there is no enough information about it.


Here is what I know on this subject. To change the color model the easiest way would be to create an action using Filter>Colors>Convert to Grayscale. However this does not work on gradients, which is probably why you are looking at a script solution. Now, with Illustrator CS, you can work with colors and gradients using scripts. The problem that you are going to run into is in how you do this. Basically to address a gradient it must be a swatch, if not Illustrator will not return (error out) the fill color. I don’t know if this has been addressed in CS2 or not. So, if the illustration is set up using only gradients that are represented as swatches then you could create a script that will convert the gradients to grayscale. You would need to find a formula that you would want to use to convert the 4 colors into 1 color (100%c to 20%k, 100%m to 59%K, 100%y to 11%K is how illustrator converts the colors), then convert each folor of the gradient stop property of the gradient swatch.

My experience in the design field suggests that unless you have control over how these illustrations were made you will not be able to rely on this solution since the illustrators probably did not make sure that they saved each and every gradient as a swatch, and quite possibly adjusted some of those that they did initially apply as a swatch so that it is no longer the gradient in the swatch.

If this is a major problem, say you have 10,000 peices of art to convert then you would need to come up with another solution, or rely on cheep labor to “trouble shoot” the files that you can’t automate.

Hi Jerome

Thanks a lot. I am trying my best and as I will complete it, I will sure post to this forum.

Thansk again…


Would it matter if the gradient was rasterized, when converted to a grayscale
you could script this under the object menu-Raterize…
there is an option for Greyscale under here…

Nope. Still can’t get or set fill colors on objects that contain an unnamed gradient.

Since Adobe’s own color filters won’t work on gradients, it would suggest there is a problem with Illustrator’s internal object model, not just in the scripting support.

One of the situations in which I want to change gradients is when shifting the hue of some artwork. I found it to be extremely tedious having to select every object that contains a gradient, select each point on that gradient, and use the color palette (in HSB mode) to shift the hue manually. I’ve come up with a workaround that generally works for me: I make sure I’m using “global colors” for everything (which are swatches you’ve set to “global” in the properties dialog that comes up when you double click a swatch). When I want to change the hue of one of those colors, I simply edit that swatch (again, with HSB sliders).

I’ve wanted to come up with a script for doing this in situations where that workaround isn’t helpful, but the inability to work with gradients that haven’t been saved as a swatch means I’ll also have to save every gradient as a swatch when working on artwork. It will still save me time when working with artwork that contains a lot of gradients, but would have made things a lot easier if every gradient didn’t have to be saved to a swatch.