1

Topic: ImageMagick skin creator

A couple of days ago i started working on a batch script to automatically create skins by just adding three images (fot.png, kropp.png and hand.png) in a folder.
The script runs ImageMagick to remove borders, resize, and place them correctly in the output file. It looks good when i check it, but TeeWorlds won't open it.
I tried opening it in Photoshop and when i export it as .png it works fine, but i want to automate the whole process. I also tried setting metadata that was in the PS-file but not in the IM-file, but then it will just show up as a black-and-white copy of the previous skin.
Does anybody know how to make this work?

Code:
http://pastebin.com/vvwe4Z0M
conv = convert.exe, ImageMagick
comp = composite.exe ImageMagick
(available in the ImageMagick portable edition, for installed the names must be changed to "convert" and "composite")

2

Re: ImageMagick skin creator

I posted the script below here and here a while back.  I never tested it as I can't get 0.7 to work but maybe you could pull some things from my script?  If you place this script in your skin folder and run it, it will check to see if you have the folders necessary for 0.7 skins create them if you don't. run through all the skins in that folder cut them apart and add them to their designated folder.  I commented out the delete skin method so you can test it over and over. Once you get it working if you want just uncomment the #deleteSkin at the bottom of the page.

android272 wrote:

I have seen youtube and in forms that the new skin system will DESTROY!!!!!!!!!!! TEEWORLDS because all the old skins will no longer work in the new version.  When I first saw this I thought dude its not that bad just crop out your skin into the folders.  Then I thought about how many skins there are for Teeworlds, how some people might just download the skins and not be able to do this, and how lazy we can get.  So I made the script below. 

All you have to do is place this script into the skin folder, make sure it is set as exhaustible and run it.  It will check to see if you have the folders needed for the new system and if you don't will create them for you. Then it will loop through all the .pngs in the skin folder copy them to the various folders, crop, rearrange the skin, save them, and make you a skin.skn file in your skin folder.  The developers will need to help with the skin.skn file as I did not know what to put for _hue, _sat, _lgt, _alp to not mess with the skin.

the only thing you need to do now is modify the eyes.  If your skin does not use the standard eyes then you need to modify them so that both eyes are in the one tile as the new system does not duplicate and flip them. If your skin does use the standard eyes then you will have to modify the skin.skn file and replace the last skin.png with standard.png.

I did write the lines to delete the old skin but I figured some might want to keep the old files for later.  If you want to delete the old skin then take away the '#' from '#deleteSkin

#!/bin/bash
checkEnv () {
    if test ! -d "./body"; then
          mkdir body
    fi

    if test ! -d "./tattoo"; then
          mkdir tattoo
    fi

    if test ! -d "./decoration"; then
          mkdir decoration
    fi   

    if test ! -d "./hands"; then
          mkdir hands
    fi

    if test ! -d "./feet"; then
          mkdir feet
    fi

    if test ! -d "./eyes"; then
          mkdir eyes
    fi   
}

stripBody() {
    cp $f "./body"

    cd "./body"

    convert $f -crop 96x96+0+0 output.png
    convert $f -crop 96x96+96+0 output2.png

    montage -geometry +1+1 output2.png output.png -background none output3.png

    mogrify -extent 384x96+0+0 -background none output3.png
   
    cp output3.png $f

    rm output.png output2.png output3.png

    cd ..
}

stripEyes() {
    cp $f "./eyes"

    cd "./eyes"

    convert $f -crop 576x32+64+96 output.png

    cp output.png $f

    rm output.png

    cd ..
}

stripFeet() {
    cp $f "./feet"

    cd "./feet"

    convert $f -crop 64x64+192+32 output.png

    cp output.png $f

    rm output.png

    cd ..
}

stripHands() {
    cp $f "./hands"

    cd "./hands"

    convert $f -crop 64x32+192+0 output.png

    cp output.png $f

    rm output.png

    cd ..
}

createSkin() {
    name=$(echo $f | cut -f 1 -d '.')
    touch "$name.skn"

    echo "($f, body_hue, body_sat, body_lgt,
        $f, tatto_hue, tattoo_sat, tattoo_lgt, tattoo_alp
        $f, decoration_hue, decoration_sat, decoration_lgt,
        $f, hands_hue, hands_sat, hands_lgt,
        $f, feet_hue, feet_sat, feet_lgt,
        $f, eyes_hue, eyes_sat, eyes_lgt)" >> $name.skn
}

deletSkin() {
    rm $f
}

checkEnv

for f in *.png; do
    stripBody
    stripEyes
    stripFeet
    stripHands
    createSkin
    #deletSkin
done

Jesus is my Lord and Savior. Praise be unto God for giving us a way to live with him.

Check out my DeviantArt for all my TeeWorlds art and ideas for Teeoworlds

3

Re: ImageMagick skin creator

I am actually still running 0.6.x and want to get that to work first, since we are a small group of people running a LAN, and already have a modified version of the client with logos and so on.
I might actually test 0.7 to see if it works and go over to that, but for now 0.6.2 is our priority.
Thanks for the script though, I will look through it to see if there is anything more effective than what i have used (which there seems to be).

4 (edited by [pieLover] 2015-12-15 17:35:31)

Re: ImageMagick skin creator

i believe the issue is the color bitdepth or bpp or something, same issue happens with editing teeworlds images in GIMP (on default configuration)
edit: https://www.teeworlds.com/forum/viewtop … 38#p112138

Clan: Riot (I'm one of three leaders: Mile, Deku, pie)
Host teeworlds maps on a fng/ctf/dm/ddrace server for testing:http://riotproductions.tk/teewo/ broken-need reinstall nginx http://riotproductions.tk/bounce?whatEven, Teeworlds NA Discord chat

5

Re: ImageMagick skin creator

pielover88888 wrote:

i believe the issue is the color bitdepth or bpp or something, same issue happens with editing teeworlds images in GIMP (on default configuration)
edit: https://www.teeworlds.com/forum/viewtop … 38#p112138

that makes since because I belive GIMP uses ImageMagick to do some of their operations.

Jesus is my Lord and Savior. Praise be unto God for giving us a way to live with him.

Check out my DeviantArt for all my TeeWorlds art and ideas for Teeoworlds

6

Re: ImageMagick skin creator

After a long time of not having any spare time to work on this I have now got back to it.
When looking closer i can see that ImageMagick outputs 32-bit images, but they are about 9kB while the Photoshop ones are about 23kB.
I can't find any difference in the image data besides with convert -compare of the files that outputs a faded version of the image