2021
2021 copied to clipboard
You wouldn't curl an NFT...
// trigger warning NFTs (non-serious use of NFTs for meta-generative art commentary. Digital art-nonsense.)
This is a pretty terrible idea... but what if a 50K word text was generated from a series of NFTs?
Maybe if there was hypothetically some NFT series with maybe 10000 totally unique artworks, which each could be described in 5 words? Maybe with a small script which downloads every NFT, uses imagemagick to determine the background colour, and converts it to an colour name using the X11 rgb.txt colour names
#!/bin/bash
list=https://ipfs.io/ipfs/<REDACTED>
while read nft; do
# echo $nft
color=$(curl -s $nft |
egrep "^\s*$(convert - -alpha off -depth 8 txt:- |
fgrep -m1 '70,0:' |
sed 's/^.*srgb.\([0-9,]*\).$/ \1,/;s/[0-9]\{2\},/\\w\\w,/g;s/ //g;s/,/\\s+/g')" rgb.txt |
head | shuf -n1 |
cut -f3,4 |
head -n1 |
sed 's/ /-/g;s/[0-9X]//g;s/\([A-Z]\)/\L\1/;s/\([A-Z]\)/-\L\1/g')
out=$(shuf -n1 phrases.txt |
sed "s/APE/$(shuf -n1 apes.txt)/;
s/IS/$(shuf -n1 is.txt)/;
s/BORED/$(shuf -n1 bored.txt)/;
s/ON/$(shuf -n1 on.txt)/;
s/WITH/$(shuf -n1 with.txt)/;
s/GROUND/$(shuf -n1 ground.txt)/;
s/BEING/$(shuf -n1 being.txt)/
s/COLOR/$color/")
echo ${out^}
done < <(curl -s $list | grep -o "https://ipfs.io/ipfs/\w*")
(edited to improve the colour picking algorithm. It's still a bit poor. Let's call it 'subjective'. Should be less prone to confusing olives and oranges.)
Vocab words and phrase structure are picked from txt files using shuf
, the colour is determined by ... hypothetically ... downloading an image and getting an approximate colour value from a background pixel.
A hypothetical output might look like this:
Unimpressed primate against green-yellow setting. Critter on snow wall: miserable. Gloomy critter against snow colour. Character on slate-blue colour: inattentive. Chimp against slate-blue colour: neutral. Gloomy creature with midnight-blue background. Monkey seems neutral on midnight-blue. Midnight-blue with dude - appears disenchanted. Dulled gorilla against slate-blue setting. Dull monkey on green-yellow background. Monkey looking inattentive with snow. Green-yellow behind dude being souless. Simian by green-yellow wall: uninspired. Indian-red behind critter - appears miserable. Chimp on snow setting: deflated. Monkey against snow colour: oblivious. Primate is jaded on snow. Oblivious individual on snow wall. Critter with snow wall: inattentive. Indolent dude with green-yellow field. Critter with midnight-blue setting: oblivious. Green-yellow with dude - appears depressed. Primate looks unheeding on slate-blue. Character against indian-red setting: oblivious. Green-yellow with simian being pathetic. Simian looking glum on snow. Midnight-blue with monkey appearing indifferent. Creature by midnight-blue colour: neutral. Critter against snow field: unheeding. Green-yellow with critter - appears blase. ...
Probably a terrible idea. I'd have to figure out how to get the correct ipfs addresses directly from an Ethereum contract to execute this properly, and I haven't found a neat API / url to do that from the command line yet. Annoyingly, the metadata for the tokens has the background colour already listed, and other parameters. I discovered that after I wrote the imagemagick colour naming sed lookup thing. Also frustrating that I couldn't see a way to reduce the palette to css or X11 colours without using another pre-existing image.
The 5 words per-line was meant to be haiku-like... These lines all seem pretty fungible.
Better (hopefully) colour matching produces:
Beast against sandy-brown wall: uninspired. Monkey by snow wall: slack. Light-blue with creature being sad. Character against light-pink wall: dissatisified. Dismal creature on rebecca-purple wall. Sad monkey by dark-orchid color. Chimp appears slack on cadet-blue. Medium-sea-green behind chimp - appears torpid. Deflated gorilla by rebecca-purple color. Monkey appears wearied with sandy-brown. Chimp being pathetic against sea-green. Creature looking languid on sandy-brown. Torpid critter against chocolate setting. Pink behind critter appearing unimpressed. Simian on sea-green wall: deflated. Depressed individual with sea-green color. Monkey by navajo-white setting: dissatisified. Sea-green with monkey being disenchanted. Critter on sea-green setting: vacant. Unheeding beast by goldenrod wall. Gorilla against dim-gray wall: languid. Peru with monkey - appears glum. Apathetic gorilla with light-slate-gray setting. Individual appears inert on medium-violet-red. Chimp by goldenrod background: impassive. Primate looks miserable against light-blue. Slack gorilla against pink background. Primate seems wearied on light-pink. Sea-green with chimp - appears deflated. Spritless creature by goldenrod color.
Ok, this is done now: 50k words generated by describing 10,000 NFTs, located directly from their Ethereum blockchain contract. In bash.
- Project repo: https://github.com/hornc/NaNoGenMo/tree/master/2021/youwouldnt The code is also listed in this output pdf here:
- Output: https://github.com/hornc/NaNoGenMo/blob/master/2021/youwouldnt/NaNoGenMo_colorpaper.pdf
Every coloured sentence in the pdf links to the ipfs://
URL of the original NFT it describes, to verify whether the algorithm's description is accurate. Github (where it's hosted currently) won't let you follow the links, and following an ipfs://
URL is unlikely to work from whatever other pdf viewer you might have unless you have the correct browser / viewer plugins. I don't want to make this too easy, but the links are there in theory at least...
https://ipfs.io/ipfs/ is an ipfs -> https gateway, if anyone needs it.
@disastrid , hey look, I was doing silly NFT download art before it was cool ;p