Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Batch combine multiple images together
#1
Greetings!

I am absolute new to GIMP (and any other than MS Paint...)
My problem is:
I have 6 pieces .bmp images of same size
Rotate them 180°
then combine them into a 3x2 format and save the result.
(or combine in reverse order, then rotate the result 180°)

It's not a big deal in paint, but I have a few thousands of those sixpacks, and I would like to automate the process.

I'm using Windows and quite familiar with windows batch, therefore when I heard that Gimp has powerful command line features I was happy.
But honestly, after half a day of searching forums and looking trough procedure browser, I did not get closer to the solution.
I dont even know where to start.
I can insert images to multiple layers, but cannot move them.
Is there a simple "move"-like command, or I have to write a complete plugin for this?

Please, if this is not some incredible hard task, help me with with a little starting kick.

[Hi! Sorry for bad english!]
(yes, I heard about ImageMagick, but I work on a company PC and can use only whitelisted softwares. While GIMP is accepted, IM isn't.)
Reply
#2
Are you looking for something like this?
(this is a "montage")
   
Reply
#3
(02-02-2018, 02:37 PM)dinasset Wrote: Are you looking for something like this?
(this is a "montage")

Hi! Thank you for replying!
Yes, I was looking for that word "montage" Smile and looking for something like that, but without any additional borders, effects, ect.
Maybe it's too friday (im my language it's "péntek", but we just call it "pain-tek") or I'm just really lame,
but couldn't find any solution without installing other software or plugins which are prohibited here.
Reply
#4
Unfortunately I did that one using a filter (a plug-in), but you cannot install any...
Someone else better than me in manual manipulations with Gimp can help you.
Reply
#5
If you are familiar with Windows batch, see ImageMagick's "montage" command (and likely the "convert" command for some operations).
Reply
#6
Quote:I heard about ImageMagick, but I work on a company PC and can use only whitelisted softwares. While GIMP is accepted, IM isn't..
...but couldn't find any solution without installing other software or plugins which are prohibited here...

This might be a starting point for you. Maybe you can adapt it into a batch procedure.

A gimp script tile-layers.scm one of RobA's from http://www.silent9.com/incoming/scripts/

There are snags, layer order, active layer, canvas size and no base layer. (not a snag, just load the 6 images)

looks like this: 
   

and produces this
   

not able to download at work? maybe you can copy/paste

Code:
; tile-layers.scm
; by Saul Goode and Rob Antonishen
; http://ffaat.pointclark.net

; Version 1.0 (20100430)

; Description
;
; This script will tile layers so that each layer is centered
; in a non-overlapping panel in a manner that all layers are visible.
; It allows specifying the width, height, or will best fit to a square.
; There are options for spacing the images out and drawing a grid.
;
; This started as Saul Goode's mosaicize script 
; http://flashingtwelve.brickfilms.com/GIMP/Scripts/mosaicize.scm

; License:
;
; This program is free software; you can redistribute it and/or modify
; it under the terms of the GNU General Public License as published by
; the Free Software Foundation; either version 2 of the License, or
; (at your option) any later version. 
;
; This program is distributed in the hope that it will be useful,
; but WITHOUT ANY WARRANTY; without even the implied warranty of
; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
; GNU General Public License for more details.
;
; The GNU Public License is available at
; http://www.gnu.org/copyleft/gpl.html

(define (script-fu-tile-layers image drawable mode size spacing drawgrid-flag gridcolour)
  (let* (
    (layers  (vector->list (cadr (gimp-image-get-layers image))))
    (max-bounds 0)
    (num-cols (cond 
                ((= mode 0) (trunc (+ (sqrt (length layers)) 0.99999))) ; Square
                ((= mode 1) (min size (length layers))); Specify Across
                ((= mode 2) (trunc (+ (/ (length layers) (min (length layers) size) 0.99999)))))) ; Specify Down
    (num-rows (cond
                ((or (= mode 0) (= mode 1)) (trunc (+ (/ (length layers) num-cols) 0.99999)))
                ((= mode 2) (min (length layers) size))))
    (window 0)
    (grid 0)
    (row 0)
    (col 0)
   )

  (gimp-context-push)
  (gimp-image-undo-group-start image)
  (set! max-bounds
    (let loop ((layer layers)
               (max-width 0)
               (max-height 0))
               (if (null? layer)
                 (list max-width max-height)
                 (loop (cdr layer)
                       (max max-width (car (gimp-drawable-width (car layer))))
                       (max max-height (car (gimp-drawable-height (car layer))))
                       ))))
  (set! window (car (gimp-layer-new image
                                    (+ (* num-cols (car max-bounds)) (* num-cols spacing) spacing)
                                    (+ (* num-rows (cadr max-bounds)) (* num-rows spacing) spacing)
                                    (+ 1 (* (car (gimp-image-base-type image)) 2))
                                   "Frames"
                                    100
                                    NORMAL-MODE)))
  (gimp-image-add-layer image window -1)
  (gimp-image-lower-layer-to-bottom image window)
  (gimp-image-resize-to-layers image)
  (gimp-layer-set-offsets window 0 0)
  (gimp-drawable-fill window BACKGROUND-FILL)
  (let loop ((layer (reverse layers))
             (row 0)
             (col 0))
             (if (pair? layer)
               (begin
                 (let* (
                     (x (+ (* col (+ (car max-bounds) spacing)) spacing))
                     (y (+ (* row (+ (cadr max-bounds) spacing)) spacing))
                     )
                   (gimp-layer-set-offsets (car layer)
                                       (+ x (/ (- (car  max-bounds) 
                                                  (car (gimp-drawable-width  (car layer))))
                                                2))
                                       (+ y (/ (- (cadr max-bounds) 
                                                  (car (gimp-drawable-height (car layer))))
                                                2)))
                   (set! col (+ col 1))
                   (if (= col num-cols)
                     (begin
                       (set! col 0)
                       (set! row (+ row 1))
                       )
                     )
                   (loop (cdr layer)
                         row
                         col)))))
  (when (and (equal? drawgrid-flag TRUE) (> spacing 0))
    (set! grid (car (gimp-layer-new image
                                    (+ (* num-cols (car max-bounds)) (* num-cols spacing) spacing)
                                    (+ (* num-rows (cadr max-bounds)) (* num-rows spacing) spacing)
                                    (+ 1 (* (car (gimp-image-base-type image)) 2))
                                   "Grid"
                                    100
                                    NORMAL-MODE)))
    (gimp-image-add-layer image grid 0)
    (gimp-image-raise-layer-to-top image grid)
    (plug-in-grid RUN-NONINTERACTIVE image grid spacing (+ (car max-bounds) spacing) (trunc (/ spacing 2)) gridcolour 255
                                                spacing (+ (cadr max-bounds) spacing) (trunc (/ spacing 2)) gridcolour 255
                                                0 0 0 gridcolour 0))
  (gimp-image-undo-group-end image)
  (gimp-context-pop)
  (gimp-displays-flush)
  )
)

(script-fu-register "script-fu-tile-layers"
  "Tile Layers..."
  "Translate layers into a grid."
  "Saul Goode and Rob Antonishen"
  "Saul Goode and Rob Antonishen"
  "April 2010"
  "*"
  SF-IMAGE      "Image"    0
  SF-DRAWABLE   "Drawable" 0
  SF-OPTION     "Mode" '("Best Fit to Square" "Specify Across" "Specify Down")
  SF-ADJUSTMENT "Number of grid cells" '(2 1 100 1 5 0 0)
  SF-ADJUSTMENT "Spacing between cells" '(0 0 25 1 5 0 0)
  SF-TOGGLE     "Draw Grid" FALSE 
  SF-COLOR      "Grid Colour" (car (gimp-context-get-foreground))
)
  
(script-fu-menu-register "script-fu-tile-layers"
  "<Image>/Filters/Map"
)

best of luck
Reply


Forum Jump: