Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Need assist with a mass color replace
#1
Im a little stuck... I have approximately 700 files that I need to do a color replacement on. I've done similar prior, but the first time around it was replacing 2 specific colors. The new images are as the sample attached. I can fairly easily do this by selecting all of the blue, tuning the edge selection, and changing tone. But that would take hours to do manually.

So the end goal is to change all of the blue tones to browns. The end result is making a modern-looking map into something appearing as it would have if found on old parchment.. so the blues have to go! 

Is there a batch process, or script, that make this easier than a fully manual click-fest?

TIA

[Image: unknown.png]
Reply
#2
As soon as I post this someone will come up with a super-simple method Wink

However, super-complicated using only Gimp and plugins
gmic_gimp_qt (use the latest version) http://www.gmic.eu
BIMP https://alessandrofrancesconi.it/projects/bimp/

Briefly,
Prepare a single before and after image.
Use gmic to make a look-up-table (CLUT)
Apply the CLUT to make a gmic log entry
Use the log entry to apply gmic to a folder full of files using BIMP.

FWIW Those as a video https://youtu.be/u_WCuJOU7P0 Duration 6 minutes.

Do not know if it will work with your set of images, could have done with five or six samples to try out.
Reply
#3
(09-26-2019, 03:35 PM)rich2005 Wrote: As soon as I post this someone will come up with a super-simple method Wink

However, super-complicated using only Gimp and plugins
gmic_gimp_qt (use the latest version) http://www.gmic.eu
BIMP https://alessandrofrancesconi.it/projects/bimp/

Briefly,
Prepare a single before and after image.
Use gmic to make a look-up-table (CLUT)
Apply the CLUT to make a gmic log entry
Use the log entry to apply gmic to a folder full of files using BIMP.

FWIW Those as a video  https://youtu.be/u_WCuJOU7P0  Duration 6 minutes.

Do not know if it will work with your set of images,  could have done with five or six samples to try out.

Thanks, Ill give that a shot. All totally foreign to me! But nothing is beyond learning.
Reply
#4
Seems to have worked great so far. The only issue I had was that I created the CLUT with a png, and that final command made a total mess of the jpg images. Easy enough to make a new CLUT for those.

Very much appreciated! The video was far above and beyond!
Reply
#5
OK... for some reason its not working on the jpg files. It did when I applied the external CLUT to the osingle image to get the command from the log..
fx_apply_haldclut 2,"C:/Atlas/ServerGridEditor-master-newest/IslandImages - recolors/output.png",100,0,0,0,0,0,0,0,50,50

But using that in BIMP isnt applying any changes at all
Reply
#6
Of course, I already dumped the files I made, had to make new ones Wink Still only 2 test images this time jpegs. If it works with 2 should work with many.

It could be that long path,maybe BIMP has a limit on path length / spaces. I did try reproducing that and did run into problems.

If possible try to keep things simple. I used a C:\island for original jpeg tiles and a C:\island-recolored for the result.

Put the CLUT (made as previous video from your png + recoloured png) in C:\island which gave a gmic command

Code:
fx_apply_haldclut 2,"C:\island\output.png",100,0,0,0,0,0,0,0,50,50

Much easier to use a video than write reams + screenshots, often misconstrued.

This one only two and a half minutes. see if it makes more sense. https://youtu.be/nwO1jj9kpE0
Reply
#7
Never thought about it being a path issue. 

Moved everything and ran into a strange issue. Again, it works fine within Gimp with a single file. But using BIM I get the result below.

Original file...
[Image: Cay_orig.jpg]

Edited File
[Image: Cay_edited.jpg]

And the output.png
[Image: output.png]

Just some more examples, this is a sampling of the 780ish files I need to modify.

just a few
Reply
#8
Ahh....jpegs with transparency Wink You can get a PhotoShop jpeg with a clipping mask that masks out the background for DTP use. Gimp does not recognise these anyway and your jpegs are in fact png's. Why the strange background? Try this little test. Take one of your "jpg" files Use the eraser tool in anti-erase mode. Use on the transparency to see what was previously there.

   

Jpeg format does not support transparency. For transparency Export to png format and untick Save color values from transparency.

I made a CLUT from two images with transparency and those stray pixels gone. Anti erase that and it uses the BG color. I am not sure that you even need transparency. AFAIK the CLUT does not contain transparency info . I have attached the two layers in the xcf.gz file. Opens straight up in Gimp and make your CLUT.

Using BIMP. You should know all about gmic by now. Add another procedure, In the BIMP menu Change Format and compression. Choose PNG and remember to untick the "Save color values from transparency"

   

Some results - with transparent - white layer under - blue (sea) layer under - Patterned layer under There is still a bit of semi- transparency there. Might be possible to remove that but using a different procedure.

   

Still hoping for someone to come up with a super-simple method.


Attached Files
.gz   before-after.xcf.gz (Size: 616.99 KB / Downloads: 152)
Reply
#9
I don't know if I get the question right but I've used the GMIC/Colors/Sklect-Replace color and replaced blue to brown. I merged the result with the original layer with tranparancy 80%.

   
   
Reply
#10
(10-02-2019, 05:55 PM)denzjos Wrote: I don't know if I get the question right but I've used the GMIC/Colors/Sklect-Replace color and replaced blue to brown. I merged the result with the original layer with tranparancy 80%.

My original question/problem was very poorly articulated. @rich2005 just happened to pick up on enough ques that he got started in the right direction. The OP should have had sample files, not silly screenshots. Those SS didn't show that I was working with transparencies. And definitely didn't show that they were a combination of PNG and bastardized JPGs. I think the latest solution will work, the bad part of the overall project is that the program that uses those images is coded to use those filenames. So Ive got to figure out why they chose to use some JPGs and some PNGs, and if I can coax it to use only PNGs.

What should have been a 10 hour project has become more like 1 week!
Reply


Forum Jump: