Decentralized Avatars

A project log for Metaverse Lab

Experiments with Decentralized VR/AR Infrastructure, Neural Networks, and 3D Internet.

alusion 10/13/2016 at 22:250 Comments

Imgur to Avatar Translator

The next tool I want to share will make generating custom avatars a breeze, seamlessly converting imgur albums into wearable avatars. It uses imgur to host texture files that are generated based on a given template. The userid.txt file is where information for your avatar is stored in and can be found in ~/Documents/janusvr/appdata/userid.txt on Windows and ~/.local/share/janusvr/userid.txt on Linux.

The next script requires API keys (simply register on Imgur and go to settings -> applications, insert on line 12-13) and imgurpython ($ pip install imgurpython)

For every object file in the directory, generate an avatar file using the Interplanetary Filesystem.

# Requires IPFS (
hash=`ipfs add -wq *.obj *.mtl | tail -n1`
for filename in $(ls *.obj)
cat << EOF > ${filename%.*}.txt
<AssetObject id="body" mtl="$hash/${filename%.*}.mtl" src="$hash/${filename%.*}.obj" />
<AssetObject id="head" mtl="" src="" />
<Ghost id="${filename%.*}" scale="1 1 1" lighting="false" body_id="body" anim_id="type" userid_pos="0 0.5 0" cull_face="none" />

The one liner version of this will output an IPFS hash that contains the userid.txt files that match the imgur filename.

python3 TYmvd; sh; ipfs add -wq *.obj *.mtl *.txt | tail -n1


If you have any issues make sure that you have all dependencies met and your API keys are in the file.

Replace the contents of your userid.txt file to change your avatar with the generated one.
Your avatar should load up SUPER fast!! ( ´・ ω ・ ` ) Enjoy your dank memes ( ´・ ω ・ ` )

/* Updates *\

The next feature that needed to be implemented is an image gallery that links to the generated avatar file. You can also tweak it to create an image gallery of the imgur album.


hash=`ipfs add -wq *.obj *.mtl *.txt | tail -n1`

echo "<html>"
echo "<body>"
echo "<ul>"
while IFS='' read -r line || [ -n "$line" ]; do
    echo "
  • $hash/${base%.*}.txt'><img src='$line'></a>"
    done < "$1" echo "</ul>" echo "</body>" echo "</html>"

    The next update I tweaked the script to print out the image names so that they can easily piped to a file and be downloaded for offline usage. The following command will convert the imgur album into avatar files that sit behind a front-end preview on IPFS:

    # Generate 3D files for Imgur and save image links to a file.
    python3 TYmvd > images.txt
    # Next, generate avatar files and front end and publish to IPFS
    sh; sh > list.html 
    ipfs add -wq *.txt *.obj *.mtl *.html | tail -n1

    Finally, I forked the script in order to translate albums into virtual reality websites based off a given template. Here's the first version for converting into a JanusWeb site:

    Converting a list of albums for Imgur

    The next thing I wanted my program to do was to convert many albums that I categorized into avatars and to also generate a front-end for easy selection. I wrote out the steps for those who wish to follow in their own lab. Improvements and suggestions are welcomed.

    The first requirement is to make a list of the imgur album tags collected in a file like this: and to save this file as albums (no extension).

    # Convert list of albums into avatars + HTML front-end for selection
    for f in $(cat albums); do mkdir $f; python3 $f > images.txt; sh && sh > list.html; ipfs add -wq *.txt *.obj *.mtl *.html | tail -n1 >> hashes; mv *.obj *.mtl *.txt *.html $f/; done

    Have a lot of albums and hashes? Here's a useful bash script for downloading a list of IPFS hashes (

    # Download list of IPFS hashes (requires IPFS)
    # Usage: sh list.txt
    while IFS='' read -r line || [[ -n "$line" ]]; do
        ipfs get $line
    done < "$1"
    I hope you found this to be useful, there'll probably be more updates on this in the near future so be sure to check back.

    *tip* 1FERzejZWrmrvNaemNcCuCTSprue97mqRG