News:

Simutrans Chat Room
Where cool people of Simutrans can meet up.

Combining PNG images

Started by Andyh, July 28, 2020, 03:48:18 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Andyh

I'm looking for some advice for an efficient way of combining a series of PNG images into a single image for the purpose of creating a PAK file.  It seems like this should be an easy task but I can't for the life of me figure how to do it.


I have a series of 8 separate images of a vehicle from all the required angles.  However, in every vehicle I've ever downloaded, the source images have been combined into a single neat, tiled PNG image.  I'm sure I could create such an image with a lot of messing around with layers and so forth in the GIMP, but I would like to be able to be able to do so quickly, repeatedly and reliably as I'm sure I'll need to go through multiple iterations of the PAK creation process to get everything right.  Does anyone know how to do this?  I feel that I must be missing something.

wlindley

You could use ImageMagick — if you're on any common Linux distribution, the commands 'convert' 'mogrify' and 'montage' should already be available and you can follow instructions at this article.  Otherwise, install the free ImageMagick program

Use 'convert' with either '-append' or '+append' for a row or column of images in one file.  Use 'montage' for a matrix.

If you have a script that builds your PNG images, append whatever command you wind up using (convert or montage) for automatic creation.

Leartin

That neat image file with several graphics on it is called a "spritesheet", or at least that's the term you should be looking for. Eg. https://codeshack.io/images-sprite-sheet-generator/ <-- online, drag single images in, get one spritesheet out.

Once you google "spritesheet generator", you'll find many tools for that task to download as well. Texturepacker or SpriteSheetPacker, for example.
I don't personally use any of these tools though, so I can't speak from experience.


Sirius

The hints are good, but I'd like to show up a different angle.

In pak128.Britain-Ex, it seems quite common to render images in blender and leaving those as-is, that means split into different images.
Though, old images seem to be merged into a single one.

If you want to organise things, you may just create one folder per vehicle and put the images in there rather than merging them into a single png.
Not saying merging images is bad practice or something, it's up to you what you prefer, except if you are contribiuting to a pakset which strictly prefers a specific way, for sure.

Andyh

Thank you all for your ideas.  I use the Blender render script, and since it seems to be acceptable practice in the community I'm actually leaning towards Freahk's solution of not combining the images.  I would be happy not to have to do that extra step, but since it seemed so universal I thought I must be doing something wrong.

Sirius

Well pak128.britain-ex's new workflow does not involve combining those. It's as simple as "render it and you're done"

I have no idea about other paksets though.

Leartin

Quote from: Freahk on July 28, 2020, 08:25:15 PM
I have no idea about other paksets though.
In Non-render paksets, you'd work on the images directly. Anything you add in one rotation, you'd have to add in all other rotations, and it would be quite a hassle if everything was seperated.
Older render images had to do cleanup of the edges, since semitransparency wasn't a thing. Since you had to start up 2D software and open all images anyway, merging wasn't weird. But if you don't need to touch the output anymore, sticking them in a folder and never looking at them is fine.

Ronin1996

What I do is grab a file off of the Pak.whatever-your-using github page and use that as a template. I then keep the template for further use. It makes things so much simpler later on. For example, I am redoing my snowy roads on my Pak256.America-Ex. I am using my dirt road blender file as a basis and then later just replace the dirt road with something else like cobblestone.