Image Conversion

New to FreeBASIC? Post your questions here.
TurtleProgrammer
Posts: 37
Joined: Jan 26, 2017 7:54

Image Conversion

Postby TurtleProgrammer » Aug 02, 2018 18:40

I used an online Hexadecimal converter on an image. To save space here is the first few lines of the output:

data 0xFF, 0xD8, 0xFF, 0xE0, 0x00, 0x10, 0x4A, 0x46, 0x49, 0x46, 0x00, 0x01, 0x02, 0x00, 0x00, 0x01
data 0x00, 0x01, 0x00, 0x00, 0xFF, 0xFE, 0x00, 0x0F, 0x4C, 0x61, 0x76, 0x63, 0x35, 0x36, 0x2E, 0x30
data 0x2E, 0x31, 0x30, 0x31, 0x00, 0xFF, 0xDB, 0x00, 0x43, 0x00, 0x08, 0x04, 0x04, 0x04, 0x04, 0x04
data 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06
data 0x06, 0x06, 0x06, 0x07, 0x07, 0x07, 0x08, 0x08, 0x08, 0x07, 0x07, 0x07, 0x06, 0x06, 0x07, 0x07
data 0x08, 0x08, 0x08, 0x08, 0x09, 0x09, 0x09, 0x08, 0x08, 0x08, 0x08, 0x09, 0x09, 0x0A, 0x0A, 0x0A
data 0x0C, 0x0C, 0x0B, 0x0B, 0x0E, 0x0E, 0x0E, 0x11, 0x11, 0x14, 0xFF, 0xC4, 0x01, 0xA2, 0x00, 0x00
data 0x01, 0x05, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
data 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x01, 0x00, 0x03, 0x01, 0x01
data 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x02, 0x03
data 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x10, 0x00, 0x02, 0x01, 0x03, 0x03, 0x02, 0x04
data 0x03, 0x05, 0x05, 0x04, 0x04, 0x00, 0x00, 0x01, 0x7D, 0x01, 0x02, 0x03, 0x00, 0x04, 0x11, 0x05
data 0x12, 0x21, 0x31, 0x41, 0x06, 0x13, 0x51, 0x61, 0x07, 0x22, 0x71, 0x14, 0x32, 0x81, 0x91, 0xA1
data 0x08, 0x23, 0x42, 0xB1, 0xC1, 0x15, 0x52, 0xD1, 0xF0, 0x24, 0x33, 0x62, 0x72, 0x82, 0x09, 0x0A
data 0x16, 0x17, 0x18, 0x19, 0x1A, 0x25, 0x26, 0x27, 0x28, 0x29, 0x2A, 0x34, 0x35, 0x36, 0x37, 0x38
data 0x39, 0x3A, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49, 0x4A, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58
data 0x59, 0x5A, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x6A, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78
data 0x79, 0x7A, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89, 0x8A, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97
data 0x98, 0x99, 0x9A, 0xA2, 0xA3, 0xA4, 0xA5, 0xA6, 0xA7, 0xA8, 0xA9, 0xAA, 0xB2, 0xB3, 0xB4, 0xB5
data 0xB6, 0xB7, 0xB8, 0xB9, 0xBA, 0xC2, 0xC3, 0xC4, 0xC5, 0xC6, 0xC7, 0xC8, 0xC9, 0xCA, 0xD2, 0xD3
data 0xD4, 0xD5, 0xD6, 0xD7, 0xD8, 0xD9, 0xDA, 0xE1, 0xE2, 0xE3, 0xE4, 0xE5, 0xE6, 0xE7, 0xE8, 0xE9
data 0xEA, 0xF1, 0xF2, 0xF3, 0xF4, 0xF5, 0xF6, 0xF7, 0xF8, 0xF9, 0xFA, 0x11, 0x00, 0x02, 0x01, 0x02
data 0x04, 0x04, 0x03, 0x04, 0x07, 0x05, 0x04, 0x04, 0x00, 0x01, 0x02, 0x77, 0x00, 0x01, 0x02, 0x03
data 0x11, 0x04, 0x05, 0x21, 0x31, 0x06, 0x12, 0x41, 0x51, 0x07, 0x61, 0x71, 0x13, 0x22, 0x32, 0x81
data 0x08, 0x14, 0x42, 0x91, 0xA1, 0xB1, 0xC1, 0x09, 0x23, 0x33, 0x52, 0xF0, 0x15, 0x62, 0x72, 0xD1
data 0x0A, 0x16, 0x24, 0x34, 0xE1, 0x25, 0xF1, 0x17, 0x18, 0x19, 0x1A, 0x26, 0x27, 0x28, 0x29, 0x2A
data 0x35, 0x36, 0x37, 0x38, 0x39, 0x3A, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49, 0x4A, 0x53, 0x54
data 0x55, 0x56, 0x57, 0x58, 0x59, 0x5A, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x6A, 0x73, 0x74
data 0x75, 0x76, 0x77, 0x78, 0x79, 0x7A, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89, 0x8A, 0x92
data 0x93, 0x94, 0x95, 0x96, 0x97, 0x98, 0x99, 0x9A, 0xA2, 0xA3, 0xA4, 0xA5, 0xA6, 0xA7, 0xA8, 0xA9
data 0xAA, 0xB2, 0xB3, 0xB4, 0xB5, 0xB6, 0xB7, 0xB8, 0xB9, 0xBA, 0xC2, 0xC3, 0xC4, 0xC5, 0xC6, 0xC7
data 0xC8, 0xC9, 0xCA, 0xD2, 0xD3, 0xD4, 0xD5, 0xD6, 0xD7, 0xD8, 0xD9, 0xDA, 0xE2, 0xE3, 0xE4, 0xE5
data 0xE6, 0xE7, 0xE8, 0xE9, 0xEA, 0xF2, 0xF3, 0xF4, 0xF5, 0xF6, 0xF7, 0xF8, 0xF9, 0xFA, 0xFF, 0xC0
data 0x00, 0x11, 0x08, 0x02, 0xD0, 0x05, 0x00, 0x03, 0x01, 0x22, 0x00, 0x02, 0x11, 0x00, 0x03, 0x11
data 0x00, 0xFF, 0xDA, 0x00, 0x0C, 0x03, 0x01, 0x00, 0x02, 0x11, 0x03, 0x11, 0x00, 0x3F, 0x00, 0xF7
data 0xFA, 0x28, 0xA2, 0x98, 0x05, 0x14, 0x51, 0x40, 0x05, 0x14, 0x51, 0x40, 0x19, 0xBA, 0xEF, 0x85
data 0x34, 0x5F, 0x10, 0xA8, 0xFB, 0x6D, 0xBF, 0xEF, 0x47, 0xDC, 0xB8, 0x88, 0xF9, 0x77, 0x11, 0xFA
data 0x6D, 0x95, 0x7E, 0x71, 0x8F, 0x63, 0x59, 0xAB, 0xA6, 0xF8, 0xC3, 0xC3, 0x40, 0x7D, 0x8A, 0xED
data 0xB5, 0xFB, 0x34, 0x0A, 0x3E, 0xCD, 0x74, 0xC5, 0x6F, 0x15, 0x46, 0x72, 0x12, 0x52, 0x5B, 0xCC
data 0xC0, 0xC6, 0x37, 0x30, 0x26, 0xBA, 0x4A, 0x29, 0x31, 0xD8, 0xC7, 0xD2, 0xBC, 0x5F, 0xA5, 0x6A
data 0x4F, 0xE4, 0x39, 0x92, 0xC6, 0xE9, 0x78, 0x7B, 0x5B, 0xA5, 0xF2, 0xE4, 0x53, 0xE9, 0x9F, 0xBA
data 0xDF, 0x81, 0xAD, 0x47, 0x86, 0x39, 0xD0, 0xA4, 0x88, 0x1D, 0x0F, 0x55, 0x61, 0x90, 0x6A, 0xAE
data 0xB1, 0xE1, 0xDD, 0x23, 0x5D, 0x8B, 0xCB, 0xBE, 0xB5, 0x8E, 0x43, 0xFC, 0x32, 0x81, 0xB6, 0x64
data 0x3E, 0xA9, 0x22, 0xE1, 0x81, 0x1F, 0x5A, 0xC8, 0xFB, 0x07, 0x8B, 0xBC, 0x2E, 0x73, 0x61, 0x29
data 0xD7, 0x2C, 0x47, 0xFC, 0xBB, 0x4E, 0xD8, 0xBA, 0x8C, 0x7F, 0xB1, 0x23, 0x67, 0x7F, 0x7F, 0xBC
data 0xC2, 0xA2, 0xC2, 0x31, 0xBC, 0x6F, 0xFB, 0x3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0xBD, 0x28, 0x3D, 0xC7, 0x85
data 0xAF, 0xBE, 0xD9, 0x02, 0xE4, 0x8B, 0x5B, 0x8C, 0x89, 0x40, 0x1D, 0x02, 0xBE, 0xE3, 0xFA, 0xD1

My question(s) is/are:

1. How do I read each value and convert it to a color, if that is possible, considering these values originally came from an image?
or
2. Do I need to convert the above values to longer values, say more than three characters to a value?

I am working on an experiment to see if I can load an image's values into DATA statements and for each value have the color printed to the screen.
MrSwiss
Posts: 2728
Joined: Jun 02, 2013 9:27
Location: Switzerland

Re: Image Conversion

Postby MrSwiss » Aug 02, 2018 19:07

The whole HEX stuff is useless whithout you, providing decent information on:
the original picture (bit-depth of color, sizes etc.), you have converted.

Then, whenever something should be usable by others, put it in-between code tags!
Just a part of the info (the incomplete HEX, I assume), is equally useless!

Without those informations, you are unlikely to get a decent answer ...
(everybody simply guessing ...)
dodicat
Posts: 5086
Joined: Jan 10, 2006 20:30
Location: Scotland

Re: Image Conversion

Postby dodicat » Aug 02, 2018 19:37

Definitely a worm of some sort.

Code: Select all


data &hFF, &hD8, &hFF, &hE0, &h00, &h10, &h4A, &h46, &h49, &h46, &h00, &h01, &h02, &h00, &h00, &h01
data &h00, &h01, &h00, &h00, &hFF, &hFE, &h00, &h0F, &h4C, &h61, &h76, &h63, &h35, &h36, &h2E, &h30
data &h2E, &h31, &h30, &h31, &h00, &hFF, &hDB, &h00, &h43, &h00, &h08, &h04, &h04, &h04, &h04, &h04
data &h05, &h05, &h05, &h05, &h05, &h05, &h06, &h06, &h06, &h06, &h06, &h06, &h06, &h06, &h06, &h06
data &h06, &h06, &h06, &h07, &h07, &h07, &h08, &h08, &h08, &h07, &h07, &h07, &h06, &h06, &h07, &h07
data &h08, &h08, &h08, &h08, &h09, &h09, &h09, &h08, &h08, &h08, &h08, &h09, &h09, &h0A, &h0A, &h0A
data &h0C, &h0C, &h0B, &h0B, &h0E, &h0E, &h0E, &h11, &h11, &h14, &hFF, &hC4, &h01, &hA2, &h00, &h00
data &h01, &h05, &h01, &h01, &h01, &h01, &h01, &h01, &h00, &h00, &h00, &h00, &h00, &h00, &h00, &h00
data &h01, &h02, &h03, &h04, &h05, &h06, &h07, &h08, &h09, &h0A, &h0B, &h01, &h00, &h03, &h01, &h01
data &h01, &h01, &h01, &h01, &h01, &h01, &h01, &h00, &h00, &h00, &h00, &h00, &h00, &h01, &h02, &h03
data &h04, &h05, &h06, &h07, &h08, &h09, &h0A, &h0B, &h10, &h00, &h02, &h01, &h03, &h03, &h02, &h04
data &h03, &h05, &h05, &h04, &h04, &h00, &h00, &h01, &h7D, &h01, &h02, &h03, &h00, &h04, &h11, &h05
data &h12, &h21, &h31, &h41, &h06, &h13, &h51, &h61, &h07, &h22, &h71, &h14, &h32, &h81, &h91, &hA1
data &h08, &h23, &h42, &hB1, &hC1, &h15, &h52, &hD1, &hF0, &h24, &h33, &h62, &h72, &h82, &h09, &h0A
data &h16, &h17, &h18, &h19, &h1A, &h25, &h26, &h27, &h28, &h29, &h2A, &h34, &h35, &h36, &h37, &h38
data &h39, &h3A, &h43, &h44, &h45, &h46, &h47, &h48, &h49, &h4A, &h53, &h54, &h55, &h56, &h57, &h58
data &h59, &h5A, &h63, &h64, &h65, &h66, &h67, &h68, &h69, &h6A, &h73, &h74, &h75, &h76, &h77, &h78
data &h79, &h7A, &h83, &h84, &h85, &h86, &h87, &h88, &h89, &h8A, &h92, &h93, &h94, &h95, &h96, &h97
data &h98, &h99, &h9A, &hA2, &hA3, &hA4, &hA5, &hA6, &hA7, &hA8, &hA9, &hAA, &hB2, &hB3, &hB4, &hB5
data &hB6, &hB7, &hB8, &hB9, &hBA, &hC2, &hC3, &hC4, &hC5, &hC6, &hC7, &hC8, &hC9, &hCA, &hD2, &hD3
data &hD4, &hD5, &hD6, &hD7, &hD8, &hD9, &hDA, &hE1, &hE2, &hE3, &hE4, &hE5, &hE6, &hE7, &hE8, &hE9
data &hEA, &hF1, &hF2, &hF3, &hF4, &hF5, &hF6, &hF7, &hF8, &hF9, &hFA, &h11, &h00, &h02, &h01, &h02
data &h04, &h04, &h03, &h04, &h07, &h05, &h04, &h04, &h00, &h01, &h02, &h77, &h00, &h01, &h02, &h03
data &h11, &h04, &h05, &h21, &h31, &h06, &h12, &h41, &h51, &h07, &h61, &h71, &h13, &h22, &h32, &h81
data &h08, &h14, &h42, &h91, &hA1, &hB1, &hC1, &h09, &h23, &h33, &h52, &hF0, &h15, &h62, &h72, &hD1
data &h0A, &h16, &h24, &h34, &hE1, &h25, &hF1, &h17, &h18, &h19, &h1A, &h26, &h27, &h28, &h29, &h2A
data &h35, &h36, &h37, &h38, &h39, &h3A, &h43, &h44, &h45, &h46, &h47, &h48, &h49, &h4A, &h53, &h54
data &h55, &h56, &h57, &h58, &h59, &h5A, &h63, &h64, &h65, &h66, &h67, &h68, &h69, &h6A, &h73, &h74
data &h75, &h76, &h77, &h78, &h79, &h7A, &h82, &h83, &h84, &h85, &h86, &h87, &h88, &h89, &h8A, &h92
data &h93, &h94, &h95, &h96, &h97, &h98, &h99, &h9A, &hA2, &hA3, &hA4, &hA5, &hA6, &hA7, &hA8, &hA9
data &hAA, &hB2, &hB3, &hB4, &hB5, &hB6, &hB7, &hB8, &hB9, &hBA, &hC2, &hC3, &hC4, &hC5, &hC6, &hC7
data &hC8, &hC9, &hCA, &hD2, &hD3, &hD4, &hD5, &hD6, &hD7, &hD8, &hD9, &hDA, &hE2, &hE3, &hE4, &hE5
data &hE6, &hE7, &hE8, &hE9, &hEA, &hF2, &hF3, &hF4, &hF5, &hF6, &hF7, &hF8, &hF9, &hFA, &hFF, &hC0
data &h00, &h11, &h08, &h02, &hD0, &h05, &h00, &h03, &h01, &h22, &h00, &h02, &h11, &h00, &h03, &h11
data &h00, &hFF, &hDA, &h00, &h0C, &h03, &h01, &h00, &h02, &h11, &h03, &h11, &h00, &h3F, &h00, &hF7
data &hFA, &h28, &hA2, &h98, &h05, &h14, &h51, &h40, &h05, &h14, &h51, &h40, &h19, &hBA, &hEF, &h85
data &h34, &h5F, &h10, &hA8, &hFB, &h6D, &hBF, &hEF, &h47, &hDC, &hB8, &h88, &hF9, &h77, &h11, &hFA
data &h6D, &h95, &h7E, &h71, &h8F, &h63, &h59, &hAB, &hA6, &hF8, &hC3, &hC3, &h40, &h7D, &h8A, &hED
data &hB5, &hFB, &h34, &h0A, &h3E, &hCD, &h74, &hC5, &h6F, &h15, &h46, &h72, &h12, &h52, &h5B, &hCC
data &hC0, &hC6, &h37, &h30, &h26, &hBA, &h4A, &h29, &h31, &hD8, &hC7, &hD2, &hBC, &h5F, &hA5, &h6A
data &h4F, &hE4, &h39, &h92, &hC6, &hE9, &h78, &h7B, &h5B, &hA5, &hF2, &hE4, &h53, &hE9, &h9F, &hBA
data &hDF, &h81, &hAD, &h47, &h86, &h39, &hD0, &hA4, &h88, &h1D, &h0F, &h55, &h61, &h90, &h6A, &hAE
data &hB1, &hE1, &hDD, &h23, &h5D, &h8B, &hCB, &hBE, &hB5, &h8E, &h43, &hFC, &h32, &h81, &hB6, &h64
data &h3E, &hA9, &h22, &hE1, &h81, &h1F, &h5A, &hC8, &hFB, &h07, &h8B, &hBC, &h2E, &h73, &h61, &h29
data &hD7, &h2C, &h47, &hFC, &hBB, &h4E, &hD8, &hBA, &h8C, &h7F, &hB1, &h23, &h67, &h7F, &h7F, &hBC
data &hC2, &hA2, &hC2, &h31, &hBC, &h6F, &hFB, &h3D, &h78, &h1B, &hC6, &h1E, &h64, &hC9, &h6A, &hBA
data &h65, &hDB, &h64, &hFD, &hA2, &hD5, &h76, &h31, &h27, &hB1, &h00, &h81, &h8C, &hF5, &hF5, &hAF
data &h22, &hF1, &h8F, &hEC, &hF1, &hE3, &hAF, &h08, &h48, &h6E, &h74, &hFD, &hBA, &hAC, &h08, &h49
data &h47, &hB7, &h2C, &h2E, &h40, &hCE, &h78, &h45, &hE3, &hD3, &h23, &h78, &h1D, &hEB, &hE8, &h3D
data &h1B, &hC6, &h9A, &h4E, &hAE, &hE6, &h06, &h32, &h69, &hF7, &h6A, &h71, &h25, &h95, &hEA, &hF9
data &h33, &h27, &hD3, &h3F, &h23, &h0C, &hF7, &h0D, &h5A, &hE5, &h55, &hC1, &h56, &h00, &h83, &hD4
data &h1E, &hF5, &h0E, &h29, &h85, &h8F, &h97, &h3C, &h1F, &hF1, &hA3, &hC7, &h7E, &h05, &h9D, &h6D
data &hA7, &h96, &hE6, &h78, &h10, &hFC, &hD6, &h77, &hA1, &hB2, &h31, &hD7, &h1B, &hC6, &h7A, &h7E
data &h55, &hEB, &hDE, &h09, &hFD, &hA3, &hBC, &h1F, &hE2, &h4F, &h26, &hDF, &h51, &h63, &hA4, &hDD
data &hB8, &h1B, &h84, &hBC, &h41, &h93, &hE8, &hF9, &h3D, &h7B, &h64, &hD7, &h47, &hE2, &hCF, &h85
data &hBE, &h0C, &hF1, &h8C, &h4C, &hBA, &h8E, &h9B, &h07, &h99, &h83, &hB6, &h78, &hD1, &h52, &h65
data &hCF, &hA3, &h2E, &h0F, &h15, &hE4, &h7E, &h36, &hFD, &h96, &h35, &hBD, &h28, &h3D, &hC7, &h85
data &hAF, &hBE, &hD9, &h02, &hE4, &h8B, &h5B, &h8C, &h89, &h40, &h1D, &h02, &hBE, &hE3, &hFA, &hD1
data 1000000
screen 20
redim as ulong colours(0)
dim as ulong count
dim as ulong t
do
    count+=1
    read t
    if t=1000000 then exit do
    redim preserve colours(1 to count)
    colours(count)=t
    circle(count,300+50*sin(count/50)),5+count/10,t
loop
print count

sleep

 
jj2007
Posts: 749
Joined: Oct 23, 2016 15:28
Location: Roma, Italia
Contact:

Re: Image Conversion

Postby jj2007 » Aug 02, 2018 19:42

dodicat wrote:Definitely a worm of some sort.
Yeah, a worm with 929 legs. Odd.
dodicat
Posts: 5086
Joined: Jan 10, 2006 20:30
Location: Scotland

Re: Image Conversion

Postby dodicat » Aug 02, 2018 20:26

Nevertheless a happy one.

Code: Select all

 

Data &hFF, &hD8, &hFF, &hE0, &h00, &h10, &h4A, &h46, &h49, &h46, &h00, &h01, &h02, &h00, &h00, &h01
Data &h00, &h01, &h00, &h00, &hFF, &hFE, &h00, &h0F, &h4C, &h61, &h76, &h63, &h35, &h36, &h2E, &h30
Data &h2E, &h31, &h30, &h31, &h00, &hFF, &hDB, &h00, &h43, &h00, &h08, &h04, &h04, &h04, &h04, &h04
Data &h05, &h05, &h05, &h05, &h05, &h05, &h06, &h06, &h06, &h06, &h06, &h06, &h06, &h06, &h06, &h06
Data &h06, &h06, &h06, &h07, &h07, &h07, &h08, &h08, &h08, &h07, &h07, &h07, &h06, &h06, &h07, &h07
Data &h08, &h08, &h08, &h08, &h09, &h09, &h09, &h08, &h08, &h08, &h08, &h09, &h09, &h0A, &h0A, &h0A
Data &h0C, &h0C, &h0B, &h0B, &h0E, &h0E, &h0E, &h11, &h11, &h14, &hFF, &hC4, &h01, &hA2, &h00, &h00
Data &h01, &h05, &h01, &h01, &h01, &h01, &h01, &h01, &h00, &h00, &h00, &h00, &h00, &h00, &h00, &h00
Data &h01, &h02, &h03, &h04, &h05, &h06, &h07, &h08, &h09, &h0A, &h0B, &h01, &h00, &h03, &h01, &h01
Data &h01, &h01, &h01, &h01, &h01, &h01, &h01, &h00, &h00, &h00, &h00, &h00, &h00, &h01, &h02, &h03
Data &h04, &h05, &h06, &h07, &h08, &h09, &h0A, &h0B, &h10, &h00, &h02, &h01, &h03, &h03, &h02, &h04
Data &h03, &h05, &h05, &h04, &h04, &h00, &h00, &h01, &h7D, &h01, &h02, &h03, &h00, &h04, &h11, &h05
Data &h12, &h21, &h31, &h41, &h06, &h13, &h51, &h61, &h07, &h22, &h71, &h14, &h32, &h81, &h91, &hA1
Data &h08, &h23, &h42, &hB1, &hC1, &h15, &h52, &hD1, &hF0, &h24, &h33, &h62, &h72, &h82, &h09, &h0A
Data &h16, &h17, &h18, &h19, &h1A, &h25, &h26, &h27, &h28, &h29, &h2A, &h34, &h35, &h36, &h37, &h38
Data &h39, &h3A, &h43, &h44, &h45, &h46, &h47, &h48, &h49, &h4A, &h53, &h54, &h55, &h56, &h57, &h58
Data &h59, &h5A, &h63, &h64, &h65, &h66, &h67, &h68, &h69, &h6A, &h73, &h74, &h75, &h76, &h77, &h78
Data &h79, &h7A, &h83, &h84, &h85, &h86, &h87, &h88, &h89, &h8A, &h92, &h93, &h94, &h95, &h96, &h97
Data &h98, &h99, &h9A, &hA2, &hA3, &hA4, &hA5, &hA6, &hA7, &hA8, &hA9, &hAA, &hB2, &hB3, &hB4, &hB5
Data &hB6, &hB7, &hB8, &hB9, &hBA, &hC2, &hC3, &hC4, &hC5, &hC6, &hC7, &hC8, &hC9, &hCA, &hD2, &hD3
Data &hD4, &hD5, &hD6, &hD7, &hD8, &hD9, &hDA, &hE1, &hE2, &hE3, &hE4, &hE5, &hE6, &hE7, &hE8, &hE9
Data &hEA, &hF1, &hF2, &hF3, &hF4, &hF5, &hF6, &hF7, &hF8, &hF9, &hFA, &h11, &h00, &h02, &h01, &h02
Data &h04, &h04, &h03, &h04, &h07, &h05, &h04, &h04, &h00, &h01, &h02, &h77, &h00, &h01, &h02, &h03
Data &h11, &h04, &h05, &h21, &h31, &h06, &h12, &h41, &h51, &h07, &h61, &h71, &h13, &h22, &h32, &h81
Data &h08, &h14, &h42, &h91, &hA1, &hB1, &hC1, &h09, &h23, &h33, &h52, &hF0, &h15, &h62, &h72, &hD1
Data &h0A, &h16, &h24, &h34, &hE1, &h25, &hF1, &h17, &h18, &h19, &h1A, &h26, &h27, &h28, &h29, &h2A
Data &h35, &h36, &h37, &h38, &h39, &h3A, &h43, &h44, &h45, &h46, &h47, &h48, &h49, &h4A, &h53, &h54
Data &h55, &h56, &h57, &h58, &h59, &h5A, &h63, &h64, &h65, &h66, &h67, &h68, &h69, &h6A, &h73, &h74
Data &h75, &h76, &h77, &h78, &h79, &h7A, &h82, &h83, &h84, &h85, &h86, &h87, &h88, &h89, &h8A, &h92
Data &h93, &h94, &h95, &h96, &h97, &h98, &h99, &h9A, &hA2, &hA3, &hA4, &hA5, &hA6, &hA7, &hA8, &hA9
Data &hAA, &hB2, &hB3, &hB4, &hB5, &hB6, &hB7, &hB8, &hB9, &hBA, &hC2, &hC3, &hC4, &hC5, &hC6, &hC7
Data &hC8, &hC9, &hCA, &hD2, &hD3, &hD4, &hD5, &hD6, &hD7, &hD8, &hD9, &hDA, &hE2, &hE3, &hE4, &hE5
Data &hE6, &hE7, &hE8, &hE9, &hEA, &hF2, &hF3, &hF4, &hF5, &hF6, &hF7, &hF8, &hF9, &hFA, &hFF, &hC0
Data &h00, &h11, &h08, &h02, &hD0, &h05, &h00, &h03, &h01, &h22, &h00, &h02, &h11, &h00, &h03, &h11
Data &h00, &hFF, &hDA, &h00, &h0C, &h03, &h01, &h00, &h02, &h11, &h03, &h11, &h00, &h3F, &h00, &hF7
Data &hFA, &h28, &hA2, &h98, &h05, &h14, &h51, &h40, &h05, &h14, &h51, &h40, &h19, &hBA, &hEF, &h85
Data &h34, &h5F, &h10, &hA8, &hFB, &h6D, &hBF, &hEF, &h47, &hDC, &hB8, &h88, &hF9, &h77, &h11, &hFA
Data &h6D, &h95, &h7E, &h71, &h8F, &h63, &h59, &hAB, &hA6, &hF8, &hC3, &hC3, &h40, &h7D, &h8A, &hED
Data &hB5, &hFB, &h34, &h0A, &h3E, &hCD, &h74, &hC5, &h6F, &h15, &h46, &h72, &h12, &h52, &h5B, &hCC
Data &hC0, &hC6, &h37, &h30, &h26, &hBA, &h4A, &h29, &h31, &hD8, &hC7, &hD2, &hBC, &h5F, &hA5, &h6A
Data &h4F, &hE4, &h39, &h92, &hC6, &hE9, &h78, &h7B, &h5B, &hA5, &hF2, &hE4, &h53, &hE9, &h9F, &hBA
Data &hDF, &h81, &hAD, &h47, &h86, &h39, &hD0, &hA4, &h88, &h1D, &h0F, &h55, &h61, &h90, &h6A, &hAE
Data &hB1, &hE1, &hDD, &h23, &h5D, &h8B, &hCB, &hBE, &hB5, &h8E, &h43, &hFC, &h32, &h81, &hB6, &h64
Data &h3E, &hA9, &h22, &hE1, &h81, &h1F, &h5A, &hC8, &hFB, &h07, &h8B, &hBC, &h2E, &h73, &h61, &h29
Data &hD7, &h2C, &h47, &hFC, &hBB, &h4E, &hD8, &hBA, &h8C, &h7F, &hB1, &h23, &h67, &h7F, &h7F, &hBC
Data &hC2, &hA2, &hC2, &h31, &hBC, &h6F, &hFB, &h3D, &h78, &h1B, &hC6, &h1E, &h64, &hC9, &h6A, &hBA
Data &h65, &hDB, &h64, &hFD, &hA2, &hD5, &h76, &h31, &h27, &hB1, &h00, &h81, &h8C, &hF5, &hF5, &hAF
Data &h22, &hF1, &h8F, &hEC, &hF1, &hE3, &hAF, &h08, &h48, &h6E, &h74, &hFD, &hBA, &hAC, &h08, &h49
Data &h47, &hB7, &h2C, &h2E, &h40, &hCE, &h78, &h45, &hE3, &hD3, &h23, &h78, &h1D, &hEB, &hE8, &h3D
Data &h1B, &hC6, &h9A, &h4E, &hAE, &hE6, &h06, &h32, &h69, &hF7, &h6A, &h71, &h25, &h95, &hEA, &hF9
Data &h33, &h27, &hD3, &h3F, &h23, &h0C, &hF7, &h0D, &h5A, &hE5, &h55, &hC1, &h56, &h00, &h83, &hD4
Data &h1E, &hF5, &h0E, &h29, &h85, &h8F, &h97, &h3C, &h1F, &hF1, &hA3, &hC7, &h7E, &h05, &h9D, &h6D
Data &hA7, &h96, &hE6, &h78, &h10, &hFC, &hD6, &h77, &hA1, &hB2, &h31, &hD7, &h1B, &hC6, &h7A, &h7E
Data &h55, &hEB, &hDE, &h09, &hFD, &hA3, &hBC, &h1F, &hE2, &h4F, &h26, &hDF, &h51, &h63, &hA4, &hDD
Data &hB8, &h1B, &h84, &hBC, &h41, &h93, &hE8, &hF9, &h3D, &h7B, &h64, &hD7, &h47, &hE2, &hCF, &h85
Data &hBE, &h0C, &hF1, &h8C, &h4C, &hBA, &h8E, &h9B, &h07, &h99, &h83, &hB6, &h78, &hD1, &h52, &h65
Data &hCF, &hA3, &h2E, &h0F, &h15, &hE4, &h7E, &h36, &hFD, &h96, &h35, &hBD, &h28, &h3D, &hC7, &h85
Data &hAF, &hBE, &hD9, &h02, &hE4, &h8B, &h5B, &h8C, &h89, &h40, &h1D, &h02, &hBE, &hE3, &hFA, &hD1
Data 1000000
Screen 20
Redim As Ulong colours(0)
Dim As Ulong count
Dim As Ulong t
Do
    count+=1
    Read t
    If t=1000000 Then Exit Do
    Redim Preserve colours(1 To count)
    colours(count)=t
Loop
Dim As Single d

Do
    Screenlock
    Cls
    For n As Long=1 To Ubound(colours)
        d+=.001
        Circle(n,300+(50+n/10)*Sin((n+d)/50)),5+n/10,colours(n),,,,f
        If n=Ubound(colours) Then
            Circle(n,300+(50+n/10)*Sin((n+d)/50)),5+n/10,4,,,,f
            Circle(n-50,-20+300+(50+n/10)*Sin((n+d)/50)),5,3,,,,f
            Circle(n+50,-20+300+(50+n/10)*Sin((n+d)/50)),5,3,,,,f
            Circle(n,+0+300+(50+n/10)*Sin((n+d)/50)),5+n/10-40,15,1+3.1,2+3.1,,f
        End If
    Next
    Screenunlock
    Sleep 2,1
Loop Until Len(Inkey)

Print count

Sleep

 
UEZ
Posts: 177
Joined: May 05, 2017 19:59
Location: Germany

Re: Image Conversion

Postby UEZ » Aug 02, 2018 21:07

Here an example how I use embedded images using GDIPlus [Windows only]

Code: Select all

'Coded by UEZ / Windows only! :-)

#include "fbgfx.bi"
#Ifdef __Fb_64bit__
   #Inclib "gdiplus"
   #Include Once "win/gdiplus-c.bi"
#Else
   #Include Once "win/gdiplus.bi"
   Using gdiplus
#Endif

Declare Function Base91Decode(sString As String, Byref iBase91Len As Ulong) As Ubyte Ptr
Declare Function _GDIPlus_Startup() As Byte
Declare Sub _GDIPlus_Shutdown()
Declare Function _GDIPlus_BitmapCreateFromMemory2(aBinImage As Ubyte Ptr, iLen As Ulong, bBitmap_GDI As Bool = False) As Any Ptr
Declare Function Convert2FBImage(aMemGDIpBitmap As Ubyte Ptr, iSize As Ulong) As Any Ptr
Declare Function RestoreMemImage() As Any Ptr

'init GDIPlus

Using FB

Dim Shared gdipToken As ULONG_PTR
Dim Shared GDIp As GdiplusStartupInput


Screenres 128, 128, 32, 1, GFX_NO_SWITCH
'Color , Rgb(&h40, &h40, &h60)
'Cls

Dim pImageMem As Any Ptr = RestoreMemImage()
Put (0, 0), pImageMem, Alpha
Imagedestroy(pImageMem)
Sleep

Function Convert2FBImage(aMemGDIpBitmap As Ubyte Ptr, iSize As Ulong) As Any Ptr
   _GDIPlus_Startup()
   Dim As Any Ptr hImage = _GDIPlus_BitmapCreateFromMemory2(@aMemGDIpBitmap[0], iSize)

   Dim As Single iW_Img, iH_Img
   GdipGetImageDimension(hImage, @iW_Img, @iH_Img)

   Dim As Any Ptr pImageMem = Imagecreate(iW_Img, iH_Img, , 32), pixdataMem
   Dim As Integer pitchMem
   Imageinfo(pImageMem, , , , pitchMem, pixdataMem)

   Dim As Rect tRect = Type(0, 0, iW_Img - 1, iH_Img - 1)
   Dim As BitmapData tBitmapData
   GdipBitmapLockBits(hImage, Cast(Any Ptr, @tRect), ImageLockModeRead, PixelFormat32bppARGB, @tBitmapData)
   
   Dim As Ulong iX, iY, iRowOffset
   For iY = 0 To iH_Img - 1
      iRowOffset = iY * iW_Img
      For iX = 0 To iW_Img - 1
         *Cptr(Ulong Ptr, pixdataMem + iY * pitchMem + iX Shl 2) = Cast(Ulong Ptr, tBitmapData.Scan0)[iRowOffset + iX]
      Next
   Next
   
   GdipBitmapUnlockBits(hImage, @tBitmapData)
   GdipDisposeImage(hImage)
   _GDIPlus_Shutdown()
   Return pImageMem
End Function

Function RestoreMemImage() As Any Ptr
   'decompress base91 encoded image
   Dim As Ulong iLines, bCompressed, iFileSize, iCompressedSize
   Dim As String sBaseType, sBase91, aB91(1)

   Restore __Imagepng:
   Read iLines
   Read bCompressed
   Read iFileSize
   Read iCompressedSize
   Read sBaseType
   For i As Ushort = 0 To iLines - 1
      Read aB91(0)
      sBase91 &= aB91(0)
   Next

   Dim As Ulong iLenB91
   Static As Ubyte Ptr aBinary
   aBinary = Base91Decode(sBase91, iLenB91)
   
   Return Convert2FBImage(aBinary, iFileSize)
End Function

Function Base91Decode(sString As String, Byref iBase91Len As Ulong) As Ubyte Ptr
   Dim As String sB91, sDecoded
   sB91 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789!#$%&()*+,./:;<=>?@[]^_`{|}~´" '´ instead of "
   Dim As Long i, n = 0, c, b = 0, v = -1

   Dim aChr(0 To Len(sString) - 1) As String
   For i = 0 To Ubound(aChr)             
      aChr(i) = Mid(sString, i + 1, 1)
   Next
   
   For i = 0 To Ubound(aChr)
      c = Instr(sB91, aChr(i)) - 1
      If v < 0 Then
         v = c
      Else
         v += c * 91
         b = b Or (v Shl n)
         n += 13 + (((v And 8191) <= 88) * -1)
         Do Until  (n > 7)=0
            sDecoded &= Chr(b And 255)
            b = b Shr 8
            n -= 8
         Loop
         v = -1
      Endif
   Next
   If (v + 1) Then
      sDecoded &= Chr((b Or (v Shl n)) And 255)
   End If
   iBase91Len = Len(sDecoded)

   Static As Ubyte aReturn(0 To Len(sDecoded))
   For i = 0 To Len(sDecoded) - 1 'convert result String To ascii code values
      aReturn(i) = Asc(sDecoded, i + 1)
   Next
   Return @aReturn(0) 'Return Pointer To the array
End Function


Function _GDIPlus_Startup() As Byte
   GDIp.GdiplusVersion = 1
   If GdiplusStartup(@gdipToken, @GDIp, NULL) <> 0 Then
      Return False
   Endif
   Return TRUE
End Function

Sub _GDIPlus_Shutdown()
   GdiplusShutdown(gdipToken)
End Sub

Function _GDIPlus_BitmapCreateFromMemory2(aBinImage As Ubyte Ptr, iLen As Ulong, bBitmap_GDI As Bool = False) As Any Ptr
   Dim As HGLOBAL hGlobal
   Dim As LPSTREAM hStream
   Dim As Any Ptr hBitmap_Stream
   Dim As Any Ptr hMemory = GlobalAlloc(GMEM_MOVEABLE, iLen)
   Dim As Any Ptr lpMemory = GlobalLock(hMemory)
   RtlCopyMemory(lpMemory, @aBinImage[0], iLen)
   GlobalUnlock(hMemory)
   CreateStreamOnHGlobal(hMemory, 0, @hStream)
   GdipCreateBitmapFromStream(hStream, @hBitmap_Stream)
   IUnknown_Release(hStream)

   If bBitmap_GDI = TRUE Then
      Dim hBitmap_GDI As Any Ptr
      GdipCreateHBITMAPFromBitmap(hBitmap_Stream, @hBitmap_GDI, &hFF000000)
      GdipDisposeImage(hBitmap_Stream)
      Return hBitmap_GDI
   Endif

   Return hBitmap_Stream
End Function


'Generated by FB File2Bas Code Generator v0.75 build 2018-02-22 beta by UEZ

__Imagepng:
Data 9,0,6110,7509,"Base91"
Data "vuk:eJs4+BAAN/<MCG4DAAAABAAA´CDAAA]qNZ}KAA:`zw6d*AAAC´sPwAIwHAXtCt_c4cKF5W5BJO$|&C&R%tYx(}Q@1X+I4b3W3`UH´yoY:N^IUaw1j`,O<kVx3KYd_vNdF`PI>TqYW3u<n7~Q(%9vK8.A?3+$%v:16AA0G´jsNtHL|$QZi+7tt8>MD,rI$!4Y3NC)ZE[9a5]qJOcMAANBv(UAsICAEUdZcEAAoAuWEA*hAAtJLAj#D´4IUijG0n8j2dNz#Gvn,dWHV?rjTV<+Ocd9<o09_:>]2WGgTFM3I08OY!IPRoAP}281$6+NCo87^h.!X<({3p>Vym+FIfPjbIn>aeN%4O6.hxodPMk>p7]#R`p.>s1,Gi%U#k´,M`bSNsNbBhAL<v,ZT9f`G!~aL^>Iq,mZeo?/>4#8c7TpCr:=Lr%T(2#mU7AjV2,fjQ1e9./jw#~i1EMg´DaT_*;@<!D).P?n2Jl&}+$;Z#q(yVno@6K3A_GZx&S;ALhq^;Uh]|d_VWB´j_B´B´J>2}hy0~f.VWS_:s)%7=Fk$S<4^8M@QIjIo(uKq_nr2,bg{<V;;!0mAPSb>f].2%zdQ5%8Ak#S)|2+OTI!dvGmJ5]D1k7Xr{nyFrCj7g2;26XT9j/PJ5%X?M{*1|x&_^_^kp9ltL_rg|Fm2{hgoxZTK[0fX]eg26];w]<H`rrrN4~<;QYpT)p#R]Q:m7YqYl+%0buv{,I;W!J85P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S~H,f:b2i_|84tX?Or8&S/9AEqwpS4s/X+q<mWH^kTtspFnr9_WZe^S7xX[@a?]fD3%aPqyFx@ca])8~nMt{pi|]%$|DP}mI}DW|U7lSv,k~f[P|C>&JicYLdnG})}+~e{98^oes%C9G}/}=ibO@|kmL~Ke=2rPqvKZ`#y=UB+pim67U_x9E0?@P%>InPwpFvbFOGbTcEh3l,@5xQYc(i[A;Z,K#x7!0uwAhUHoF9zU`wi>8,@L+~2~niVtq&m;6D_e6+/YB7rM/:ys%j)<F?3I=`XAkAki5%[5A%3;Wb1=:=2kP@]C~X,z^QVN6`cp[N/)^G(Ib[FfWV1>;XpC$Q??)&^bB7>jWYE"
Data ")%*yJ`J{4bmHz>A|.riv^T&Kz(kv{qslP[)p(RS;aXy!5m#{99^lr?s(9*6MIbIT9$?0@_v@bYSHcsXMBn%9f5.#kQ{Ds%kQ1TR)#WcpHjq)?!5YO_$zoWU8js.pEWqrL+OlWBcnwnKrxiqVPt5CIL+|%gn,q/Mr,q%[eBjB|xmQ^}_P^>&52/9C(f|mD02L>*HOO$`9fA=`´mqaB8X>FSPT7hY4^#Enl8I,SLP!kB+OkKu!QN1bhQ)gdUM8)Uv)EAl(Mcvxd(´<}1}}#g*`a?}sT|Fu9qecNELY#QAAAAr7vbMo>F9BB"


The image is encode in Base91 format. The encoder can be found here (written in AutoIt): http://www.mediafire.com/file/j2ga44sfg ... a.zip/file

Just drag'n drop the file to the GUI and it will generate the FB code.

Who knows, maybe I will convert it someday to FB...
Last edited by UEZ on Aug 03, 2018 9:53, edited 1 time in total.
BasicCoder2
Posts: 3240
Joined: Jan 01, 2009 7:03

Re: Image Conversion

Postby BasicCoder2 » Aug 02, 2018 22:33

TurtleProgrammer wrote:I used an online Hexadecimal converter on an image. To save space here is the first few lines of the output:
data 0xFF, 0xD8, 0xFF, 0xE0, 0x00, 0x10, 0x4A, 0x46, 0x49, 0x46, 0x00, 0x01, 0x02, 0x00, 0x00, 0x01
...

In the example data statement you can reduce the size by placing it in inverted commas and leaving out the 0x part.
When you read the number just add the 0x for conversion to its rgb value.
Maybe this thread will give you some ideas.
viewtopic.php?f=15&t=25440&hilit
sancho3
Posts: 269
Joined: Sep 30, 2017 3:22

Re: Image Conversion

Postby sancho3 » Aug 03, 2018 2:24

Holy smokes I learn something new everyday:
in·vert·ed com·ma
nounBritish
noun: inverted comma; plural noun: inverted commas

another term for quotation mark.
dodicat
Posts: 5086
Joined: Jan 10, 2006 20:30
Location: Scotland

Re: Image Conversion

Postby dodicat » Aug 03, 2018 10:08

lang "qb" allows the use of raw data.
Using lang "qb" is just as effective as lang fb if you have no fancy oop work.
The help docs shows the difference between lang qb and lang fb for keywords.



Code: Select all

 #lang "qb"

#define ulong __ulong
#define valulng __valulng

data FF,D8,FF,E0,00,10,4A,46,49,46,00,01,02,00,00,01
data 00,01,00,00,FF,FE,00,0F,4C,61,76,63,35,36,2E,30
data 2E,31,30,31,00,FF,DB,00,43,00,08,04,04,04,04,04
data 05,05,05,05,05,05,06,06,06,06,06,06,06,06,06,06
data 06,06,06,07,07,07,08,08,08,07,07,07,06,06,07,07
data 08,08,08,08,09,09,09,08,08,08,08,09,09,0A,0A,0A
data 0C,0C,0B,0B,0E,0E,0E,11,11,14,FF,C4,01,A2,00,00
data 01,05,01,01,01,01,01,01,00,00,00,00,00,00,00,00
data 01,02,03,04,05,06,07,08,09,0A,0B,01,00,03,01,01
data 01,01,01,01,01,01,01,00,00,00,00,00,00,01,02,03
data 04,05,06,07,08,09,0A,0B,10,00,02,01,03,03,02,04
data 03,05,05,04,04,00,00,01,7D,01,02,03,00,04,11,05
data 12,21,31,41,06,13,51,61,07,22,71,14,32,81,91,A1
data 08,23,42,B1,C1,15,52,D1,F0,24,33,62,72,82,09,0A
data 16,17,18,19,1A,25,26,27,28,29,2A,34,35,36,37,38
data 39,3A,43,44,45,46,47,48,49,4A,53,54,55,56,57,58
data 59,5A,63,64,65,66,67,68,69,6A,73,74,75,76,77,78
data 79,7A,83,84,85,86,87,88,89,8A,92,93,94,95,96,97
data 98,99,9A,A2,A3,A4,A5,A6,A7,A8,A9,AA,B2,B3,B4,B5
data B6,B7,B8,B9,BA,C2,C3,C4,C5,C6,C7,C8,C9,CA,D2,D3
data D4,D5,D6,D7,D8,D9,DA,E1,E2,E3,E4,E5,E6,E7,E8,E9
data EA,F1,F2,F3,F4,F5,F6,F7,F8,F9,FA,11,00,02,01,02
data 04,04,03,04,07,05,04,04,00,01,02,77,00,01,02,03
data 11,04,05,21,31,06,12,41,51,07,61,71,13,22,32,81
data 08,14,42,91,A1,B1,C1,09,23,33,52,F0,15,62,72,D1
data 0A,16,24,34,E1,25,F1,17,18,19,1A,26,27,28,29,2A
data 35,36,37,38,39,3A,43,44,45,46,47,48,49,4A,53,54
data 55,56,57,58,59,5A,63,64,65,66,67,68,69,6A,73,74
data 75,76,77,78,79,7A,82,83,84,85,86,87,88,89,8A,92
data 93,94,95,96,97,98,99,9A,A2,A3,A4,A5,A6,A7,A8,A9
data AA,B2,B3,B4,B5,B6,B7,B8,B9,BA,C2,C3,C4,C5,C6,C7
data C8,C9,CA,D2,D3,D4,D5,D6,D7,D8,D9,DA,E2,E3,E4,E5
data E6,E7,E8,E9,EA,F2,F3,F4,F5,F6,F7,F8,F9,FA,FF,C0
data 00,11,08,02,D0,05,00,03,01,22,00,02,11,00,03,11
data 00,FF,DA,00,0C,03,01,00,02,11,03,11,00,3F,00,F7
data FA,28,A2,98,05,14,51,40,05,14,51,40,19,BA,EF,85
data 34,5F,10,A8,FB,6D,BF,EF,47,DC,B8,88,F9,77,11,FA
data 6D,95,7E,71,8F,63,59,AB,A6,F8,C3,C3,40,7D,8A,ED
data B5,FB,34,0A,3E,CD,74,C5,6F,15,46,72,12,52,5B,CC
data C0,C6,37,30,26,BA,4A,29,31,D8,C7,D2,BC,5F,A5,6A
data 4F,E4,39,92,C6,E9,78,7B,5B,A5,F2,E4,53,E9,9F,BA
data DF,81,AD,47,86,39,D0,A4,88,1D,0F,55,61,90,6A,AE
data B1,E1,DD,23,5D,8B,CB,BE,B5,8E,43,FC,32,81,B6,64
data 3E,A9,22,E1,81,1F,5A,C8,FB,07,8B,BC,2E,73,61,29
data D7,2C,47,FC,BB,4E,D8,BA,8C,7F,B1,23,67,7F,7F,BC
data C2,A2,C2,31,BC,6F,FB,3D,78,1B,C6,1E,64,C9,6A,BA
data 65,DB,64,FD,A2,D5,76,31,27,B1,00,81,8C,F5,F5,AF
data 22,F1,8F,EC,F1,E3,AF,08,48,6E,74,FD,BA,AC,08,49
data 47,B7,2C,2E,40,CE,78,45,E3,D3,23,78,1D,EB,E8,3D
data 1B,C6,9A,4E,AE,E6,06,32,69,F7,6A,71,25,95,EA,F9
data 33,27,D3,3F,23,0C,F7,0D,5A,E5,55,C1,56,00,83,D4
data 1E,F5,0E,29,85,8F,97,3C,1F,F1,A3,C7,7E,05,9D,6D
data A7,96,E6,78,10,FC,D6,77,A1,B2,31,D7,1B,C6,7A,7E
data 55,EB,DE,09,FD,A3,BC,1F,E2,4F,26,DF,51,63,A4,DD
data B8,1B,84,BC,41,93,E8,F9,3D,7B,64,D7,47,E2,CF,85
data BE,0C,F1,8C,4C,BA,8E,9B,07,99,83,B6,78,D1,52,65
data CF,A3,2E,0F,15,E4,7E,36,FD,96,35,BD,28,3D,C7,85
data AF,BE,D9,02,E4,8B,5B,8C,89,40,1D,02,BE,E3,FA,D1
data 1000000

data "23",34,f,"56",ff

dim as ulong u
dim as string s
do
read s
if s="1000000" then exit do
u=valulng("&h"+s)
print u;
loop
print
sleep



 

Return to “Beginners”

Who is online

Users browsing this forum: No registered users and 3 guests