🧙♂️Recursive Images on Bitcoin
Piece together a large on-chain image with recursion by billyrestey
Last updated
Piece together a large on-chain image with recursion by billyrestey
Last updated
Recursion is simply the process of referencing other inscriptions within an inscription (inception, innit) This is achieved with the "/content/" tag which looks like this:
My first experiment: metablocks (400 inscriptions) file size: 6.19mb dimensions: 16,000 x 16,000 pixels: 256,000,000
I used Photoshop's slice tool to right-click and select "Divide Slice".
For this example, we divided a 4096 x 4096 image into 4 pieces (2 x 2 grid).
You can also use GIMP to slice the artwork (free image editing software).
Click File>Export>Save for Web (Legacy) and "Save.." your images as JPEGs (it will batch export them). We suggest using around 70 quality, unless you plan to convert to WEBP, then use 100 before compressing further. View the exported pieces at 100% resolution and make sure you are happy with the balance between quality and file size. WEBP files are 30% smaller than JPEGs and can look great!
When it comes to inscribing data, the cost is constantly in flux between the fee rate on Bitcoin, the price of bitcoin (BTC) and your file sizes—which is why we recommend the lowest file size while maintaining the highest quality possible. Use an inscription calculator to figure out your hard costs, then go back and re-optimize if necessary. My 4 pieces are roughly 150kb / each (600kb total)—resulting in $187.50 at a fee rate of 5 sats/vB. Not bad! Here are some more scenarios at various file sizes and fee rates: 500kb x 25 sats/vB = $781 1000kb (1mb) x 5 sats/vB = $312 1000kb (1mb) x 25 sats/vB = $1563 4000kb (4mb) x 10 sats/vB = $2500 When it comes to choosing an inscription service, there are many options (the best being inscribing yourself from your own node for free). These services can charge anywhere from 15,000 sats ($4.50) flat to a percentage of the total cost. Using a 150kb image below are some examples at a 7sats/vB fee rate:
Gamma - 214,704 ($65.52) UniSat - 254,000 sats ($77.60) OrdinalsWallet - 299,183 sats ($91.42) OrdinalsBot - 325,952 sats ($99.63) Looksordinal - 368,068 sats ($112.33) Satscribe.xyz - 837,044 sats ($253.66) Once inscribed make sure to grab the inscription IDs from the ordinals for the next step...
You don't have to be a coder, I promise. On Windows or Mac you can use Notepad or TextEdit to create the file and paste in the code below. When you go to save the text file, make sure you save it as "YOURFILE.html".
For more advanced users—you can use Visual Studio Code (free). This allows you to create a local test environment with robust tools to dial things in before inscribing—if you had 6 images and wanted to play with how it displays in the browser window.
This is just a basic starting point. There are a ton of tweaks you can make to the code (CSS) to display your art however you want. Just keep in mind how digital artifacts are displayed on monitors and screens and plan accordingly. I chose to use percentages of the browsing window to stitch the images together—but you can use absolute values, such as:
Use whatever inscription tool you like to inscribe your "index.html" file (2kb). It should be extremely affordable—demonstrating the power of code and recursion on Bitcoin.
Enjoy!