It is currently Thu Jun 20, 2013 6:03 am


Latest GIMP Scripts & Plug-ins

All times are UTC - 5 hours [ DST ]




Post new topic Reply to topic  [ 13 posts ]  Go to page 1, 2  Next
Author Message
 Post subject: Using BIMP to auto overlay pairs of images
PostPosted: Thu May 23, 2013 9:08 am  (#1) 
Offline
GimpChat Member

Joined: May 23, 2013
Posts: 6
I would like to use the BIMP plugin* to overlay my (hundreds of!) images in the following way. My images are named in this fashion:

Blah blah 1 - A.tif
Blah blah 1 - B.tif
Blah blah 2 - A.tif
Blah blah 2 - B.tif
Blah blah 3 - A.tif
Blah blah 3 - B.tif

I would like to create the files:

Blah blah 1 - C.tif
Blah blah 2 - C.tif
Blah blah 3 - C.tif

by overlaying image A on B using the 'Divide' image option.

The BIMP plugin is utilised via File > Batch Image Manipulation. Then, in the 'Manipulation Set' section, I click 'Add' and select 'Other GIMP procedure'. None of the many procedures contain the string 'overlay' or 'divide'. Can I procede with BIMP or doesn't it do what I'd like to do? Would writing a Fu-Script be trivial (I've never programmed a computer before, apart from once when I made a turtle move around a screen in some laughable school IT exercise).

Thanks a batch.

Edit: apparently my "post looks too spamy for a new user, [please remove off-site URLs]" so, I'm going to try and phase this link through the SPAM shield, because my post is clearly not SPAM of any sort.
*w WOAH, NELLY! ww.alessandrofrancesconi.it/projects/bimp/


Share on Facebook Share on Twitter Share on Orkut Share on Digg Share on MySpace Share on Delicious Share on Technorati
Top
 Profile  
 

 Post subject: Re: Using BIMP to auto overlay pairs of images
PostPosted: Thu May 23, 2013 10:26 am  (#2) 
Offline
GimpChat Member

Joined: Feb 20, 2013
Posts: 1673
https://github.com/alessandrofrancescon ... imp/issues

I had some questions once, and was told to post all questions to the link above.
HTH


Top
 Profile  
 
 Post subject: Re: Using BIMP to auto overlay pairs of images
PostPosted: Thu May 23, 2013 11:11 am  (#3) 
Offline
GimpChat Member

Joined: May 23, 2013
Posts: 6
Thanks. I copied my query over, but given that there are only 10 threads and some have been unanswered for over a year, my expectations aren't too high :(


Top
 Profile  
 
 Post subject: Re: Using BIMP to auto overlay pairs of images
PostPosted: Thu May 23, 2013 11:49 am  (#4) 
Offline
GimpChat Member

Joined: Feb 20, 2013
Posts: 1673
Mine was answered within a few days, so I guess you might have to wait a little while.


Top
 Profile  
 
 Post subject: Re: Using BIMP to auto overlay pairs of images
PostPosted: Thu May 23, 2013 12:02 pm  (#5) 
Offline
GimpChat Member

Joined: Mar 04, 2011
Posts: 315
I am not saying that it is impossible with BIMP but really that plugin is meant for single images.

The author does respond and quickly, I reported a bug once and it was acted on straight away. For various (linux) reasons I am stuck in a time warp on version 0.5 so maybe latest will do what you want.

I would say for batch processing ImageMagick would be a better bet

convert image01.tiff image02.tiff -compose Divide -composite out.tif


is equivalent to two layers with the top in divide mode.

example (helps if the 2 images are the same size)

http://i.imgur.com/54oTiSO.jpg

Top is gimp with the top layer mode = divide
and the bottom is IM applied to the same images

Obviously you would need a batch/bash file depending on OS. Worth asking at the IM forum

_________________
Image


Top
 Profile  
 
 Post subject: Re: Using BIMP to auto overlay pairs of images
PostPosted: Thu May 23, 2013 12:30 pm  (#6) 
Offline
GimpChat Member
User avatar

Joined: Apr 23, 2010
Posts: 842
Location: not from Guildford after all
Or you could use a bespoke script...

(define (sg-batch-merge-divide directory centered)
  (let loop ((filelist (cadr (file-glob (string-append directory
                                                       DIR-SEPARATOR
                                                       "*A.tif")
                                        1 ))))
    (unless (null? filelist)
      (let* ((filename-a (car filelist))
             (filename-b (string-append (car (strbreakup filename-a "A.tif")) "B.tif"))
             (image-a (car (gimp-file-load RUN-NONINTERACTIVE
                                           filename-a filename-a)))
             (image-b (catch #f (car (gimp-file-load RUN-NONINTERACTIVE filename-b filename-b))))
             (layer-a (car (gimp-image-get-active-layer image-a)))
             (layer-b (if image-b
                             (car (gimp-image-get-active-layer image-b))
                             #f )))
        (if layer-b
          (let ((layer (car (gimp-layer-new-from-drawable layer-a image-b))))
            (gimp-image-add-layer image-b layer 0)
            (gimp-layer-set-mode layer DIVIDE-MODE)
            (unless (zero? centered)
              (gimp-layer-set-offsets layer (- (/ (car (gimp-image-width image-b)) 2)
                                               (/ (car (gimp-drawable-width layer)) 2))
                                            (- (/ (car (gimp-image-height image-b)) 2)
                                               (/ (car (gimp-drawable-height layer)) 2)) ))
            (set! layer (car (gimp-image-merge-down image-b layer EXPAND-AS-NECESSARY)))
            (let ((filename-c (string-append (car (strbreakup filename-a "A.tif")) "C.tif")))
              (gimp-file-save RUN-NONINTERACTIVE image-a layer filename-c filename-c) )
            (gimp-image-delete image-b) ))
        (gimp-image-delete image-a) )
      (loop (cdr filelist)) )))
     
(script-fu-register "sg-batch-merge-divide"
  "Merge TIF files per THX1138"
  "Merge the layers from two files in DIVIDE mode"
  "Saul Goode"
  "Saul Goode"
  "May 2013"
  ""
  SF-DIRNAME "Directory"    ""
  SF-TOGGLE "Centered" TRUE
  )
(script-fu-menu-register "sg-batch-merge-divide"
  "<Image>/File/"
  )


EDITED because I originally had B atop A.

_________________
There are two types of people in the world. Those who believe in the principle of bivalence, and those who do not.


Top
 Profile  
 
 Post subject: Re: Using BIMP to auto overlay pairs of images
PostPosted: Fri May 24, 2013 8:35 am  (#7) 
Offline
GimpChat Member

Joined: May 23, 2013
Posts: 6
Hi everyone, thanks for your replies.

I think I'll probably end up using ImageMagick but what about that script?; I saved it in C:\Users\Sean\.gimp-2.8\scripts as 'Auto Merge Divide.scm'. Should it appear in the GIMP filters menu?


Top
 Profile  
 

 Post subject: Re: Using BIMP to auto overlay pairs of images
PostPosted: Fri May 24, 2013 9:09 am  (#8) 
Offline
GimpChat Member
User avatar

Joined: Apr 23, 2010
Posts: 842
Location: not from Guildford after all
THX1138 wrote:
I think I'll probably end up using ImageMagick but what about that script?; I saved it in C:\Users\Sean\.gimp-2.8\scripts as 'Auto Merge Divide.scm'. Should it appear in the GIMP filters menu?

It should appear as the command "Merge TIF files per THX1138" at the bottom of your File menu. It has only two options. You can choose whether the top image is centered relative to the bottom image (which does not matter if the two images are the same size). And you can choose the directory containing the TIF files.

_________________
There are two types of people in the world. Those who believe in the principle of bivalence, and those who do not.


Top
 Profile  
 
 Post subject: Re: Using BIMP to auto overlay pairs of images
PostPosted: Fri May 24, 2013 9:37 pm  (#9) 
Offline
GimpChat Member

Joined: May 23, 2013
Posts: 6
How does it know which files to merge and what to name them afterwards? The reality is a lot more complicated than the problem as I introduced it :(


My file names are things like:

Exp.SS.4.4.167 - DF1 cells - With Antibiotic - Sample 1 - Brightfield - Field 1 - 2012-05-23.tif
Exp.SS.4.4.167 - DF1 cells - With Antibiotic - Sample 1 - UV green - Field 1 - 2012-05-23.tif
Exp.SS.4.4.167 - DF1 cells - With Antibiotic - Sample 1 - UV red - Field 1 - 2012-05-23.tif

Exp.SS.4.4.167 - DF1 cells - With Antibiotic - Sample 1 - Brightfield - Field 2 - 2012-05-23.tif
Exp.SS.4.4.167 - DF1 cells - With Antibiotic - Sample 1 - UV green - Field 2 - 2012-05-23.tif
Exp.SS.4.4.167 - DF1 cells - With Antibiotic - Sample 1 - UV red - Field 2 - 2012-05-23.tif

Exp.SS.4.4.167 - DF1 cells - With Antibiotic - Sample 1 - Brightfield - Field 3 - 2012-05-23.tif
Exp.SS.4.4.167 - DF1 cells - With Antibiotic - Sample 1 - UV green - Field 3 - 2012-05-23.tif
Exp.SS.4.4.167 - DF1 cells - With Antibiotic - Sample 1 - UV red - Field 3 - 2012-05-23.tif

Exp.SS.4.4.167 - DF1 cells - Without Antibiotic - Sample 1 - Brightfield - Field 1 - 2012-05-23.tif
Exp.SS.4.4.167 - DF1 cells - Without Antibiotic - Sample 1 - UV green - Field 1 - 2012-05-23.tif
Exp.SS.4.4.167 - DF1 cells - Without Antibiotic - Sample 1 - UV red - Field 1 - 2012-05-23.tif

Exp.SS.4.4.167 - DF1 cells - Without Antibiotic - Sample 1 - Brightfield - Field 2 - 2012-05-23.tif
Exp.SS.4.4.167 - DF1 cells - Without Antibiotic - Sample 1 - UV green - Field 2 - 2012-05-23.tif
Exp.SS.4.4.167 - DF1 cells - Without Antibiotic - Sample 1 - UV red - Field 2 - 2012-05-23.tif

Exp.SS.4.4.167 - DF1 cells - Without Antibiotic - Sample 1 - Brightfield - Field 3 - 2012-05-23.tif
Exp.SS.4.4.167 - DF1 cells - Without Antibiotic - Sample 1 - UV green - Field 3 - 2012-05-23.tif
Exp.SS.4.4.167 - DF1 cells - Without Antibiotic - Sample 1 - UV red - Field 3 - 2012-05-23.tif

The outputs would be:

Exp.SS.4.4.167 - DF1 cells - With Antibiotic - Sample 1 - Merged B-G - Field 1 - 2012-05-23.tif
Exp.SS.4.4.167 - DF1 cells - With Antibiotic - Sample 1 - Merged B-R - Field 1 - 2012-05-23.tif
Exp.SS.4.4.167 - DF1 cells - With Antibiotic - Sample 1 - Merged B-G - Field 2 - 2012-05-23.tif
Exp.SS.4.4.167 - DF1 cells - With Antibiotic - Sample 1 - Merged B-R - Field 2 - 2012-05-23.tif
Exp.SS.4.4.167 - DF1 cells - With Antibiotic - Sample 1 - Merged B-G - Field 3 - 2012-05-23.tif
Exp.SS.4.4.167 - DF1 cells - With Antibiotic - Sample 1 - Merged B-R - Field 3 - 2012-05-23.tif

Exp.SS.4.4.167 - DF1 cells - Without Antibiotic - Sample 1 - Merged B-G - Field 1 - 2012-05-23.tif
Exp.SS.4.4.167 - DF1 cells - Without Antibiotic - Sample 1 - Merged B-R - Field 1 - 2012-05-23.tif
Exp.SS.4.4.167 - DF1 cells - Without Antibiotic - Sample 1 - Merged B-G - Field 2 - 2012-05-23.tif
Exp.SS.4.4.167 - DF1 cells - Without Antibiotic - Sample 1 - Merged B-R - Field 2 - 2012-05-23.tif
Exp.SS.4.4.167 - DF1 cells - Without Antibiotic - Sample 1 - Merged B-G - Field 3 - 2012-05-23.tif
Exp.SS.4.4.167 - DF1 cells - Without Antibiotic - Sample 1 - Merged B-R - Field 3 - 2012-05-23.tif



Is that easy to do with a script? The filenames are basically WILDCARD - Brightfield - WILDCARD, WILDCARD - UV green - WILDCARD, and WILDCARD - UV red - WILDCARD?


Top
 Profile  
 
 Post subject: Re: Using BIMP to auto overlay pairs of images
PostPosted: Sat May 25, 2013 1:28 am  (#10) 
Offline
GimpChat Member
User avatar

Joined: Apr 23, 2010
Posts: 842
Location: not from Guildford after all
Could you download and try the updated script at the location below?

http://chiselapp.com/user/saulgoode/rep ... dc193c91f8

_________________
There are two types of people in the world. Those who believe in the principle of bivalence, and those who do not.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 13 posts ]  Go to page 1, 2  Next

All times are UTC - 5 hours [ DST ]


Who is online

Users browsing this forum: No registered users and 4 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  

* Login  

* Subscribe to Gimp Chat's RSS Feed    * Subscribe to Gimp Chat's Tutorial RSS Feed


Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group