Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Bulk edit with gradient
#1
Hi guys, im trying to edit a number of images all at once.... the images are of faces with plain coloured backgrounds.

i have been using the batch image manipulation tool for bucket fill to change the colours of the image background .... which works great. i can do 100's at once which takes minutes....

but not i want to do the same thing, but using 2 colours and the gradient tool.

i can do this manually one at a time, step by step: 

open the image >
choose the fuzzy select tool >
click and select the background area of the image >
choose the gradient tool >
then with the gradient tool, i will select the x and y points of my gradient on to the image> 

once the gradient has successfully coloured the background i will then click to export the image, and save it as a png file in to my new folder location


sorry if this has been discussed before, 

I have added a before and after example

thanks for your time.


Attached Files Image(s)
       
Reply
#2
No answer, but just to set the scene. How many of these do you have to process ?
Reply
#3
(09-28-2021, 08:49 AM)rich2005 Wrote: No answer, but just to set the scene. How many of these do you have to process ?

around 10,000 of them.

iv been doing them in batches of 100 up to now
Reply
#4
IMHO, assuming all the image have the same size, a much better way, to summarize:


1) make you images "heads with transparent background" (more on that later)
2) Create the gradient image
3) Overlay each of your image on the gradient, or add the gradient behind each.

Step #1
  • Use my ofn-tiles script to load all your images as tiles on a single layer
  • Make their background transparent using Colors ➤ Color to alpha:
  • fuzzy-select the background
  • Select ➤ Grow by a couple of pixels
  • Colors ➤ Color to alpha and remove the background color
Step #2
  • Create an image that has the size of one head image (you can copy paste one of the heads from the image in step #1)
  • Add a layer below it
  • Fill that layer the gradient
  • Edit ➤ Copy to copy the gradient layer to the clipboard
   

Step #3
  • Back to the heads image
  • Add a layer below the heads layer
  • Start the bucket fill tool
  • Set to "Pattern" fill
  • Set the pattern to "Clipboard" (the first in the list) (this should give you the gradient layer from step #2)
  • Bucket-fill the added layer. The pattern repetition should align with the heads
  • Image ➤ Flatten image or Layer > Merge down on the head layer
  • Use ofn-tiles again to split your image into its components.
   

The only downside of this method is that if your files have random names the naming scheme is lost, but if they have a sequence number, ofn-tiles can re-generate it when saving. But in the whole it could be best for you to handle these images as "sprite sheets", and only export final versions as individual images.
Reply
#5
Another way Wink

First removing a background. I use a quick-n-dirty plugin isolate.py (attached, unzip, put in your plug-ins folder). Try it out on some representative images, if it works, great, if not then back to the drawing board.

The usual Gimp batch plugin BIMP is no good for these operations, fortunately there is a new one here: 
https://www.gimpscripts.net/2021/09/gimp-batch.html

There are examples on that page and links to further discussions, do follow them up.

However, all being well, it might go like this 4 minutes duration: https://youtu.be/JNKpDGFVnm8





This the command used in the batch plugin
Code:
pdb.python_fu_isolate(image,layer)


Attached Files
.zip   isolate.zip (Size: 414 bytes / Downloads: 152)
Reply
#6
thats fantastic guys. you made the impossible seem reachable now...... that's given me something to play with...

thank you so much for your help.
Reply


Forum Jump: