I have plenty of images made up with the same color, just like those:

First imageanother image

Now what I want is to change their "main" color from "#3d507d" to "#7C0A0A".

I tried to do that by changing the "hue/saturation" but with no success. (batch changing the hue/saturation is available with this gimp script :http://registry.gimp.org/node/23499 )

So, how can I change the color from "#3d507d" to "#7C0A0A" ? preferably with batch/scripting option?

I use GIMP / Inkscape / Photoshop. I prefer explanations in this order (most preferred GIMP)

BTW, I don't want to change only the "#3d507d" pixels, I want to change also the "gradiented"/"Edged"/"partly transparent" pixels to match the change to "#7C0A0A". - in other words - It should be looking good... Thanks.

  • Hi yossico, thanks for your question. Could you tell us what software you use, and why the method given doesn't satisfy you? Please edit your question with this info. Thanks! If you have any questions, please see the help center or ping one of us in the Graphic Design Chat. Keep contributing and enjoy the site! – Vincent Jun 30 '15 at 13:31
  • 2
    You could use ImageMagick (mogrify -fill "#7C0A0A" -opaque "#3d507d" [images]). – Glenn Randers-Pehrson Jun 30 '15 at 13:45
  • @Vincent - hi, I added explenations – yossico Jul 1 '15 at 9:11
  • @GlennRanders-Pehrson - isent this will replace only the source pixels with the destination value? I want the edges to be modified too and they have other values... – yossico Jul 1 '15 at 9:12
  • Is the image's background transparent? Then you should really have a look at this question: graphicdesign.stackexchange.com/questions/26572/… – Vincent Jul 1 '15 at 9:34

BTW, I don't want to change only the "#3d507d" pixels, I want to change also the "gradiented"/"Edged"/"partly transparent" pixels to match the change

I am not entirely sure what data you have, but if you happen to have SVGs (or another vector format), the problem with partial pixels does not arise, as there are no pixels in the first place. In this case you can make use of SVGs having a plain source and perform the replacement with a simple search-and-replace script. For example, on a unixoid system the following command should do your replacement on all SVGs in the current folder:

sed "s/#3d507d/#7c0a0a/g" *.svg

Note that this is modulo capitalisation, so you might need to replace #3d507d with #3D507D.

  • Wow, I'll put that in mind - this can be very useful in the future. In my case, the data is png files - as exampled in the question – yossico Jul 5 '15 at 7:21
  • You don't depend on unixoid systems, since sed is freely available for windows systems too - it's just not part of the distribution. – user unknown Aug 8 '15 at 23:40

I don't know much about Gimp but maybe you can use my Photoshop example and find a way in Gimp to achieve this.

In Photoshop, I would make an action that does something like this and then do a batch processing:

1) put the image to grayscale,

2) change the image mode to duotone mode using your new color + a gray

3) convert back to RGB mode

4) save.

color change duotone Photoshop

BUT all the image will become with the red hue, including the light shadow unless you use 2 colors in your duotone and adjust the curves to use a gray/black for the lightest part and a 100% of your new HEX color for the darker part of your images.

That's what I did in my example. It's not perfect, I did it quickly and you might find a better adjustment; the shadow is still a bit red and the text doesn't look bad. If you don't mind about that little shadow, you can use a monotone too.

Bacth duotone curves

  1. You could use IrfanView to (batch) replace colours in an image.

  2. If you want to use SVG (Inkscape) you could use a Ruby program called inkscape_merge for this. Refer to this site for steps.

  • 1
    Welcome to Graphic Design SE. Can you please edit your answer to summarise the part of the linked site that helps with this? It seems to cover all sorts of different things that are unrelated to this question. – Wrzlprmft Jun 30 '19 at 16:45

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.