Gimp-Forum.net
Grid Rearrangement - Printable Version

+- Gimp-Forum.net (https://www.gimp-forum.net)
+-- Forum: GIMP (https://www.gimp-forum.net/Forum-GIMP)
+--- Forum: General questions (https://www.gimp-forum.net/Forum-General-questions)
+--- Thread: Grid Rearrangement (/Thread-Grid-Rearrangement)

Pages: 1 2


Grid Rearrangement - bigtino24 - 04-23-2022

Hi, I've got a kind of strange task I need to do, and I was wondering if there was a way to use GIMP to do it more efficiently. Basically, I've got a chart of images and I need to rearrange those images into a different order, only I need to do it many times and I'd like to find a way to streamline the process. As an output for one process, I get a 13x21 chart of images, and I need to select certain images from within that chart and arrange them into a 9x6 chart as an input for another process. 

For example, I'd need to take the image in Row 2 Column 6 of Chart A and put it into Row 1 Column 4 of Chart B, and I need to do that for 54 images from Chart A in order to fill Chart B. I can copy/paste individual images from Chart A to Chart B one at a time, but it takes about 15 minutes to transfer the images from Chart A to the arrangement I need in Chart B, and I've got potentially dozens of input/output charts to go through, so I was really hoping there was a way to expedite the process. Is there any sort of template I could apply to Chart A that would allow me to quickly copy the images in the selected spaces over from Chart A to selected spaces in Chart B? Both Chart A and Chart B are just .PNG images, and the Chart A and Chart B formats are identical across all of the pages I need to process.

I know this is kind of an esoteric request, and it's for work so I'll end up doing it manually one image at a time if I need to, but if anyone knows any way to complete this process quickly, I'd really appreciate it.


RE: Grid Rearrangement - PixLab - 04-23-2022

First, I cannot picture out how it can take 15 minutes to copy something from A to B in GIMP, this is very unlikely, it should take few seconds big max

Can you take a full screenshot of GIMP with chart A and chart B with the Layers dialog/stack in the screenshot (or reproduce 2 tiny charts of 4 images each opened at the same time in GIMP, if information's of your charts are not meant to be seen by us), I need to visualize what you've tried to explain.


RE: Grid Rearrangement - bigtino24 - 04-23-2022

Sorry, I didn't mean it takes 15 minutes to copy/paste one image from Chart A to Chart B - I mean it takes 15 minutes to copy/paste all 54. Let me give some screenshots to help explain.

The picture of Chart A shows a 4x4 grid of images - I've replaced the images with numbers to help conceptualize things without giving the specific images themselves. The numbers are out of order in Chart A, because that's the order the images come in when I receive them.

The picture of Chart B shows another grid of images, also replaced by numbers. On Chart B, the numbers are in order, because that's the order I need to place the images from Chart A in. I need to take the images from Chart A and arrange them in the order displayed in Chart B. So, for example, I need to take the Number 1 image in Chart A (Row 2 Column 2) and place it in the Number 1 position in Chart B (Row 1 Column 1). I'd then need to do the same for the Number 2 image in Chart A (Row 4 Column 3) and place it in the Number 2 position in Chart B (Row 1 Column 2). I'd then need to do the same for the next 52 spaces for images in Chart B, using the corresponding images from Chart A.

In reality, Chart A is a 13x21 grid of images - I just shortened it to 4x4 to help visualize what I need to do more easily. Hunting down the images from Chart A, which are scattered all over the place, and then copying/pasting them into the correct order in Chart B feels really inefficient, especially because I keep needing to look over at my reference sheet to make sure I'm getting the order correct. And if it were only one pair of charts to do, I wouldn't even bother looking for a different solution, but I have dozens of pairs of these charts to do.

The reason I'm hoping there might be some kind of solution to this is that the corresponding images are always in the same place in the two charts. So every Number 1 image on every Chart A is in the same spot, every Number 2 image in every Chart A is in the same spot, and so on. So if there's a way in which I could make a template that I could use to copy predetermined selections from Chart A and paste them into the correct locations in Chart B, in a way that would be repeatable from one pair of charts to the next, that would save me an enormous amount of time.

I know this is probably a longshot, and I'm sorry if I still didn't explain it clearly enough, but I figured I'd ask to see if there is a quick way to handle that. Thanks again for looking it over.


RE: Grid Rearrangement - tmanni - 04-23-2022

If images in Chart A are always in the same order, this task can be fully automated with a script.
Some details need to be precised:
- are the images (in the grid cells) of same size ?
- are the images positioned next to each other without padding space or is there some padding ?
- if padding, what kind: solid color ? full transparency ?
- if padding, is there the need to center each image in there respective grid cell in Chart B ?


RE: Grid Rearrangement - sallyanne - 04-23-2022

I cannot tell you how to do them all at once in gimp - only by using the plugin G'MIC and then using montage -custom - scale to make your desired X x Y.
In gimp you can use grids or guides. Looks like you have some there. Try snapping. You need to go to preferences to make this a default and  you might want the snapping distance to be more than one.
[attachment=7820]


RE: Grid Rearrangement - PixLab - 04-23-2022

OK, now  I understand.

Quote:The reason I'm hoping there might be some kind of solution to this is that the corresponding images are always in the same place in the two charts. So every Number 1 image on every Chart A is in the same spot, every Number 2 image in every Chart A is in the same spot, and so on

+1 for @tmanni as when I read your second post it was the first thing which came to my mind, especially when I read what I quoted above, the solution is a script and it will do the job in no time as an "automation".
I'm not into scrip but @tmanni, @Ofnuts, and more like them on this forum may help you, GIMP has the tools for that, but they(@tmanni or @Ofnuts) will need more info, @tmanni ask for them I'll recommend to provide them.


RE: Grid Rearrangement - rich2005 - 04-23-2022

My first thoughts on the subject: Used a few 'extras'  the main being Ofnuts guillotine plugin http://sourceforge.net/projects/gimp-tools/files/scripts/ and gimp_gmic_qt plugin http://www.gmic.eu

I am sure it is possible to script, however I am not clever enough. An old niggle of mine that Gimp does not have a simple 'macro' recording function.

This is just possibilities, after I finished it, I thought 'Why all the Guides' I only need the necessary number to enclose the required sections. Maybe parts of this are useful.

However FWIW 5 minutes 20 seconds https://youtu.be/ZxUVNilGqIk






RE: Grid Rearrangement - Ofnuts - 04-23-2022

I would use my ofn-layer-tiles script,
  • Use the script a first time to split the original image into the sub-images (you just need to give the number of columns and rows)
  • Select the tiles (leave them visible)
  • Use the script a second time to join the visible tiles (you just need to give a number of columns (or rows))



RE: Grid Rearrangement - gasMask - 04-23-2022

If the process is repeated, then Roller can do this from a preset file. The design would be to set up two Table models, one for each grid. As such, Roller could render two layer groups corresponding with the grids. The first grid could place the images using a Next image source. With the second grid, the cells would be assigned images on a Per Cell basis using the Numeric Order image source. The trick is that the images would have to be already opened in GIMP in the order of the first grid. If the grids have different scales, then layer margins can be used. The output of the eventual saved file can be switched with layer group visibility.

I published Roller 3.20 yesterday. Unfortunately the file is too large to add as an attachment, so I provide a link:
on gimplearn.net


RE: Grid Rearrangement - bigtino24 - 04-23-2022

Thank you all so much! There are a ton of great ideas here. I was dreading the amount of tedium that awaited me in work on Monday, and you all may have saved me from that. I'm going to start with Ofnuts's script and go from there if I need to.

Again, this was a huge help - thank you!