Thread Rating:
  • 1 Vote(s) - 4 Average
  • 1
  • 2
  • 3
  • 4
  • 5
batch image background change
#1
hi guys,

i have multiple different PNG files, same size and with transparent background.
now i want to know if it is possible to somehow to add a background color or maybe even a whole different picture as a background to them.

[Image: unknown.png]

thanks stefffff
Reply
#2
For existing image files and a plain colour background you can use the batch plugin BIMP https://alessandrofrancesconi.it/projects/bimp/

Set the FG colour. Start BIMP Add the image files and use 'other gimp procedure'.
Search for fill, choose  gimp-bucket-fill, settings as below. Set a output location and run it. 

   

A bit more difficult to add a background  image. You can open all your images as layers, and merge another image under each layer. 
There are plugins to do this: http://sourceforge.net/projects/gimp-too...s/scripts/  look for ofn-interleave-layers.zip (dated 2020-04-25) Read the documentation that comes in the zip. Then you need to re-export all the layers back to single images. Same place look for ofn-export-layers.zip (2018-02-22)  There are other scripts/ plugins that do similar.
Reply
#3
(03-13-2021, 03:46 PM)rich2005 Wrote: For existing image files and a plain colour background you can use the batch plugin BIMP https://alessandrofrancesconi.it/projects/bimp/

Set the FG colour. Start BIMP Add the image files and use 'other gimp procedure'.
Search for fill, choose  gimp-bucket-fill, settings as below. Set a output location and run it. 



A bit more difficult to add a background  image. You can open all your images as layers, and merge another image under each layer. 
There are plugins to do this: http://sourceforge.net/projects/gimp-too...s/scripts/  look for ofn-interleave-layers.zip (dated 2020-04-25) Read the documentation that comes in the zip. Then you need to re-export all the layers back to single images. Same place look for ofn-export-layers.zip (2018-02-22)  There are other scripts/ plugins that do similar.

oh thank you, i will definetly try this, even though "filling" sounds like it wont blend in as good as an actually background
Reply
#4
Quote:oh thank you, i will definetly try this, even though "filling" sounds like it wont blend in as good as an actually background

A comparison, original files below, output files above.

   

Any problems and I can make a more detailed video demo.
Reply
#5
(03-13-2021, 04:00 PM)stefffff Wrote:
(03-13-2021, 03:46 PM)rich2005 Wrote: For existing image files and a plain colour background you can use the batch plugin BIMP https://alessandrofrancesconi.it/projects/bimp/

Set the FG colour. Start BIMP Add the image files and use 'other gimp procedure'.
Search for fill, choose  gimp-bucket-fill, settings as below. Set a output location and run it. 



A bit more difficult to add a background  image. You can open all your images as layers, and merge another image under each layer. 
There are plugins to do this: http://sourceforge.net/projects/gimp-too...s/scripts/  look for ofn-interleave-layers.zip (dated 2020-04-25) Read the documentation that comes in the zip. Then you need to re-export all the layers back to single images. Same place look for ofn-export-layers.zip (2018-02-22)  There are other scripts/ plugins that do similar.

oh thank you, i will definetly try this, even though "filling" sounds like it wont blend in as good as an actually background

hello very interesting i try with images with a white background... not properly all white... there a re few  shadow grey nuances... .. they are product photo with a shadow under the product and  near white background... i made more white as possible when i shot but it's impossible to make perfectly white... i'm trying to use gimp+bimp but not found the right pattern... while if i use fill bucket in normal gimp only 1 image processing it fill all the background with pure white...
my question is
can bimp and fill bucket make the same in bulky for some images of same product /different angle due i use for 360 degree  wordpress plugin)
thanks
Reply
#6
(09-17-2023, 02:28 PM)nikketrikke Wrote: hello very interesting i try with images with a white background... not properly all white... there a re few  shadow grey nuances... .. they are product photo with a shadow under the product and  near white background... i made more white as possible when i shot but it's impossible to make perfectly white... i'm trying to use gimp+bimp but not found the right pattern... while if i use fill bucket in normal gimp only 1 image processing it fill all the background with pure white...
my question is
can bimp and fill bucket make the same in bulky for some images of same product /different angle due i use for 360 degree  wordpress plugin)

I say, generally, if you cannot fix-up a single image using some standard procedure(s) then unlikely that a batch operation is any better, just more of the same.

If you have taken some product photos (rotating to get 360 deg) in a light box and the shadow is causing a problem you might have to improve the lighting to reduce / eliminate shadows. Not easy.

Other considerations:

Instead of a bucket fill, a background removal and a export as a jpeg flattens the image replacing transparency with white (if white is the current BG colour)

ImageMagick command line is another program that is used for batch processing.

If you can post a single image, you might get some suggestions for a work-flow.
Reply
#7
(09-17-2023, 04:37 PM)rich2005 Wrote:
(09-17-2023, 02:28 PM)nikketrikke Wrote: hello very interesting i try with images with a white background... not properly all white... there a re few  shadow grey nuances... .. they are product photo with a shadow under the product and  near white background... i made more white as possible when i shot but it's impossible to make perfectly white... i'm trying to use gimp+bimp but not found the right pattern... while if i use fill bucket in normal gimp only 1 image processing it fill all the background with pure white...
my question is
can bimp and fill bucket make the same in bulky for some images of same product /different angle due i use for 360 degree  wordpress plugin)  

I say, generally, if you cannot fix-up a single image using some standard procedure(s) then unlikely that a batch operation is any better, just more of the same.

If you have taken some product photos (rotating to get 360 deg) in a light box and the shadow is causing a problem you might have to improve the lighting to reduce / eliminate shadows. Not easy.

Other considerations:

Instead of a bucket fill, a background removal and a export as a jpeg flattens the image replacing transparency with white (if white is the current BG colour)

ImageMagick command line is another program that is used for batch processing.

If you can post a single image, you might get some suggestions for a work-flow.
hello i link a video with the image
https://streamable.com/1a1ib1

i use bucket fill on gimp...
i suppose the bimp bucket with so many possibilities...

https://prnt.sc/23NMtlqp_a3F

could make the same result?
Reply
#8
(09-17-2023, 07:37 PM)nikketrikke Wrote: hello i link a video with the image
https://streamable.com/1a1ib1

I had to crop an image out of your video for tests. It is smaller than the original, results might not be exact.

Quote:i use bucket fill on gimp...
i suppose the bimp bucket with so many possibilities...

Using the bucket-fill With BIMP is not possible. The bucket-fill tool creates a selection for the fill, BIMP does not support selections. The bucket-fill in BIMP fills the whole image.

Quote:https://prnt.sc/23NMtlqp_a3F
could make the same result?

Most alternatives scripts / plugins use a selection, with the above BIMP restriction. It might be possible using the gimp_gmic_qt plugin, http://www.gmic.eu, which has a select-replace filter.

The only way I can think of to remove the shadow at the bottom is mask it out with a blank white image.

See if you can follow this procedure: https://youtu.be/ZoxAr4l2koc 3 minutes duration Remember I only have the single image to work with.

---------------
I mentioned a command line alternative ImageMagick http://www.imagemagick.org and that might go like this

To fill the background
Code:
magick image-in.png -fill white -fuzz 80% +opaque "#000000" temporary.png
To mask out the bottom shadow
Code:
magick composite -gravity south  blank.png temporary.png  image-out.png

You need to wrap that up in a batch file depending on operating system
Reply


Forum Jump: