Home Forums Game Frame Game Frame Art Gallery Converting GIFs to Game Frame BMPs

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #987
    john
    Participant

    I threw together a quick shell script to convert people’s GIFs to Game Frame BMPs:

    #!/bin/bash
    
    GIF="$1"
    
    TMPDIR=$(mktemp -d 2>/dev/null || mktemp -d -t 'gifconvert')
    
    # Get frame count for gif - last frame is n-1
    #FRAMES=$(identify -format %n "$GIF")
    
    # Pull full frames from gif
    convert "$GIF" -coalesce $TMPDIR/%d-"$GIF"
    
    montage $TMPDIR/*.gif -mode concatenate -type truecolor -tile 1x "$(echo "$GIF" | sed 's/\.[gG][iI][fF]$/\.bmp/')"
    
    ls -l "$(echo $GIF | sed 's/\.[gG][iI][fF]$/\.bmp/')"

    Depends on ImageMagick. I’m at work so I haven’t had a chance to test the results out on my frame yet. Still a lot of polish that should go into it. For example it assumes all frames have the same delay. Will add some logic to try and account for that.

    Here’s what I converted so far:

    -rw-r--r--  1 westlund2  45916   1674 Jul 23 10:22 BlueKeyCard.bmp
    -rw-r--r--  1 westlund2  45916  12426 Jul 23 10:22 Bobomb.bmp
    -rw-r--r--  1 westlund2  45916  27786 Jul 23 10:22 Boo.bmp
    -rw-r--r--  1 westlund2  45916  25482 Jul 23 10:22 BulletBill.bmp
    -rw-r--r--  1 westlund2  45916  10890 Jul 23 10:22 DoomMarineFace.bmp
    -rw-r--r--  1 westlund2  45916   4746 Jul 23 10:22 Doomhelm.bmp
    -rw-r--r--  1 westlund2  45916  22410 Jul 23 10:22 Exploder.bmp
    -rw-r--r--  1 westlund2  45916   4746 Jul 23 10:22 Floater.bmp
    -rw-r--r--  1 westlund2  45916  10122 Jul 23 10:22 Goomba.bmp
    -rw-r--r--  1 westlund2  45916   3210 Jul 23 10:22 LinkCactus.bmp
    -rw-r--r--  1 westlund2  45916   4746 Jul 23 10:22 LinkSkullBouncer.bmp
    -rw-r--r--  1 westlund2  45916   3210 Jul 23 10:22 MarioBlock.bmp
    -rw-r--r--  1 westlund2  45916  30858 Jul 23 10:22 MarioCapeGuy.bmp
    -rw-r--r--  1 westlund2  45916   6282 Jul 23 10:22 MarioCoin.bmp
    -rw-r--r--  1 westlund2  45916   6282 Jul 23 10:22 MarioCoin2.bmp
    -rw-r--r--  1 westlund2  45916   3210 Jul 23 10:22 MarioShell.bmp
    -rw-r--r--  1 westlund2  45916   7818 Jul 23 10:25 Space-Invader.bmp
    -rw-r--r--  1 westlund2  45916   6282 Jul 23 10:22 Walker.bmp

    All appear to be under the max resolution – with MarioCapeGuy.bmp coming the closest.

    I’ve attached a couple of my first passes. I’ll report back on their functionality when I get home.

    Attachments:
    You must be logged in to view attached files.
    #992
    john
    Participant

    I couldn’t get the filmstrips working so I switched to the format that all the animations on the micro SD currently have. Updated script:

    #!/bin/bash
    
    GIF="$1"
    
    TMPDIR=$(mktemp -d 2>/dev/null || mktemp -d -t 'gifconvert')
    
    # Get frame count for gif - last frame is n-1
    #FRAMES=$(identify -format %n "$GIF")
    
    # Pull full frames from gif
    #convert "$GIF" -resize 16x16\! -coalesce -type truecolor $TMPDIR/%d.bmp
    convert "$GIF" -coalesce -type truecolor $TMPDIR/%d.bmp
    
    #montage $TMPDIR/*.gif -mode concatenate -type truecolor -tile 1x "$(echo "$GIF" | sed 's/\.[gG][iI][fF]$/\.bmp/')"
    
    mkdir "$(echo "$GIF" | sed 's/\.[gG][iI][fF]$//')"
    
    cp $TMPDIR/*bmp "$(echo "$GIF" | sed 's/\.[gG][iI][fF]$//')"
    ls -l "$(echo $GIF | sed 's/\.[gG][iI][fF]$//')"

    I’ve attached a few sets up bmp files I’ve put together so far.

    Attachments:
    You must be logged in to view attached files.
    #998
    Jeremy Williams
    Keymaster

    Nice work, John! What was the problem with the filmstrip versions? Was there an issue reading the files, or writing the correct CONFIG.INI file?

    #1004
    john
    Participant

    I think the issue might be the filename I’m using for the strip — is it just a single file named 0.bmp?

    #1006
    Jeremy Williams
    Keymaster

    Yes, for a filmstrip it’s just be a single 0.bmp (maximum x/y resolution of 32,000). If you want to attach the file you made here, I can take a look.

Viewing 5 posts - 1 through 5 (of 5 total)
  • The forum ‘Game Frame Art Gallery’ is closed to new topics and replies.