Post Reply 

Bash command line to open two images into GIMP layers

Sep 23, 2013, 04:23
Post: #1
Bash command line to open two images into GIMP layers
I would like to use the Bash command line to open two images into GIMP, each image on a layer. The code below opens the two images into separate GIMP windows.

>> gimp image1.jpg image2.jpg

How can I open the two images into one GIMP window and two layers?
Find all posts by this user
Quote this message in a reply
Sep 23, 2013, 06:49 (This post was last modified: Sep 23, 2013 07:12 by ofnuts.)
Post: #2
RE: Bash command line to open two images into GIMP layers
Either:
  • You write a Scheme/Python script to load the 2 images, and you use the "-b" parameter to tell Gimp to run the script that you put in a CLI parameter, together with th enames of the two files. The syntax is tricky but you can find examples.
  • You write a file-load plugin that is associated to a file type which is only a list of files to load.

Now answering your questions on
https://Gimp-Forum.net
Visit this user's website Find all posts by this user
Quote this message in a reply
Sep 23, 2013, 08:18
Post: #3
RE: Bash command line to open two images into GIMP layers
(Sep 23, 2013 04:23)lwhistler Wrote:  I would like to use the Bash command line to open two images into GIMP, each image on a layer. The code below opens the two images into separate GIMP windows.

>> gimp image1.jpg image2.jpg

How can I open the two images into one GIMP window and two layers?

Looking at your other post as well. Have you considered using imagemagick to stack the images before opening in Gimp.
No need to convert everything to jpeg, once opened, Gimp does not really care about the original format.
A quick-n-dirty script might be

Code:
#!/bin/bash
#
# uses imagemagick to to stack the 2 images to a new file temp.tif
convert new.tif ref.jpg temp.tif
#
# opens temp.tif in gimp. there is a dialog to ok
gimp temp.tif
#
# tidy up
rm temp.tif

You could make the temp file any format that supports multi-layers tiff, xcf, psd. IM here throws up a lot of error messages with xcf (but works) best stick with tif.
As noted in the script there is the opening import dialog to navigate. It is only a click on OK. Improve the script by calling the filenames with a variable, depends on your workflow.

** https://www.gimp-forum.net/ now answering questions**
Find all posts by this user
Quote this message in a reply
Post Reply 


Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  Any plugin for open multiple image in paint.net shinprog 1 327 Oct 31, 2017 11:38
Last Post: paynekj
  plugin save for web in Gimp 2.9.6 Dkk 1 191 Oct 19, 2017 09:02
Last Post: paynekj
  Script-fu: How to create new, addressable layer using gimp-floating-sel-to-layer Bertholom√§us 2 231 Aug 31, 2017 14:32
Last Post: Bertholomäus
  Late binding / COM for opening an image into GIMP? i73 2 196 Aug 4, 2017 17:39
Last Post: i73
  creating multiple sized images from one ntuck86 1 198 Jul 29, 2017 08:18
Last Post: ythgilb

Forum Jump:


GIMP ForumPortalArchiveContactTermsRSS