Use the getTokenParams() function, passing your token ID.
Note the 'block_number', 'parent_id', 'epoch' parameter values that you will later need. 'codeLocation0' is the address of the transaction that contains the C source code. Visit that transaction address on etherscan, in this example it's https://etherscan.io/tx/0x1e9f43549f0d762746b8b6a1dd3d2f5caa4d2fd8462146f00affc855ae33f2fd Press 'Click to see More' and view the 'Input Data' field as UTF-8.
Copy and paste the C source code into a file on your computer named main.c.
void init_token_params() { // insert token ID... token_params.chronophotograph_token_id = 0; // ...and the parameters returned from smart // contract function getTokenParams(tokenID) //blocknumber the chronophotograph was minted token_params.blocknumber = 0; //ID of parent noumenon token. 'parent_id' var in getTokenParams return vals token_params.noumenon_token_id = 0; //epoch token_params.epoch = 0; }Replace your token ID, and replace the indicated values with the 'p1','p2','p3' values previously read through getTokenParams(). For example:
void init_token_params() { // insert token ID... token_params.chronophotograph_token_id = 135; // ...and the parameters returned from smart // contract function getTokenParams(tokenID) //blocknumber the chronophotograph was minted token_params.blocknumber = 17177993; //ID of parent noumenon token. 'parent_id' var in getTokenParams return vals token_params.noumenon_token_id = 17; //epoch token_params.epoch = 8; }
Code conforms to the ISO c99 standard. Only library dependency is C math library. Pass '-lm' to gcc. Assumes architecture is little endian (all Intel processors)
Compile and run. Optionally pass '-Ofast' flag to enable optimization (faster rendering).$ gcc -Ofast main.c -lm && ./a.out
This will produce:
a. PGM(Portable gray map) 16bit grayscale, linear (no gamma) file named 'image.pgm'
PGM "Portable Gray Map" is an extremely simple file format for storing grayscale images. Specification here: https://netpbm.sourceforge.net/doc/pgm.html