It is currently Mon Apr 15, 2024 7:39 am


All times are UTC - 5 hours [ DST ]



Post new topic Reply to topic  [ 32 posts ]  Go to page 1, 2  Next
Author Message
 Post subject: Tool, to join a "Map", divided into many parts?
PostPosted: Mon Apr 17, 2017 7:33 am  (#1) 
Offline
GimpChat Member
User avatar

Joined: Apr 17, 2017
Posts: 19
Hello everyone!

I have a "Map" of a game, divided into many pieces, and I would like to know, if there any tool or plugin, to rejoin the whole map.
(Too many images, to do it manually).

All parts of the "Map" are numbered:
The first number is the "Column", and the second number is the "Row"

I attached an image to see if it helps me explain.


Thank you very much to all, greetings


Attachments:
File comment: Example image
Columns&Rows.png
Columns&Rows.png [ 53.98 KiB | Viewed 2640 times ]
Share on Facebook Share on Twitter Share on Orkut Share on Digg Share on MySpace Share on Delicious Share on Technorati
Top
 Post subject: Re: Tool, to join a "Map", divided into many parts?
PostPosted: Mon Apr 17, 2017 8:29 am  (#2) 
Offline
GimpChat Member
User avatar

Joined: May 16, 2010
Posts: 14709
Location: USA
Hi Ray. Welcome to the Gimp Chat website. =)

Not sure if that can be accomplished in GIMP with scripts.

_________________
Image
Edmund Burke nailed it when he said, "The only thing necessary for the triumph of evil is for good men to do nothing."


Top
 Post subject: Re: Tool, to join a "Map", divided into many parts?
PostPosted: Mon Apr 17, 2017 8:38 am  (#3) 
Offline
GimpChat Member
User avatar

Joined: Jun 06, 2016
Posts: 1033
How many pieces and are the pieces all the exact same size?


Top
 Post subject: Re: Tool, to join a "Map", divided into many parts?
PostPosted: Mon Apr 17, 2017 9:23 am  (#4) 
Offline
GimpChat Member
User avatar

Joined: Apr 17, 2017
Posts: 19
Hello Rod, Thanks for the welcome :)

I do not know, make a script, or plugins but, I think I have an idea ... I just need someone to run it!

---

Hi animicule!

Are 1024 pieces, all measure the same (512x512px), so would be:
32 pieces high
32 pieces wide
And the size of the map is considerable: 16384x16384px!


Top
 Post subject: Re: Tool, to join a "Map", divided into many parts?
PostPosted: Mon Apr 17, 2017 2:02 pm  (#5) 
Online
Script Coder
User avatar

Joined: Oct 25, 2010
Posts: 4734
Look for scripts to handle "sprite sheets".

_________________
Image


Top
 Post subject: Re: Tool, to join a "Map", divided into many parts?
PostPosted: Mon Apr 17, 2017 2:52 pm  (#6) 
Offline
GimpChat Member
User avatar

Joined: Apr 17, 2017
Posts: 19
Hello ofnuts!
I already tried it, very good indeed, and I remember that it served to cut, I hope it serves to rejoin :) Thank you really!

After I comment, how was I!


EDIT
-----

Okay, I already did some tests, unsatisfactory!

Sprite Sheet:
You have no options, of any kind.

Even so, I did a test with a complete "column"; From 0x0 to 0x31,
What made "Sprite Sheet" below, is to create a "row"! (First failure).

In theory, would it serve Sprite Sheet, for this purpose? Yes!
But it is too cumbersome, in case of being many images,
Since you should select 32 images at a time, and trying to know which layer order to choose!

Then find another similar program :)

Texture Atlas:
This one has options, although I do not understand them at all, but still try to do a test .... this gives you the option to select the folder of textures, to create the "Atlas", I did the test, and the program failure!

Maybe they were too many images, because instead of trying again with the 1024 images, probe only with 32, as with the "Sprite Sheet", but returned to failure ...

I think the best would be to create a plugin, but I do not have the ability.

I hope someone is encouraged, that in the future can serve someone :)


Top
 Post subject: Re: Tool, to join a "Map", divided into many parts?
PostPosted: Mon Apr 17, 2017 6:45 pm  (#7) 
Online
Script Coder
User avatar

Joined: Oct 25, 2010
Posts: 4734
When using File>Open as layers you can select several files at once, so loading all your images is a snap. IIRC the layers are stacked in alphabetical order.

_________________
Image


Top
 Post subject: Re: Tool, to join a "Map", divided into many parts?
PostPosted: Tue Apr 18, 2017 4:47 am  (#8) 
Offline
GimpChat Member

Joined: Mar 04, 2011
Posts: 2418
Not Gimp & not so easy for a Windows user, but you can use ImageMagick command line.

It all depends on generating a suitable file list (a text file). The numbered files you get out of Gimp will probably be ordered in columns while ordered in rows will be needed.

This using your 4x4 image, 32x32 will take a bit of editing for the text file.

Image

rotate the tiles 90 anticlockwise to set up for joining in rows
mogrify -rotate 270 *.png


Feed the images using the file list into montage using the tile size and the grid to assemble a new image
montage @col.txt -geometry 255x255+4+4 new.png


Rotate the result back to correct orientation
mogrify -rotate 90 new.png

_________________
Image


Top
 Post subject: Re: Tool, to join a "Map", divided into many parts?
PostPosted: Tue Apr 18, 2017 5:40 am  (#9) 
Offline
GimpChat Member
User avatar

Joined: Apr 17, 2017
Posts: 19
Hi, Ofnuts
I do not understand, very well referred to, "IIRC", is not a program, right?
Cursed is this translator, maintaining a fluid translation becomes a hell!
That's why I apologize and be patient with me! :)

------------------------------------------------------

Hi, rich2005

It's a shame, other than "Gimp", but I'll try, although I think I've come up with a solution, but I have not tried it.

Even so, you have done a satisfactory test with "Image Magic" right?
I will take it as a last resort :), thank you very much!

---------------------------------------------------------

This is what I found by reviewing RegistryGimp;

You can change to vertical sprite sheet by opening the "SpriteSheet.scm" and editing the following lines:

Line 7: Change (imgw 0) to (imgh 0)
Line 10: Change (xoff 0) to (yoff 0)
Line 16: Change (set! imgw (car (gimp-image-width anImage))) to (set! imgh (car (gimp-image-height anImage)))
Line 20: Change (gimp-layer-translate layr xoff 0) to (gimp-layer-translate layr 0 yoff)
Line 21: Change (set! xoff (+ imgw xoff)) to (set! yoff (+ imgh yoff))

Hopefully no typos, haven't tested this.


Vertical SpriteSheet
You can try Fuse Layers script:
1 on X axis gives you vertical sprite-sheet, n=#layers - horizontal.


Top
 Post subject: Re: Tool, to join a "Map", divided into many parts?
PostPosted: Tue Apr 18, 2017 8:34 am  (#10) 
Offline
Script Coder
User avatar

Joined: Jun 22, 2010
Posts: 1171
Location: Here and there
Ray, how are your images named?

Is position column 0, row 0 named image_00_00.png for example?

Or are they just sequential numbers?


Top
 Post subject: Re: Tool, to join a "Map", divided into many parts?
PostPosted: Tue Apr 18, 2017 8:47 am  (#11) 
Offline
GimpChat Member
User avatar

Joined: Apr 17, 2017
Posts: 19
Hello paynekj
Exactly, as seen in my example image, that is at the beginning of the post!

The images are configured as follows:
Map_Terrain_0x0 (the first 0 is a column, and the second is a row!
Map_Terrain_0x1
Map_Terrain_0x2
Etc etc up to:
Map_Terrain_0x31
All these go in the first column, the following would be:
Map_Terrain_1x0

I hope I can understand my way of explaining! :)

Imagen names order:
Attachment:
File comment: Example Image!
MapColumns.png
MapColumns.png [ 119.79 KiB | Viewed 1189 times ]


Top
 Post subject: Re: Tool, to join a "Map", divided into many parts?
PostPosted: Tue Apr 18, 2017 12:57 pm  (#12) 
Online
Script Coder
User avatar

Joined: Oct 25, 2010
Posts: 4734
Ray wrote:
Hi, Ofnuts
I do not understand, very well referred to, "IIRC", is not a program, right?
Cursed is this translator, maintaining a fluid translation becomes a hell!
That's why I apologize and be patient with me! :)


http://onlineslangdictionary.com/meanin ... on-of/iirc

_________________
Image


Top
 Post subject: Re: Tool, to join a "Map", divided into many parts?
PostPosted: Tue Apr 18, 2017 1:48 pm  (#13) 
Offline
GimpChat Member
User avatar

Joined: Apr 17, 2017
Posts: 19
Ofnuts, the next one and know that it is "IIRC"! :bigthup


EDIT

If someone understands code, and helps me modify the "Fuse_Layer.scm"
And change the writing of: X to Y, it would be something even to do a test!

;; How to use:
;; Open the image with all the layers, run this script on the image, then
;; select how many frames you want on the X axis

( define
    ( script-fu-fuse-layers orig_img drawable x_layers )

;;    ( gimp-context-push )
;;    ( gimp-image-undo-freeze orig_img )

    ( let*
        (
            ( layers ( gimp-image-get-layers orig_img ) )
            ( num_layers ( car layers ) )
            ( layer_array ( cadr layers ) )
            ( bottom_layer ( aref layer_array ( - num_layers 1 ) ) )

            ;; The actual X and Y size used for the layers are based on the
            ;; first layer
            ( orig_layer_w ( car ( gimp-drawable-width bottom_layer ) ) )
            ( orig_layer_h ( car ( gimp-drawable-height bottom_layer ) ) )
            ( image_w ( * x_layers orig_layer_w ) )
            ( y_layers( ceiling ( / num_layers x_layers ) ) )
            ( image_h ( * y_layers orig_layer_h ) )
            ( start_x ( / ( + ( - 0 image_w ) orig_layer_w ) 2 ) )
            ( start_y ( / ( + ( - 0 image_h ) orig_layer_h ) 2 ) )
            ( i ( - num_layers 1 ) ) ; Start from the bottom layer

            ;; Create image
            ( new_img ( car ( gimp-image-new image_w image_h RGB ) ) )

            ( new_layer
                ( car
                    ( gimp-layer-new
                        new_img
                        image_w
                        image_h
                        RGBA-IMAGE
                        "fused layer"
                        100
                        NORMAL-MODE
                    )
                )
            )
        )

        ( gimp-image-undo-disable new_img )
        ( gimp-image-add-layer new_img new_layer 0 )

        ( gimp-rect-select
            orig_img
            0
            0
            orig_layer_w
            orig_layer_h
            CHANNEL-OP-REPLACE
            FALSE
            0
        )

        ;; Loop over layers to copy & paste contents
        ( while( >= i 0 )
            ( let*
                (
                    ( curr_layer ( aref layer_array i ) )
                    ( float 0 )
                    ( x 0 )
                    ( y 0 )
                )
;                ( gimp-message ( number->string curr_layer ) )
                ( gimp-edit-copy curr_layer )
                ( set! float
                   ( car ( gimp-edit-paste new_layer FALSE ) )
                )
                ( set! x
                    ( + ( * orig_layer_w ( modulo i x_layers ) ) start_x )
                )
                ( set! y
                    ( + ( * orig_layer_h ( quotient i x_layers ) ) start_y )
                )
                ( gimp-layer-translate float y x )
                ( gimp-floating-sel-anchor float )
            )

            ( set! i ( - i 1 ) )
        ) 

        ( gimp-image-undo-enable new_img )
        ( gimp-image-clean-all new_img)
        ( gimp-display-new new_img )
    )

    ( gimp-image-undo-thaw orig_img )
;;    ( gimp-context-pop )
    ( gimp-displays-flush )
)

( script-fu-register
  "script-fu-fuse-layers"
  "Fuse layers"
  "Creates a new images with a copy of the \
contents of all the layers, side by side, \
in a single layer."
  "Eduardo Hernàndez"
  "Copyright 2011, Eduardo Hernàndez"
  "February 16, 2011"
  ""
  SF-IMAGE    "Image"                0
  SF-DRAWABLE "Drawable"             0
  SF-VALUE    "Layers on the X axis" "1"
)
( script-fu-menu-register "script-fu-fuse-layers" "<Image>/Filters/Combine" )


I'm very sorry for the insistence, but I've been missing more than once!
Maybe this is the last ...


Top
 Post subject: Re: Tool, to join a "Map", divided into many parts?
PostPosted: Wed Apr 19, 2017 8:20 am  (#14) 
Offline
GimpChat Member
User avatar

Joined: May 16, 2010
Posts: 14709
Location: USA
Someone may be able to re write it so it begins a new row of layers after x = amount of tiles per row.
Have you contacted the author of this script?

_________________
Image
Edmund Burke nailed it when he said, "The only thing necessary for the triumph of evil is for good men to do nothing."


Top
 Post subject: Re: Tool, to join a "Map", divided into many parts?
PostPosted: Wed Apr 19, 2017 8:27 am  (#15) 
Offline
Script Coder
User avatar

Joined: Jun 22, 2010
Posts: 1171
Location: Here and there
So far today I've written some Python to detect the files and load them as layers, positioned correctly:
Attachment:
Untitled.png
Untitled.png [ 753.09 KiB | Viewed 1148 times ]


Some more tidying to do yet.

Kevin


Top
 Post subject: Re: Tool, to join a "Map", divided into many parts?
PostPosted: Wed Apr 19, 2017 8:43 am  (#16) 
Offline
GimpChat Member
User avatar

Joined: Apr 17, 2017
Posts: 19
Hi Rod!
Is that in the script appear several names, somebody called Brian, and someone named Eduardo Hernandez!

I do not know, who will be the publisher, if anyone copies part of the code ...
That's why I did not!
-----------------------

Hi paynekj!
That's what I think? really?
Good heavens, it seems like a lot of work :)

Although, I recommend using "Fuse_Layer", and change only where you type in "X", with that change already the script, works perfectly!

Although, if you are doing what I think, are more possibilities, ie: to choose in which address to write, it would be very good for any type of map :)

I really want to try it with this map!


Top
 Post subject: Re: Tool, to join a "Map", divided into many parts?
PostPosted: Wed Apr 19, 2017 9:21 am  (#17) 
Offline
Script Coder
User avatar

Joined: Jun 22, 2010
Posts: 1171
Location: Here and there
OK here's my badly written Python plug-in

I don't know what will happen with your 32x32 tiles, good luck ;)

It doesn't save the resulting image when it is finished, so it is your problem to do so.

Extract the .py file from the zip archive and put it into your personal plug-ins directory.

It registers into the menus at contributed>>Build Map from tiles


Attachments:
build_map.zip [1.25 KiB]
Downloaded 75 times
Top
 Post subject: Re: Tool, to join a "Map", divided into many parts?
PostPosted: Wed Apr 19, 2017 10:59 am  (#18) 
Offline
GimpChat Member
User avatar

Joined: Apr 17, 2017
Posts: 19
Hello paynekj!
I've tried the "Plugin", and I'm getting this:

An error ocurred running Python_fu_kp24_build_mad
- ValueError: invalid literal for int () with base 10: ''

More Information:
Traceback (most recent call last):
   File "C: \ Program Files \ GIMP 2 \ 32 \ lib \ gimp \ 2.0 \ python \ gimpfu.py", line 736, in response
     Dialog.res = run_script (params)
   File "C: \ Program Files \ GIMP 2 \ 32 \ lib \ gimp \ 2.0 \ python \ gimpfu.py", line 361, in run_script
     Return apply (function, params)
   File "C: \ Program Files \ GIMP 2 \ lib \ gimp \ 2.0 \ plugins \ build_map.py", line 24, in build_map
     Col_num = int (column_row [0])
ValueError: invalid literal for int () with base 10: ''

I really do not know what happened :(


Top
 Post subject: Re: Tool, to join a "Map", divided into many parts?
PostPosted: Wed Apr 19, 2017 11:10 am  (#19) 
Offline
Script Coder
User avatar

Joined: Jun 22, 2010
Posts: 1171
Location: Here and there
I can get that error if I have a file named: Map_Terrain_x.png (or Map_Terrain_axb.png) which is missing the row/column numbers.

You must ensure you only have files that include numerical row/column numbers


Top
 Post subject: Re: Tool, to join a "Map", divided into many parts?
PostPosted: Wed Apr 19, 2017 11:43 am  (#20) 
Offline
GimpChat Member
User avatar

Joined: Jan 06, 2017
Posts: 204
Well, I can happily tell you it seems to work just fine, although I only used 90 x 90 px blocks of colour - the plug-in did it's job and arranged them properly (and pretty quickly too!)
Well done that man :)
Here is what the folder of original tiles looked like followed by the resulting image.
Image

Image


Top
Post new topic Reply to topic  [ 32 posts ]  Go to page 1, 2  Next

All times are UTC - 5 hours [ DST ]


   Similar Topics   Replies 
No new posts Attachment(s) Darkening specific parts of a photo

10

No new posts Join the fun

0

No new posts Attachment(s) I should maybe join some other chat groups

3

No new posts Attachment(s) Purple Play (Please join in for our purple moderator)

58

No new posts clone tool

0



* Login  



Powered by phpBB3 © phpBB Group