How should I set the GMIC for how I want I want to montage in Gimp 3.2?

Hi, new to the plugin.

I am trying to set a number of rows and columns to combine all my 256x145 resolution images (around 100 images), so that would mean I set 7 rows and 4 columns to fill up most of a 1024x1024 image, so that when the plugin takes the needed number of images to do that. then it continues to arrange the next 7 rows x 4 columns on another layer.

Typically I may want to do the same with 341 width images with other rows X columns but not now. Now I will be combining same resolution images that are 256x145.

I don’t know what I need to set to do it like that.

I read and searched that in order to make a bunch of pictures (100 layers of small images) I need to use Arrays & Tiles - Montage.

I didn’t get any meaningful result with custom Layout, so I tried Montage Type: Horizontal Array. This does put a lot of pictures in a row before starting the next row but it adds more than needed in the first row.

I do not need any framing around the pictures so I set all these things frames, spaces between to 0.

I would suggest using the “Custom Code” filter for that task.
What you need is actually using the G’MIC internal command : append_tiles 4,7 that will generate as many 4x7-arranged outputs as necessary to fit your number of input images.
This works because all your images have the same resolution.

  1. Open GIMP and open all your images as new layers.

  1. Open G’MIC-Qt, select fillter Various / Custom Code [Global], then set Input Layers to All, and type command
append_tiles 4,7

in the main code text widget.

  1. Click “OK” to apply this filter. You now have possibly multiple output layers.

(here, 2 layers as I’ve used 56 images).

1 Like

Thanks very much for the detailed steps, it works indeed! Gone are the days of Alignment tool which was never good enough for this and using Film strip.

Just Can I remove the borders of black that form between them? It starts with some black borders and between the rows

You can crop it before using append_tiles. See this documentation here. G'MIC - GREYC's Magic for Image Computing: A Full-Featured Open-Source Framework for Image Processing - Reference Documentation - crop

Since your images are 256x145, crop 0,0,255,143 would do.

1 Like

If you have black borders that’s because:

  • Either one or several of your images are slightly higher than the others, and the append_tiles function fill this difference of heights with black.
  • Either you already have a black border in your images.

As @Reptorian said, you may want to force the image size of each layer before applying the append_tiles command, so typing this command instead:

resize 256,145
append_tiles 4,7

This ensures all input images have exactly the same size (beware, it uses nearest-neighbor interpolation by default).

1 Like

Thanks both, that removed them

Just wanted to say that as I tested today I did with crop or resize including cropping from the Crop to Selection to ensure they are the same and I noticed it creates a lot of single layers where the top most layer image for example is put as a standalone like in the pic below and a lot of layers with single picture some of which are from the top layers. I would expect them to be also on the top.

Overall works but need to get same results they need to fill up a layer before they get single. I was following the above settings

This may happen if you try to append RGB and RGBA images together, because in that case, RGB images will get an additional channel set to 0 by the append_tiles command.
Proposed suggestion : Force all your image to be in RGB or RGBA before resizing/appending them, with command to_rgb or to_rgba.

1 Like

Finally now these are correct and I get indeed only the 4x7 layers then whatever remains tiles on the last layer. I have 145 images, so now I correctly get 5 layers with 4x7 tiles, which makes it 140 and last layer with last 5 images.

I did have some with alpha channel images and no wonder the Preview was showing a single image on alpha BG , now I add the alpha channel to all layers and when I combine, nothing seems missing.

Before that some images were duplicated as single image on a layer. last images were not included at all in the 4x7 tiles layers and were instead somewhere away as single layers.

But now all aligns, all are there, so the take is:

  • Make them exact sizes to avoid difficulties, crop to selection or resize if needed
  • Have them the same channels - RGBA ( as I prefer) or RGB - had no idea this mattered

Thanks again :slight_smile:

1 Like

That’s because append_tiles will always replace ‘missing data’ (like a missing row, column, or channel) by filling it with 0, and in the case of an alpha channel, this means adding a fully transparent alpha channel, leading to actually invisible RGBA images, if only RGB is specified.

Happy to see that everything works as expected right now :+1:

1 Like

Hi, just want to know if I have a bunch of images that I want to fill up vertically first rather than horizontally how should the command be?

Because if I make append_tiles 2,3 this starts filling up horizontally 2 times (makes 2 columns for 3 rows)

If I have images 1,2,3,4,5,6

it will do them

1 2
3 4
5 6

I want them ordered

1 4
2 5
3 6

Also can a spacing be applied to them when appended either vertically or horizontally or both when merging the images in tiles?

Maybe you could place your tiles in a different order…?

Original:
1 2 3 4 5 6

Reordered:
1 4 2 5 3 6

append_tiles 2,3

Not sure about the spacing issue though.

Well yes, as workaround I could combine them append_tiles 1,3 then merge all the 1-3’s horizontally but thought it would be nice for more automatic way if there was 100 pictures. I thought it could do the same way as it works for horizontal.

I read montage could do it there but it does it correctly for 4 pictures, for more - not. If not implemented that’s fine but would be good to have.

It would be nice to make the montage all-in-one go However a little more work for stages using gmic_gimp_qt option to use visible / non-visible layers.

You do need to set up a key shortcut for toggle layer visibility (normally deactivated)

Then it is into gmic and make two columns based on layer visibility
and then combine the columns horizontally.

A 2 minute video of that montage - Sendvid (no audio)

30 layers / two columns of 15

If you have images with different dimensions, you may want to use command montage for that:

$ gmic images*.jpg     montage "VVH0:3,H:1,4,H:2,5" -o output.jpg

montage is a quite complex command that resizes the images if necessary to render the montage.

If you want something faster and without resizing (for instance if all your images have the same size), you can do something like this:

$ gmic images*.jpg   a[0-2] y a[-3--1] y a x -o output.jpg

And if you are interested by the command montage, @patdavid wrote a quite nice article about it, years ago ! → Pat David: G'MIC Montage

I use same image sizes because I make like a sheet of the icons. Thanks for showing I will try that $ gmic images*.jpg a[0-2] y a[-3--1] y a x -o output.jpg

But yes I will have 7 columns with 3 rows, the above example seems to make it. I just need to test it.

Could someone tell me the syntax for within the Gmic interface? I go to Custom Code [Global] and how do I go?

Well, if you want a more generic command that concatenate your images, first by rows then by columns, without having to think about the image indices, you should try this trick instead:

$ gmic images*.jpg transpose append_tiles 5 transpose

Here, the value 5 means “number of images in each column”.

In the G’MIC-Qt plug-in, you can indeed use the Custom Code [Global] filter, like this:

Be sure you select “Input Layers → All” :slight_smile:

1 Like

Thank you

transpose
append_tiles 3
transpose

indeed worked , I can always add an empty layer to the column that needs to have just two in the row not 3 and then they all order as I want thanks!