Post Reply 

Batch change a color to another color with alpha

May 24, 2014, 22:12
Post: #1
Batch change a color to another color with alpha
I have a large amount of 16x16 pixel images, made up of two colors. I need to make a new set of these images with a different color for another variant of what I'm using these images for. Normally, I just go in and go bucket crazy with foreground and background colors. This works fine, and takes no more than 10 minutes. But I need to create a set with a specific color and alpha value for each of the two colors. I can do this in GIMP using my standard method, but I first have to erase the area before bucket-filling with alpha. Is their either a) a way to make the bucket erase an area before filling, or b) batch change the color and alpha value of these images? Any help would be awesome!
Find all posts by this user
Quote this message in a reply
May 24, 2014, 22:39
Post: #2
RE: Batch change a color to another color with alpha
You can use the bucket-fill in "color-erase" mode to replace a color with alpha and then use the bucket-fill in "behind" mode to fill the transparency with a new color. The BIMP should be able to do that.

Now answering your questions on
https://Gimp-Forum.net
Visit this user's website Find all posts by this user
Quote this message in a reply
May 25, 2014, 00:01
Post: #3
RE: Batch change a color to another color with alpha
Do you happen to have a mac binary or where I can get one for BIMP? Can't seem to compile it, don't know where to get libgimp.
Find all posts by this user
Quote this message in a reply
May 25, 2014, 08:13
Post: #4
RE: Batch change a color to another color with alpha
There is a bimp plugin included in Parthas Mac 64 bit version, big zip file, extract the plugin from there.
but
A quick test using BIMP and I do not think it will work.

Transparency/anti-alliasing is the problem.
The most obvious function, color exchange, either leaves untouced or wrecks the image. One that does work is color rotate but the rotate settings are not retained between images so the batch function is no better than standard Gimp. Not to say that there is not some other function that works.

I think it can be done with ImageMagick but again I am have problems with that pesky anti-aliasing. Lots of info available but it takes a bit of sorting. From my notes the bog-standard command for replacing a colour is
convert in.ext -fuzz 15% -fill "#newcolor" -opaque "#oldcolor" out.ext

My suggestion, first have a look at
http://www.fmwconcepts.com/imagemagick/t.../image.php see if anything there.
Then try the users section at
http://www.imagemagick.org/discourse-server/
and ask the question. Fred hangs out there and AFAIK he is a Mac use.

best of luck

** https://www.gimp-forum.net/ now answering questions**
Find all posts by this user
Quote this message in a reply
May 25, 2014, 09:03 (This post was last modified: May 25, 2014 09:08 by ofnuts.)
Post: #5
RE: Batch change a color to another color with alpha
(May 25, 2014 08:13)rich2005 Wrote:  Transparency/anti-alliasing is the problem.

Not if you use "Color erase" and "Behind" modes... Which reminds me that I have a short script that does just that: see replace-foreground-by-background (doc (short!) here and download there).

[attachment=3516]

Now answering your questions on
https://Gimp-Forum.net
Visit this user's website Find all posts by this user
Quote this message in a reply
May 25, 2014, 09:26 (This post was last modified: May 25, 2014 09:49 by rich2005.)
Post: #6
RE: Batch change a color to another color with alpha
@Ofnuts
Still guessing at the form of the OP's images but that script works nicely here. Two colour png exported with transparency.
Python so it does not show up in BIMP 'other procedures' That is BIMP out again.
Hints at command line perhaps?

Edit
I was wrong. Your plugin does show up in BIMP. I used the wrong search term.
FWIW in BIMP
http://i.imgur.com/Q3kmGl7.jpg
and
http://i.imgur.com/SczOeqy.jpg

** https://www.gimp-forum.net/ now answering questions**
Find all posts by this user
Quote this message in a reply
Post Reply 


Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  change the default export setting of Untitled.png ezz9 2 255 Jun 9, 2017 16:31
Last Post: ezz9
  Color alpha function and its current errors Fuse809 0 267 Oct 11, 2014 03:53
Last Post: Fuse809
  GIMP 2.8 Eyedropper Color Selection Tool Not Working? Upgraded App is Slow?? tootallll 14 9,922 Oct 9, 2014 18:39
Last Post: Graphicman2014
  Using Color/Levels causing phosterization photos piotrkast 5 512 Oct 8, 2014 12:06
Last Post: ofnuts
  New layer color... btraven 0 235 Oct 2, 2014 00:47
Last Post: btraven

Forum Jump:


GIMP ForumPortalArchiveContactTermsRSS