Creating Animated NFTs On The Bitcoin Cash Blockchain

2 62
Avatar for MilaANFTA
3 years ago

Introduction

Non-fungible SLP token creation has become popular on the BCH blockchain, especially after the Juungle NFT marketplace opened recently. Minting NFT SLP assets on the BCH blockchain has several benefits for the creators, mainly being that they are very cost effective compared to almost all other platforms and blockchains. 

There are however, also limitations creators must accept when minting on the BCH blockchain.  The main limitations being that SLP does not currently allow for conventional smart contracts or normal types of files that most NFTs would be capable of using.  The smart contract limitations do not seem to hinder most serious creators that are ambitious about their NFT projects.  The compatible file types we can currently use in NFTs are more of a limitation in my experience as an NFT artist.

I’m certain these issues are short term and will be non-issues in the near future, as the SLP developers are working hard to develop blockchain wide capabilities that will bring us not only up to speed with, but also surpass other blockchains in token and NFT creation and capabilities. 

Right now however, NFT creators are limited to only being able to use .PNG file types when creating an NFT to sell their art.  This is not a big deal to those that have a single image they would like to include in a token, but this is a serious limitation for other creators that would like to include other things with NFTs such as animation.  Most NFT markets are filled with tokens that can include not only .PNG or .JPEG image files, but also audio files and video files such as .GIF and .MP4 file types.  These file types are not currently an option on the BCH blockchain in NFT creation, as they are not supported by the main blockchain viewing applications. 

When I first started creating SLP NFTs, I used the standard still image .PNG file as almost all creators do.  A while after I began releasing NFT art on the blockchain, I noticed that a couple of key creators were using images that consisted of a few still frames that tracked together to display a sort of animation that was able to display a couple of frames.  I only noticed 3 or 4 creators that did this, and they mostly used them in a very limited extent, usually only about 3-5 frames, in a very non fluid manner that I would not consider animation.  This intrigued me so I began to look in to it further. 

I soon realized something that was new to me.  The .PNG file type can include a .PNG file that is assembled from multiple .PNG still images.  This is known as an animated PNG or APNG.  The end result though is a file that still is a .PNG file type.  To create an animated .PNG file, you must use some kind of software assembler to merge the multiple still .PNG images into a single .PNG file. 

I did just a little research and was soon on my way to creating my first animated .PNG File to include in my NFTs.  I didn’t understand why hardly anyone was doing this, and why the few creators that were assembling animated .PNG files, were only doing it with 3-5 frames in a very non fluid manner that was not visually appealing in terms of conventional animation. 

Considerations

Well, I soon figured out why.  My first animation I created using .PNG animation was 7 seconds long and 1000×1000 pixels in size.  I had been used to using large single images in my NFT art so that is where I started.  I ended up with an animated .PNG file that consisted of 210 frames and was a whopping 220 MB in size!  It worked.  But it was a ridiculously huge file.  Difficult to upload and such a huge file to download that nobody would want to sit and wait for over 200 MB to load just to view some token art.  It was not practical at all. 

So I began doing some testing.  It took me 2 weeks to come up with a standard that I could recreate adequately to use in a consistent manner for NFT animation.  I had to find the perfect balance of image resolution vs. the time length of the animation.  I also had to deal with issues of animation fluidity and how many frames per second I was happy working with.  This also affected the overall file size and length of play. 

So the main factors in animated .PNG creation are image resolution, frames per second, and length of play.  And these factors together determine the overall file size, which is the most crucial factor. 

After 2 weeks, I came up with the standard that I am currently using and am happy with.  The standard is this…

I can make a 2-3 second clip of animation that plays fluidly at 30 frames per second, with an image resolution of 300×300 pixels, that has a total file size of around 4-7 MB.  My goal is always 5 MB total file size. 

I find that 5 MB is just the right file size.  It does not take too long to load.  Any larger and its download time would be noticeable on most networks, and a delay on many.  5 MB seems to take a slight delay to load, but not long enough to be considered hindering or annoying, and often not even noticeable.  Its also important to consider the size of caching on the servers involved.  There has been no real standard or protocol about that at this point, but nobody is going to want files much larger cached on their servers. 

I find that 300×300 pixels is a good working size.  Yes it’s small.  But it’s not too small.  Most of my work is done on a PC.  300×300 is not very big, but it’s big enough to adequately see the animation.  Any smaller and it causes a visual problem in picking out detail.  One good factor is that many people are on mobile devices which have much smaller screens where 300×300 is a completely normal size and they don’t even notice that it’s small. 

I find that 2-3 seconds is adequate for a simple animation loop or sequence.  I try to loop it seamlessly when I can.  That’s not always the case, but a lot can be done with animation in 2-3 seconds. 

I prefer to use a frame rate of 30 frames per second.  That means for 1 second of animation, you will need to assemble 30 sequence still frames.  30 frames a second allows for a very fluid animation.  You can cut a corner here by reducing it to 24 fps if you need to, to save a little size.  I’ve also become accustomed to putting a 1/20th of a second delay between each frame. Doing so allows you to slow the animation ever so slightly and stretch it out for an additional second overall without it losing its fluidity, increasing the file size, or becoming sluggish or jittery. 

All of my animated NFT tokens using .PNG file types exclusively use a resolution of 300×300 pixels, run for 2-3 seconds, have a frame rate of 30 fps (with a 1/20th second delay) and average 5 MB in overall finished size.  I am very happy with this combination.  It took me a long time to reach this conclusion and to be happy with the results.  I will not change these parameters as long as I am using animated .PNG files.  

Another important factor is file compression.  You need to adequately compress the files without compressing them in a manner where overall quality is compromised.  I am usually able to reduce animation many MB during my multiple compression phases.  I will detail the process below. 

How I Do IT-My Process

The first step is to create your animation.  Even though the end result will be a much smaller resolution, I suggest creating your animation on larger canvas.  I find that when working with NFT art, its best to use a square canvas.  For simplicity, I use a canvas workspace of 1000×1000 pixels.  I generally work in Adobe After Effects and Adobe Photoshop.  I set the initial canvas workspace the same 1000×1000 for both.  I also suggest creating a longer animation than what you plan on ending up with.  Then take a selection from within that animation to make the finalized NFT art from

No matter what software I’m creating animation in, I always finish with Photoshop.  If you are using sophisticated video software like After Effects or something similar, I find that I get the best results by exporting the highest quality .AVI/MP4 file possible.  I don’t worry about compression or size factors at this phase.

The first thing I do after rendering the highest quality AVI/MP4 possible, to drop it in to Photoshop and create a GIF.  Do this by “EXPORT-SAVE FOR WEB LEGACY.”  This will bring up the options for exporting a GIF.  I use all the highest quality GIF settings at this point.  But this is where I change the resolution to my desired finished NFT size.

Sometimes I create animation directly in photoshop.  Either way, Photoshop is my choice for finalizing my animation.  I can import  the GIF file I’ve created back into Photoshop with ease.  Once you have your finalized animation GIF in Photoshop, (or have your Photoshop created project ready) you want to export a .PNG image sequence.  You can do this in Photoshop by selecting “FILE-EXPORT-RENDER VIDEO”.  When the export screen comes up, you want to change “Adobe Media Encoder” to “Photoshop Image Sequence.”  Change the format to “PNG.”  You also want to select “Smallest File Size” in the settings.  This will be your next form of compression. Change the Alpha Channel to “Straight Unmatted.”  Also, be aware of the “Range” options.  Either select the entire work to export, or the workspace to export, which can be set in your compositions previous Photoshop timeline.  This is where I select my specific 2-3 seconds of final animation.  Make sure to have the destination path pointed to a folder somewhere and not just your desktop because you are going to be exporting many still images.  Then click “Export.”

Next, go to the folder that you exported to.  There should be a still frame .PNG image for every frame of in the animation sequence.  Now you want to use a quality compression tool to compress these images again.  I use “PNGGauntlet.  I just drag all the image files in and click compress.  You will need to make another folder to export to or else overwrite the existing files.  Don’t get the pre compressed files mixed with the post compressed ones.  PNGGauntlet is a free software that you can download here…  https://pnggauntlet.com/

Next, I use a animated .PNG assembler tool called “apngasm_gui-2.91.”  It’s a free software that turns all the individual .PNG files in to 1 final .PNG file.  You can download it here… https://sourceforge.net/projects/apngasm/files/latest/download

Drop your bulk .PNG files in and set the playback settings to “loop indefinitely.”  I also suggest to tick the “Skip the first frame” setting. I put the compression settings at 7zip with 15 iterations. This is where I also set the “delay all frames” setting to 1/20th of a second.  Then click “Make APNG File.”  The file will export to the folder where the image sequence was.  

Now you have a single animated .PNG file.  Next, I run this file though “apngopt_gui,” which is a companion tool to apngasm_gui.  You can download it for free here…  https://sourceforge.net/projects/apng/files/APNG_Optimizer/1.0/ .  It’s pretty simple and has no settings.  Just run the animated .PNG file you just created though it and it will export a new one to the same folder the original one came from.  This is your finished animated .PNG file.  You can view the animated file by just dropping it in a web browser like Chrome or Fire Fox. 

When uploading your images to use in tokens, you want to put the animated .PNG file in the “original” folder.  In the 32, 64, and 128 folders just take one of the image sequence still photos and resize it to the correct size.  You don’t want to resize the actual animated .PNG file for the smaller image folders. 

5
$ 0.50
$ 0.50 from @Mr_Trenzs
Avatar for MilaANFTA
3 years ago

Comments

Thank you Mila for sharing the process!

$ 0.00
3 years ago

You are very welcome!

$ 0.01
3 years ago