graphics: create bmp files from scratch

Post your working scripts, libraries and tools
User avatar
jeeswg
Posts: 6902
Joined: 19 Dec 2016, 01:58
Location: UK

graphics: create bmp files from scratch

24 Jul 2017, 18:35

Note: the script is designed to give the exact same binary data as MS Paint did in Windows XP, so if you created an image in MS Paint and saved it as a 24-bit Bitmap, and created an image with the same pixels via this script, the files would be identical.

The bmp file in this example is 54 bytes of header data, and the rest is a block of 3-byte values (1 byte per red/green/blue), plus padding bytes if required, so that each row of pixels takes up a multiple of 4 bytes. E.g. in a 4x4 image, you would just have an array of 16 3-byte values, with no padding, to give 16*3=48 bytes of data. E.g. in a 3x3 image, you would have an array of 9 3-byte values, however there would also 3 bytes of padding at the end of each row of pixels to give 9*3+(3*3)=36 bytes of data.

You can create images fairly easy using the Gdip/Gdip_All library, however it's good to be able to create images from scratch.

Code: Select all

;create bmp by jeeswg
ListLines, Off

;q:: ;create bmp
;list of colours:
vListRGB := " ;continuation section
(
FF0000,00FF00,0000FF,FF0000,00FF00,0000FF
00FFFF,FF00FF,FFFF00
800000,008000,000080
008080,800080,808000
)"
Sort, vListRGB, F JEE_SortReverseList

;e.g. dimensions:
;4x4 = 16
;16x16 = 256
;4096x4096 = 16777216

;get dimensions:
vImgW := 0
Loop, Parse, vListRGB, `n
{
	vTemp := StrSplit(A_LoopField, ",").Length()
	if (vTemp > vImgW)
		vImgW := vTemp
}
StrReplace(vListRGB, "`n", "", vImgH), vImgH += 1
MsgBox, % vImgW " " vImgH

;produce the header:
vStride := vImgW*3 + Mod(vImgW, 4) ;3 bytes per pixel + padding per row
vSize := vStride * vImgH ;bytes per pixel row * row count
;the +1 below is there because we insert a UInt (4 bytes),
;in order to insert 3 bytes, so it might go past
;the end of the structure by 1 byte
VarSetCapacity(vData, 54+vSize+1, 0)
StrPut("BM", &vData+0, "CP0") ;(identifier)
NumPut(54+vSize, vData, 2, "UInt") ;(file size)
NumPut(0, vData, 6, "UInt") ;(reserved)
NumPut(54, vData, 10, "UInt") ;(bitmap data offset)

;produce the header (BITMAPINFOHEADER struct):
NumPut(40, vData, 14, "UInt") ;biSize
NumPut(vImgW, vData, 18, "Int") ;biWidth
NumPut(vImgH, vData, 22, "Int") ;biHeight
NumPut(1, vData, 26, "UShort") ;biPlanes
NumPut(24, vData, 28, "UShort") ;biBitCount ;(1=Monochrome, 4=16 Color, 8=256 Color, 24=24-bit)
NumPut(0, vData, 30, "UInt") ;biCompression
NumPut(vSize, vData, 34, "UInt") ;biSizeImage
NumPut(0, vData, 38, "Int") ;biXPelsPerMeter
NumPut(0, vData, 42, "Int") ;biYPelsPerMeter
NumPut(0, vData, 46, "UInt") ;biClrUsed
NumPut(0, vData, 50, "UInt") ;biClrImportant

;add pixel colour data
vOffset := 54
Loop, Parse, vListRGB, `n
{
	Loop, Parse, A_LoopField, % ","
	{
		vNum := "0x" A_LoopField
		;putting UInt 0x00AABBCC puts bytes 'CC BB AA 00'
		NumPut(vNum, &vData+vOffset+((A_Index-1)*3), 0, "UInt")
	}
	vOffset += vStride
}

;create the file:
vPath = %A_Desktop%\z bmp %A_Now%.bmp
if FileExist(vPath)
	return
oFile := FileOpen(vPath, "w")
oFile.RawWrite(vData, 54+vSize)
oFile.Close()
Run, % vPath
return

;==================================================

JEE_SortReverseList(vTextA, vTextB, vOffset) ;for use with AHK's Sort command
{
	return vOffset
}
==================================================

A similar example which uses the Gdip/Gdip_All library instead:

Code: Select all

;GDI+ standard library 1.45 by tic - AutoHotkey Community
;https://autohotkey.com/boards/viewtopic.php?f=6&t=6517

q:: ;create bmp via the Gdip/Gdip_All library
ListLines, Off

;list of colours:
vListRGB := " ;continuation section
(
FF0000,00FF00,0000FF,FF0000,00FF00,0000FF
00FFFF,FF00FF,FFFF00
800000,008000,000080
008080,800080,808000
)"
Sort, vListRGB, F JEE_SortReverseList

;get dimensions:
vImgW := 0
Loop, Parse, vListRGB, `n
{
	vTemp := StrSplit(A_LoopField, ",").Length()
	if (vTemp > vImgW)
		vImgW := vTemp
}
StrReplace(vListRGB, "`n", "", vImgH), vImgH += 1
MsgBox, % vImgW " " vImgH

pToken := Gdip_Startup()
pBitmap := Gdip_CreateBitmap(vImgW, vImgH)
pBrush := Gdip_BrushCreateSolid(0xff000000)
G := Gdip_GraphicsFromImage(pBitmap)
;background is white by default, this makes it black
Gdip_FillRectangle(G, pBrush, 0, 0, vImgW, vImgH)
Loop, Parse, vListRGB, `n
{
	vY := A_Index-1
	Loop, Parse, A_LoopField, % ","
	{
		vX := A_Index-1, vColRGB := "0x" A_LoopField
		Gdip_SetPixel(pBitmap, vX, vY, 0xFF000000 + vColRGB)
	}
}

;save the file as a 32-bit bmp or a png:
vNow := A_Now
;vPath = %A_Desktop%\z bmp %vNow% 32-bit.bmp
vPath = %A_Desktop%\z png %vNow%.png
Gdip_SaveBitmapToFile(pBitmap, vPath, 100)

;save the file as a 24-bit bmp:
;e.g. file should be identical to 24-bit bmp made via MS Paint (Windows XP version):
;PixelFormat32bppARGB := 0x26200A
;PixelFormat24bppRGB := 0x21808
pBitmap2 := Gdip_CloneBitmapArea(pBitmap, 0, 0, vImgW, vImgH, 0x21808)
vPath2 = %A_Desktop%\z bmp %vNow% 24-bit.bmp
Gdip_SaveBitmapToFile(pBitmap2, vPath2, 100)

Gdip_DeleteBrush(pBrush)
Gdip_DeleteGraphics(G)
Gdip_DisposeImage(pBitmap)
Gdip_DisposeImage(pBitmap2)
Gdip_Shutdown(pToken)
Run, % vPath
return
==================================================

Some notes on padding bytes:

Code: Select all

pixels per row, padding bytes = mod(pixels per row, 4), colour table
1 1 BGR#
2 2 BGRBGR##
3 3 BGRBGRBGR###
4 0 BGRBGRBGRBGR
5 1 BGRBGRBGRBGRBGR#
6 2 BGRBGRBGRBGRBGRBGR##
7 3 BGRBGRBGRBGRBGRBGRBGR###
8 0 BGRBGRBGRBGRBGRBGRBGRBGR
Links:
Bitmap Format.
http://atlc.sourceforge.net/bmp.html
BITMAPINFOHEADER structure (Windows)
https://msdn.microsoft.com/en-us/librar ... s.85).aspx
Top-Down vs. Bottom-Up DIBs (Windows)
https://msdn.microsoft.com/en-us/librar ... s.85).aspx
For RGB DIBs, the image orientation is indicated by the biHeight member of the BITMAPINFOHEADER structure. If biHeight is positive, the image is bottom-up. If biHeight is negative, the image is top-down.
Image Stride (Windows)
https://msdn.microsoft.com/en-us/librar ... s.85).aspx
windows - Why are bmps stored upside down? - Stack Overflow
https://stackoverflow.com/questions/834 ... pside-down
[MS-EMFPLUS]: PixelFormat Enumeration
https://msdn.microsoft.com/en-us/library/cc230858.aspx
Last edited by jeeswg on 26 Jul 2017, 18:18, edited 4 times in total.
homepage | tutorials | wish list | fun threads | donate
WARNING: copy your posts/messages before hitting Submit as you may lose them due to CAPTCHA
User avatar
SpeedMaster
Posts: 400
Joined: 12 Nov 2016, 16:09

Re: graphics: create bmp files from scratch

26 Jul 2017, 02:17

Very Nice !!! :o
Thanks for Sharing ! :bravo:
Here an example with big image :lol:

Code: Select all

;create bmp by jeeswg
ListLines, Off

;q:: ;create bmp
;list of colours:
vListRGB =
(
4F6686,6785A2,648EA5,3F6D7F,173949,021F2E,314459,71889E,517089,7496B3,758EB0,9FB1D6,ACB2D7,B4BDDF,90A3C4,63809F,6586A7,446D8D,4E7D9C,6497B1,689AB1,729FB4,1B3D54,0D2E42,577B8D,4C7889,4B8094,6CA6B9,5E94AB,5E8CA4,6D89A8,6B809C,152339,050E1B,1F2227,131817,000C0E,718890,728DA2,324E6D,687DA3,6A83A5,496B82,406D78,61959B,447377,395762,435965,152B37,556673,485263,4A5367,1D2843,031B37,5584A0,5E9CBA,62A8C6,6CB3D4,70B0D3,74AED2,75ABCE,72A8CB,649EC1,457E9E,093854,315C77,5682A1,416D8C,4B7495,5F86A6,6A8CA9,63829B,91ACC0,A4BECE,859EAE,567080,6D8B9C,4B6C80,3D637B,355D76
586381,526580,597A8E,7498AA,82A3B2,708D9C,4E6878,375266,5C7F93,88AAC2,819DBB,899CBD,687294,808AAC,A0B4D3,ACC6E4,92AED0,6A8BAC,5F85A3,6C93AF,769BB5,87A7BE,38526A,40586E,809EB1,65899B,568496,6C9BB0,537F96,597E98,6A82A0,606E8A,091527,07101A,25292E,0C1616,000506,638085,577888,05243D,162E4C,1E3652,2B4C5F,5D8794,82B3BD,33606D,0A2D41,1D3C53,00132B,233B53,0C1D37,283652,2D3F5C,34526F,81B0CC,71ADCB,6BAECD,71B6D7,6BABCE,74ADD4,7DB2D7,77ABD0,7AAED3,7BADD1,3F6C8D,5783A2,6591B0,3E6A89,4D7494,6389A7,547791,2B4A61,132F40,0A2434,0E2937,547180,9CBDCD,597D8F,61869C,89B2C9
251D34,08061C,0B1527,384B5A,304C57,6C8C97,7CA0AA,183E4A,001F2D,002436,2C4B60,7D95AD,344663,000016,061835,344665,8093B6,7B8EB1,7283A4,8695B5,96A1BF,B2BDD8,414A65,323E56,9BACC1,AEC3D8,6A8298,8DA7BF,95ADC5,4F647F,8492AE,424962,131422,20232B,091418,000508,072629,51777B,638A92,002730,001520,001826,000D1C,AFD0E3,8CB5CC,42718D,407094,34628B,2E5784,294D7B,183863,08274E,2F4F72,597F9F,2A5877,437A99,7EBEDD,74B4D7,65A3C9,6FA7D0,81B2DE,7BA5D2,7297C3,759BC5,567FA6,49759A,5A85A6,547D9D,507793,5F839B,8FB0C4,83A4B4,658291,6D8A98,486573,001B28,3D606E,7296A6,A7CDDF,759DAF
28243D,27283D,111A2E,071B2C,000A19,163C48,8CB8C5,90BDCA,648F9E,557B8D,1C3F53,325168,8FAAC5,829CBA,5E7896,344C6A,031532,12203C,111C37,1F243D,4C4E66,C8C9DE,5D6174,000114,1E2839,243141,111F31,394759,627083,7E899D,626A81,414557,12111B,1F2227,18262C,203A40,22484D,5A888F,59878E,1D4950,002028,092934,1E3C4D,A7C9E1,80A9CA,5384AC,4C84B3,538CBF,5082B7,5C8BBF,638BBC,5A80AA,34587C,2B5171,466F8F,487695,6398B9,98D0F3,8DC6ED,78AED7,88B7E3,8CB6E1,7FA0CD,698BB6,5981AB,5781A6,5F88A9,658DAA,6E91AB,7E9EB5,B9D9EC,BEDDEC,90ABB9,7C98A3,BFDCEA,5F7F8C,618291,B3D6E4,9FC1D1,567A8A
566A89,465E7C,375371,0E314B,001E35,00283D,55849A,80AFC5,8BB7CE,B0D9F2,81A8C4,648AA8,97BEDE,83ACCD,8CB7D8,B5DDFA,133144,021726,000C19,101C28,2B343E,ADB4BD,5A6067,00030A,0A1519,202C30,09181B,09181B,152127,364047,2C313A,1B1D27,1B1C26,1D242D,0A1C27,06242F,001F2C,3B6A78,3F7080,346273,355D70,31566C,496E88,82A8CA,5785AE,487EAD,3675A8,4482B8,5F98CC,5384B4,537DAA,759AC0,38597A,5C7A97,87A5C2,7395B2,3F6686,043153,6999BD,AADBFF,78A7CD,6C97BE,7097BD,5D84AA,688FB5,7CA2C5,779DBD,7092AF,8CABC4,ADCADF,C9E5F6,AEC8D8,4A6170,405864,CDE7F5,ADC8D6,98B5C4,C3E1F2,86A4B7,6B899C
6383A6,5F7FA2,7DA3C3,87AECE,729AB7,537B97,5C839F,678CA8,7090AD,7E9CB9,6F8CAB,8CADCE,90B6D6,87B0D1,80AED0,9AC7E2,8AAEBE,5E7B84,243D47,081B23,16262C,A6B2B6,788387,3E4A4C,435052,162625,000D0F,000D0F,0F1B1D,0A1316,2A2E33,23252D,262832,2A343E,152A39,001525,001A2F,46778D,5889A3,5B8BA7,4E7A97,345D7E,3D6588,4E7AA3,4172A2,4D87BB,3E81BA,4487BE,3F7AAC,4074A2,6A96BF,476B8F,001C3B,2D435F,6F84A0,A0B6D2,6985A4,325374,33597B,5A84A7,6996B8,6491B2,6290AF,6E9AB9,557C9C,6D90B1,7FA1BF,7C9AB5,A0BCD4,C3DCF0,B2CADC,A2B9C8,425864,7D909D,C0D5E4,C5D9EA,B3C9DB,8CA4B6,61798D,738CA0
59779A,7B99BC,7998B9,A0BCDE,829EBD,7B93B1,A2B6D5,7D8BA8,808AA8,9DA7C5,97A1BF,7C8BAB,566B8A,7E9AB8,9EC0DE,99C1DA,A4CCDE,B7DEEC,BBDCEB,9AB5C3,7C929E,AFC1CC,7D8E97,8799A0,C0D2D9,4A5E63,475A61,3C4E55,1D2A32,000912,050914,121621,171E27,1B2935,102737,00091D,002641,406F8E,4E81A2,5283A9,6896BF,4875A0,396692,4474A4,4379AE,4B8BC2,4187C3,3B80B9,5492C2,5A8EB7,729EC3,06294A,021A36,081933,33405A,6A7791,6C7C99,687D9C,001130,001533,436D8A,5D8AA5,73A4BA,6C9BB1,6388A4,5C7C99,86A4BF,91ADC5,9EB6CC,A2B8CA,8599AA,C2D5E4,2C3D4A,9DAEBB,8C9CAC,7E8E9F,7E8FA2,66798E,6C7E95,6A7C93
597391,2B4361,728AA8,91A7C3,495B78,2C3854,1D243F,7C7D97,33304A,35314A,726D88,A9AAC4,ADB4CD,627087,51687E,6C899E,7BA0B4,8DB3C5,AECEE1,B3CDDE,BED2E3,A9BCCB,3D4D5D,364653,50626D,495B66,72848F,98A8B4,687480,636B78,4F5260,1B1F2A,000006,001017,0F2635,1A394E,446C89,5785A7,5485AD,5D8CB8,4775A4,406E9D,3A6898,4C7DAF,457EB2,4585BC,4286C1,4083BA,508BB8,5E8FB5,355D80,001938,0F2640,1C2B45,00031B,0E1732,5B6783,20324F,1E3654,153650,0E364F,48758A,6A9AAC,5C8A9C,678CA2,4D6C83,648196,5E798D,5C7486,667A8B,4D606F,96A7B4,495966,97A7B4,8997A9,738193,6C7A90,717F95,7A889F,516178
738197,707E94,253349,142336,111F31,1D2536,3F4153,1D1A2A,221B2A,241929,312432,211825,27232F,12141F,080E19,000A17,000115,3B556D,A4BAD3,A7B7CE,BBC6DC,9BA4B8,22293D,00000E,000718,202A3B,25303E,434E5C,4B5261,848998,A5A5B5,72747F,737A7D,5E6B6D,22373F,173344,1C3E5B,1C4467,2D5781,5C86B3,709AC9,7BA5D4,7EAAD9,7CACDC,588DBF,528CC0,3B7BB1,4683B5,5182AE,77A1C6,87ACCE,627F9E,304761,344861,03122C,3F4C66,7E8CA8,5B6D8A,829AB6,496782,153A50,456F82,527E8F,618C9B,698B9B,628091,5F7B8C,5A7484,5B7583,788E9A,6B7E8B,8495A2,455562,61717E,7D8B9D,818FA1,7C899F,76849A,78869D,5F6D84
4E5D6D,5A6B78,5A6D7C,1A2D3A,172B36,11242C,000F18,17222A,1E242B,1A1922,2A282E,3F3B41,1F1E22,24272B,1F2427,182229,000111,2E3C52,ADB6CA,BBC0D5,C6C7DC,8F8DA1,3F3D50,353545,212433,141A27,3E4451,191F2A,1C202B,30323C,43444E,7F7F85,8E948F,8A9690,415255,3F5561,28445C,1A3B5C,1C4066,4A6D98,4F74A0,6287B3,729AC4,6691BC,3C6C96,477AA5,265F8C,3E719C,769CC6,4E6E92,C2DEFF,738FAD,6D86A0,5F778F,30465F,596E89,556A86,516783,405B76,56748D,3A5A71,264A5C,608494,628593,60808D,6D8A98,67838E,7E98A4,738B97,718792,718590,788A95,40515E,5C6D7A,7A8A9A,7E8E9F,7D8C9F,69778D,738198,73839A
1B333F,0A252F,678792,789DA5,709AA1,305D61,002B2F,002326,072A2D,00171B,02191B,1D3033,152728,263537,1F3130,202F31,020912,434550,C2C0CC,CDC7D2,C4BAC6,695E68,615660,5E565D,454146,4A4C4D,505455,363B3A,2F3433,3C3F3D,535452,262620,3C3E32,393F34,626D6B,2D3A42,1E3243,3D546E,425B7B,486486,415F82,37577A,456889,456B8B,4C7393,6B96B7,5683A4,8DB3D6,96ADD3,56688D,465A7D,607896,7593AC,7696AD,5F8199,5B7D95,547491,93B1CE,5D7997,7B96B1,93ADC5,668195,5F7989,7893A1,74909B,75929B,6E8B94,69848E,748D97,7D979E,6D848C,52676F,374B56,637683,8194A3,708293,758699,6F8395,74879C,778A9F
7792A0,567681,688E9A,518088,76ADB4,85C1C7,76B4BA,5F9CA0,528A8F,407076,325C61,173B41,042227,1B353B,132E32,04181D,0E1720,171923,B8B7C1,D4CED9,6D646E,180F19,423A41,8A868B,2A2B2F,2F3435,394442,313C39,333F39,404B43,545C55,2F352A,282B1B,4A4D3E,1B221B,293235,2B3945,627386,677B94,475E78,5A758F,506E87,5F7E95,48697D,3F6074,3F6074,4F6F86,455E78,646E90,A3A9CC,9DAACA,4B627C,527188,84A9BF,8FB8CE,B8E1F8,8AAFCB,83A5C2,839FBD,7B93AF,72869F,718597,788B9A,667A85,5D777E,5F7C81,6C868C,769096,768D95,6C838B,698088,6E858D,5E727D,4B616C,6E8490,6D8291,6A7E8F,677D8F,72889A,6B8395
7F97AB,264455,4A7082,457686,548F9E,6AABBA,73B8C7,8FD4E3,8CCDDC,8AC5D5,92C5D5,578394,244B5A,214353,21404F,1A3746,021928,213441,B0C0CD,ACB7C5,484F5E,292E3D,353D4A,8E9AA4,45565F,061C22,000E12,173334,264340,122D29,263F3B,364940,2D3425,575A4B,161A14,4E5354,556068,60707D,5D6F80,5E7486,657D8F,597383,66828D,738F9A,66808C,5F7783,6D8493,142435,30314D,3C3A58,4D5671,9AAFC5,A4C4D7,749CAE,7AA5B8,76A1B6,84ACC5,6484A1,7E98B6,7F92AD,717F96,6A7688,6E7987,323E48,293C43,5A7075,798F94,6E8489,6B8187,7D9399,7E949A,6B8187,627981,4C626D,6B818D,677E8D,728998,7790A0,657E8E,678191
4D5E73,152A3F,6E8EA1,386275,0D3F53,4A8398,5A97AB,66A2B8,72ACC2,71A5BC,8AB8D0,6790A9,4F738B,4A6C84,7191A8,9ABAD1,7093A7,678A9E,9AB9CE,7F97AD,394E64,11263C,081D32,647C8E,92AEBF,70929F,597D87,5C838B,5B8186,4D7375,4C6F72,425D5A,3F4A40,343A2F,1B211C,262E2E,515A63,33414D,071825,1F3541,001620,6C888F,5D777D,597276,6E8489,6D8087,55656C,4B5360,221D32,231D34,181E31,0C1F2E,466371,A3C8D6,A7D0DF,749CAF,81A3BB,7691AB,566984,536178,454E62,323948,6E747F,747E85,79888B,819295,829298,76868C,6F7F85,73868B,768990,73868D,657A82,597078,627883,415965,39515D,5A7480,36505C,37535E
000010,232A3D,8D9DAE,829AAC,7897AC,A1C6DC,8FB5CD,668BA5,7C9EBB,7393B0,7591AF,6C88A6,7E98B6,738FAD,8AA6C4,A2C4E1,5C8BA7,5284A0,78A6C5,7AA1C1,476A8B,254667,41607F,6E8EAB,698EAA,83ACC3,89B4C9,8AB5C6,82ABBA,83AAB8,7FA2AF,69868D,617170,333E3C,232F31,243036,A5B1BD,C6D6E3,A0B3C0,A1BAC4,7C99A0,9FBEC1,749293,4A6464,384D4F,3E4F52,222B34,13151F,1C1522,17111C,0E131C,213138,000D13,0A2A30,86A4AF,84A1B0,52677C,39475E,000015,060B20,1D2133,282C37,374044,384144,464D50,555E61,677074,707B7F,7C878B,849094,7D8B91,708086,7F9198,697C84,4F646C,1B313C,00141F,364F59,253E48,3B5660
23242E,363842,0C1421,1E2B39,445464,3B4F61,62778D,8195AE,99AAC5,AFBFDC,8797B4,7688A5,8CA2BE,7893AE,7694AF,7097B3,5688A4,669CBA,5E8FAF,638EAF,5B80A2,6080A3,9CBBDC,BEDBFA,9FBFDC,9ABBD5,7496AE,628397,517184,5A7786,657F8D,677D88,7F9198,4E5E64,162730,21313E,8292A3,ABBFD0,B0C7D6,B2CED9,C5E5EA,567878,183837,244040,6F8485,606F72,373E47,3E3D46,352F34,282527,111615,020E0E,142927,092022,000E15,30404C,0C1326,0D0E23,262438,2F2B3E,11111D,282C31,131E1C,111918,020607,1D1E22,22252A,171B20,2C3035,5E676B,808A91,828E94,86939B,899BA2,64777F,2F444C,31464E,30474F,1F363E,708A91
333634,4F5452,202828,273033,2E383F,050E18,050C1B,000415,5C6176,959BB2,3C475D,16263D,263E54,244559,4B7386,6A98AA,6EA0B4,73A2B8,507990,7496AE,5B748E,3A4F6A,354661,394862,7D8BA2,808FA2,495769,222F3D,19212E,474B56,6B6C76,71767F,30404C,102736,000A1C,1B3045,5C7187,87A0B4,B2CEDF,BADCE9,ADD3D8,113739,0D3131,456463,405759,16242A,151B26,10121A,161413,3C3C36,353C35,202B23,192721,1B2826,1E272A,191B23,312A39,190D1F,312335,231828,0A050E,212526,1C2A24,19251F,252426,231D22,241E23,282429,202026,1A1D22,2C2F37,434B52,5C656E,77848C,ACBCC3,8B9DA4,70838A,1A3036,293F45,6E868C
243030,172422,2B3836,374240,2D3535,383F42,30333B,151722,737685,B6BDCE,3C475B,0F2035,132B3F,082939,3F6675,769FAE,7A9FB3,80A3B7,7E9BB0,9FB7CB,4C5D72,6F7A8E,62697D,070B1E,151827,2A2D3B,30323D,4A4C54,33323B,2A262C,4A4449,7F7F85,465863,263F4F,274054,314C61,7690A8,ACC9DE,B3D3E6,81A2B1,3D5F65,214245,345352,546C6A,18292C,09151B,131924,181A22,1F201C,14150C,22271E,171F15,111912,181F1A,151515,2E282D,251A24,21101D,261522,2E202B,2D282A,0C0F0D,162119,111813,252224,302A2F,332D32,282429,1F1B20,1A1B1F,1B1E22,1B1F24,21272C,1C262D,E7F3F9,EFFFFF,788A91,0E2128,788D95,6B8088
264352,0A2631,172F35,1E3233,13211F,1C2725,384242,010C10,73818D,8797A7,475C71,3C5369,1D344A,233C50,0E2638,496173,637A90,7488A1,4C5C73,A0AEC1,6C7485,575A69,6B6B77,3A3943,29272D,29282C,242627,2D2F30,4C5051,747879,4E5253,3C4548,475C5E,415E63,355260,7596A6,A5C7DE,9ABCD3,BCDDF1,3E5B6A,0E282F,3A4D50,283634,323D3A,151D1D,181F22,0D151C,0E1419,131614,1A1C16,0E100A,171913,171814,181915,181615,373233,2C2627,322C2D,271F20,271F20,272221,1F1C18,24241E,252622,242325,363539,474648,1B1B1B,141414,191A18,1F2220,191B1B,242928,131B1B,687476,7C8B8E,1F2F35,374A52,8397A2,536974
8EBAD1,87B1C4,8FB2BF,6C8A8F,698181,506664,2A3E3F,21373C,3B5762,4C6A7B,7797AE,6B8AA3,7E9CB5,678297,162E42,15293B,526077,222E46,252E42,B7BED1,646A77,93959F,68686E,363537,2D2B2B,3F403E,3C3F3D,333836,595F5E,596160,101A1A,182625,061B1C,001519,4B6A73,B9DBEB,B2D7EB,90B5CB,416174,1E3846,36484F,4D595B,222725,1D211C,111412,1F2324,0E1419,050B10,0D1210,1B1C18,0F100C,161713,181713,1A1915,12100F,262423,14130F,1C1B17,15120E,1B1814,24211D,211E19,282521,272524,27292A,262A2B,2B2D2E,252826,20211F,1C1D19,12130F,22231F,1F2220,252B2A,091313,0A161A,0F1F25,576A72,6A7E89,536975
83BCD6,6AA3B9,87B9CB,92BFCA,A6CED3,5B8185,0A2E34,2F565F,2F5A6B,5D8A9F,4B7A95,2B5A75,6C98B0,77A0B6,61869A,2C4A5B,304154,273345,252F40,BFC8D5,979EA7,767C81,7D8283,444A49,2B302E,424843,323934,121914,69726F,7D8886,3D4747,5C6B6D,3A5153,3A575C,9BB9C4,B7D8E8,AACBDF,7B9CAF,122F3E,445A65,29383B,444C4B,1C1D19,13130D,181615,2C2E2E,111619,000508,0B100E,1D211B,11150F,121610,161713,1C1D19,0C0D09,12130F,0E0F0D,161715,0C0D0B,121311,1C1D1B,191A16,1B1C1A,161917,242627,262A2B,1D1F20,2D2E2C,3E3C3B,4F4E4A,23221E,171814,151816,202625,0C1616,1D292D,405057,677A82,6A7E89,596F7B
6DA9C7,6FA9C6,7AAEC5,7EB0C4,93C0CE,709CA9,648F9E,72A0B2,92C2DA,6698B4,306280,5E90AE,54839E,6591A8,87AFC2,567787,071A29,1E2A36,2A343E,AAB5BD,758084,788484,62706C,3F4B45,313D37,45514B,3B4741,0E1C16,6F7D79,859290,303C3C,2D3E41,2A4248,133039,718E9C,91AFC0,2E4C5F,2C4859,152D39,273940,061010,343833,232119,141109,191612,2C2C2C,141519,080C0D,0B110C,1F261F,141812,0F130D,131712,1D231E,0B0F0A,040A05,161917,1A1F1D,0D100E,0E1311,171C1A,141917,121715,0B100F,121617,1A1C1D,151515,1D1E1C,373534,484743,262521,1D1E1A,272A28,000100,091313,323E42,5D6D74,495B66,667986,4C626E
6293B9,83B3D7,5D8AAB,709AB7,7DA4C0,436B84,6E95B1,77A1BE,95C0E1,6996B8,517EA0,88B3D4,78A0BD,789DB7,496A7E,516B7B,202E3A,19222B,39434A,BDCACC,849291,647571,6B7D76,12271E,10251C,1A2F26,2E433B,1E2F2B,677875,849493,596968,5A6D72,3D5561,2B4857,4B6877,A6C2D3,0A2434,253C4B,01121B,364244,0E1311,39372F,302B22,110C03,0E0A05,242221,19181A,121617,090F0A,202720,101710,080F08,0D140D,1E261F,0B110C,000702,131914,181F1A,0A0F0D,0C1310,181E1D,1A201F,1B2120,131819,131516,111012,1F1F1F,1E1C1B,221E1D,0F0C08,191814,444541,272A28,242928,242B2E,3A444B,68787F,384A55,4F626F,5C7180
325A84,567DA4,23486E,6084A8,8EB0D4,274A6C,2D5175,3F6588,375B83,244B72,00244A,082D4F,294867,58768F,758DA3,97ABBC,5E6872,283135,232F31,A2B0AF,8FA09D,1A2E29,8BA39B,99B4AA,385349,243F35,263E36,102723,1A2F2D,3C4E4F,657679,95A8AF,A9C2D2,637E92,8BA7B8,BDD7E7,001322,2A3C47,1C282E,2F3435,23231D,37352B,373027,171007,110B06,292622,1E1D1F,121415,090D08,1D241D,0F130D,030A03,091009,1C241D,0B110C,000702,0E1510,161D18,080F0C,0A100F,171D1C,192121,1C2424,161B1C,141617,131214,312F2F,211F1E,1C1817,0B0804,21201C,3E3D39,515250,575C5B,575E61,717B82,4D5C65,465863,647786,4D6271
708DB9,90ADD9,7A98C1,819FC8,B1CDF6,9AB8E1,96B4DD,8CACD5,8CACD5,2A4B72,032347,163254,000E2A,1D334C,8EA1B6,98A7B7,666F78,32383D,3F4B4D,A1B1B0,758885,344B46,29463D,92B1A8,6C8B82,66857E,5B7672,4B6363,364B4D,54676C,8999A0,A6B7C4,97AFC3,9CB7CC,AFC8DC,7F96A6,203340,2E3B43,192225,333634,26231E,2B261D,373027,1B160D,110D08,2A2625,202020,0D0D0D,0A0B07,1E221C,10120C,060A04,0C100A,1C231C,0C100A,020902,0D130E,181E19,0C110F,0A100F,14191A,161B1E,161B1E,0E1115,141315,0F0C0E,222020,1C1A19,191514,2D2A26,383531,2D2C28,6F706E,848889,172024,27323A,5D6B77,455663,233645,485C6D
)

vListRGB=%vListRGB%`n
(
7995BE,6E8AB3,95B1DA,7694BD,6A8AB3,81A1CA,8FB2DA,9BBEE6,87A8CF,7F9FC2,8DACCD,89A5C3,8DA7BF,A2BACE,7E92A3,9BABB8,565F69,31373E,3A4549,6C7B7D,758A88,90A9A5,91AFAA,72938C,5A7C76,789995,738F90,799296,778C94,A4B4C0,BAC7D5,A0B0C1,7189A1,AFC9E1,91A9BF,647889,1A2A36,243036,1D2427,424543,282822,221F17,312E26,13100B,020100,181818,1B1D1E,0B0D0D,0B0C0A,21221E,151410,0C0E08,11130D,21231D,0F110B,060A04,0B0F0A,191D18,0F1111,0E1010,14171B,14171B,13161B,0A0B0F,2B2A2E,0D0A0C,131111,2A2828,1E1A19,403D39,524F4B,5A5857,838383,3E4344,010A0E,3B464E,4E5C68,162636,273B4C,405767
0A2D4F,0A2D4F,2C5074,13395C,567DA3,6892B7,608AAD,77A2C3,628BAB,80A7C3,7DA3BB,7598AC,88AABA,8CADBC,7C9CA9,8CA4B0,5F6B77,3E444F,364149,324248,D2E7E9,708A8A,506F6E,658584,4F6E6F,678687,92ACB2,546B73,3D505D,A0AFBF,909CAE,818FA5,607791,7F9AB4,688094,8A9EAF,2E3E4A,1F2B31,1E2528,292E2D,242725,3A3D3B,404341,242626,101415,111617,0E1316,0E1213,080808,161413,14100F,050400,0E0E08,24241E,21211B,090B05,11120E,181915,101010,070707,0E0D11,141317,110F15,0F0E12,1C1B1F,141315,131111,1D1B1B,2B2726,3C3837,4F4D4C,60615F,3D3F3F,161B1E,353E42,66737B,0A1A27,283B4A,677E8E,688092
4C6C89,4F718E,1D415F,507696,6D96B6,7099B9,6D97B4,638BA7,2F556D,173C50,5A7C8C,6E919F,7496A3,89ABB8,7FA1AE,7B96A4,4D5C6C,242C3D,2C3745,152531,70858D,71898F,96B1B5,7B989C,759296,6D878D,60777F,485B68,98A8B8,A3AFC1,4F576E,26324A,A1B9D1,9EB8D0,60788C,90A3B2,33444D,041218,2A3539,121B1E,161F22,3B464A,293438,1D292F,2B373D,283438,242F33,20272A,161517,191717,151011,0A0807,0C0905,10100A,10100A,0A0A04,12110D,1B1A16,171514,110F0F,181517,1B171C,141016,0F0B10,201F23,111012,161414,131111,2A2827,2F2D2C,4A4847,545553,060A0B,394043,5F6A6E,26363D,243542,526677,688092,748E9F
829AB2,859FB7,415F78,87A5C0,80A1BB,7495AF,7B9AB3,5F7C91,000D1D,000715,000610,00010B,1B3541,1A3543,375665,8FA9BA,8495A8,505E71,4A586A,1C2C3C,162936,465A65,AFC6CE,BAD2D8,ACC2C8,93A8B0,7D8F9A,8898A5,B4C1D1,60677A,161A32,2F3A50,99B0C6,88A0B6,586E80,8DA0AD,495A63,00060D,293940,2B3D44,32444F,6E818E,687E8A,0D232F,021824,22373F,11232A,222E34,15181D,2E2D31,322F31,1E1E1E,1C1A19,292824,25251F,11110B,0E0E08,14130F,0F0B0A,090405,120D0F,181217,160F16,141015,222125,101213,202020,181818,363735,272826,3A3B39,363937,2B3031,778083,3B474D,0A1B24,617483,728999,6D869A,334E62
748598,42556A,273C52,253C52,2A425A,3F566C,647A8C,617483,02101C,06131B,00070D,1D2D34,3E505B,061D2D,4E677B,7C94AA,8095AB,7B8BA2,4F6075,0F2132,102332,596D78,758890,45565F,73858C,A8B8BF,CCD8E2,B3BCC9,5C6372,2B2F41,0C1023,20273B,72859A,819BAC,7D94A3,798F9A,475A62,000E16,061C27,102A38,5C7889,A2C1D6,A1C2D6,81A2B6,446275,001927,031C26,1A2C33,313940,25282D,181B1F,1C2021,262B2A,282B29,1F231E,171913,242620,272923,201F1B,181615,1C1A1A,1D1A1C,171318,161217,191B1C,0B0D0D,151717,101212,272826,131614,191C1A,101514,485050,485456,16242A,4E6169,5E7382,516B7C,7391A4,18374C
50576A,020C1E,131E32,00071D,000D23,081629,11192A,050B16,1B1E23,1F2024,040509,2B3138,4F5A68,000417,031833,071F3B,0E253F,1C324B,11263B,1B2F41,455867,8597A2,7F8E97,5A676F,424C53,495158,80868D,757A83,20222D,10111F,0D0E1C,2C3342,415463,37515F,546C78,8BA2AA,5B727A,051E28,2A4755,537487,A0C8E1,76A0BD,82B0CF,8CB8D5,91B9D2,7CA2B4,30525F,112A34,23323B,2F3841,2E363D,20292C,162020,1B2421,242E28,2A322B,192117,202720,222620,222621,2C2D2B,292929,201F21,1D1C1E,222425,151A19,101514,131816,191C1A,111614,0E1311,0D1312,293333,374347,1F3138,485E69,7790A0,476374,204053,35566A
5B6576,1F2C3C,283649,1B2A3D,000B1E,061323,111926,151B22,1E1D1F,080808,121415,32383D,596676,43586E,4B6786,567294,223F5A,173149,263E54,3A5062,1F3241,172733,38434B,5C646B,575D62,5C5F63,727377,292A2E,131319,23222B,22212A,202730,566873,405864,455C64,A4BBC3,4E686F,001722,5B7F91,80AAC1,7CABCB,82B6DA,78AFD4,7BB1D4,74A3C2,7FABC2,95BCCB,688893,1C303B,2F3E47,43535A,526164,546463,4C5B57,3C4C45,314038,233126,263127,202821,1C241D,232924,222725,1F2121,212324,262B2A,222726,212624,2C312F,2A2F2D,222926,151C19,121A19,000707,536265,31444B,223B45,9AB4C4,5E7C8F,17384C,486B7F
738A99,627C8A,7690A1,516B7C,102A3A,263E4A,1F3239,1A292B,1A2320,3E4744,263331,23363B,718A9A,6B8CA6,4B7598,7FA9CE,6688A5,6A899E,688397,385161,152835,112029,222C33,151A1D,141617,171717,2A2828,1D1B1B,252525,151416,19181A,272D32,5A6D74,86A0A7,4C646A,627C82,2C484F,436572,8FB6CC,79A8C4,79B0D5,6AA6D0,80BDE9,80BDE5,78AECF,80B1CB,8BB7C8,A8CBD9,A7C1CD,566A75,192E36,293D42,455A5B,485D5A,546961,70837A,5B6C61,56665B,48564B,3A473F,37413B,303734,272C2B,282D2C,222827,1C2221,232A27,242B28,282F2C,161D1A,101714,081311,22302F,58696C,778A91,546D77,334D5D,2D4D60,3E6175,193E54
5B7B88,4E707D,7799A9,254959,113343,7293A2,75939E,6C888F,6A8085,5B6F74,081E24,00121C,19394C,3A5F79,5E89AA,618AAB,5E7D96,688293,4C6575,112431,263440,2E3941,33393E,1D1F20,191919,252322,181413,252322,191716,252624,2C2C2C,161E1E,798F95,94B1B8,1D3940,213E47,446471,90B1C4,7DA5BE,7CA9CA,75A9CE,7BB2DD,6BA6D3,68A4CE,76B0D4,7BB2D1,7DB0CA,82AFC4,93B4C7,A7C4D3,87A4B2,3F5B66,1A363D,304C4D,486360,47615B,4E655D,566B62,5A6D64,5F7067,63716B,596462,495151,424B4E,2E3D40,182A2B,1B2A2C,051312,131F1F,000A08,101B19,121C1C,000C0E,132225,6C7E85,465C67,000313,486979,53768A,51768C
527982,658B97,598291,477184,325D72,6892A9,5E87A0,5B849D,507990,001C34,00162D,1D3D54,0B2B42,16364D,486780,6B869B,758798,4B5965,2D3943,2C353E,2A3239,23272C,1B1F20,1A1A1A,181615,1D1B1A,1D1C18,201F1B,252322,1D1E1C,1A1B19,192323,5D7A7F,89ACB6,2E515F,3C5D70,8DAFC6,7FA2BC,7CA0BE,85AACC,80A6C9,7FA9CE,80ADD3,79ADD2,73ACD3,79B6DE,79BAE1,72AED2,7AA9C5,8FB8CF,A3C9E1,9FC4DA,6B8FA1,294A59,1E3F48,446366,34514E,415B55,4B615C,465A55,41524F,485557,3F4950,1D2E37,00202A,042D36,10343A,254348,33494E,6D7E81,576365,020B0E,10161B,0B151C,4D5A62,4E606B,1C3644,617F90,092C40,52778B
133B47,3A6470,376472,6B99AB,3E6C84,1A4A66,6899B9,70A0C2,72A0C2,4B7697,49718E,50738D,5E7D96,648196,6D8597,6C7F8E,5F6B77,313841,1B2128,2C3237,33363A,222627,1A1A1A,191919,1B1918,1F1D1C,1C1B17,1E1D19,252624,232422,161917,091515,536F76,456875,254959,95B8CC,89ACC6,7A9AB7,7E9DBC,9BB8D7,88A5C4,6B8AA9,8AADCE,9EC9EA,6FA3C8,619CC4,73B4E0,6EAED7,81B7D8,7FB1CF,81B0CF,94C0DD,A2CDE8,89B2C8,4B7281,153A42,305154,304F4C,304D4A,28403E,1A2E2F,1C2F34,2D3B47,2D434F,46707D,3F6F7B,58818A,698D95,8DA7AD,677A7F,000408,0C1217,0B1116,2A3239,1F2933,192935,2D4453,334F60,6F90A4,476A7E
0E3845,15414E,507C8D,77A6BB,6797AF,6292AE,79ABC9,6998B8,4F7C9D,517A9A,648BA7,4F7189,59788F,728DA1,7A91A1,617481,222E38,2C333C,373D44,30363B,1D2024,131718,181818,161616,1A1817,2E2C2B,353634,2E2F2D,262626,1E1E1E,1E2020,212A2D,425C62,13333E,89AAB9,A0C1D4,234257,05243B,314D65,4F6981,3B5369,395469,5D7C93,89ADC5,8AB4D1,74A7C8,71A8CD,77B2D9,78B0D3,76AFCF,78AECF,7AB0CF,88BAD8,99C9E1,93C1D3,78A4B1,2A5257,1B4141,274949,4B6A6B,678286,768D95,7E919E,7892A0,6F919E,688C96,678891,7F9BA2,5F7279,000E14,000307,141A1F,161C23,485057,17212B,22323F,081F2F,364F63,325166,37576E
2F5A69,3C6977,80AEC0,37667B,22526A,7FAFCB,6C9BBA,6291B1,5884A3,547C99,4A6F89,37576E,5C7A8D,7790A0,506672,32444F,2F3C44,364047,313A3E,171E21,020708,111615,2D2F2F,393939,4B4948,403E3D,2F302E,2A2B29,2E2E2E,262626,191B1B,121B1E,485E64,93B1BC,93B3C0,7E9DAC,132F40,092334,051E2E,051C2B,0E212E,1E313E,314655,536D7D,7E9FB3,88B0C9,79A5C4,6FA2C3,74AED1,6AA8CC,73AFD3,7BB5D8,7BB1D2,83B8D3,93C5DC,99CADA,90BEC6,7AA5A8,739A9C,76999C,6D8D93,65818C,6A8393,728B9B,66808C,4F6B72,859CA4,5B6E75,0D1B21,000509,0F181C,091216,2D353C,333C45,15232F,041424,0A2032,677F95,07233B,436279
3B6778,78A3B6,85B2C7,528197,3E6E86,83B2CE,6694B3,4F7D9C,325C79,436A86,486C84,506F84,738D9D,6E8692,2C404B,3B4D54,445056,1F2A2E,111A1E,232A2D,323738,363B3A,3E4040,424543,40413F,2E2F2D,1D1D1D,202020,262829,1F2122,212324,2E3439,7F929A,8BA6B0,7B97A2,526E79,011B29,132935,01161E,0E2126,1B2A2D,111E20,1E2D30,2E4047,3E5460,728C9D,97B5CE,83ABC8,71A9CC,63A4CA,6CABD1,7CB7DE,7FB9DD,7DB4D3,7BB0CB,7EB1C5,85B7C3,73A3A9,6A9499,678D92,5E818B,5F7F8C,678394,6E8595,74858E,6B797F,5B696F,091519,00070B,121D21,121D21,061017,030E16,1B2731,11212E,102233,061E32,314961,1E3953,3E5973
315C6F,416C81,2D5970,538298,6896AE,75A4BF,4C7895,507C99,2F5773,264C64,6F90A4,809EAF,56707E,445B63,374950,45555B,1D292D,212D2F,3A4346,505A5A,515756,444A49,3C3F3D,333634,20211F,232422,252525,282828,212324,1A1B1F,323337,565C63,7E9199,617985,1A3440,4B636F,728893,0C2228,0F2023,162423,17201D,1C231E,1F2621,1C2423,1C282E,394955,6D7E91,88A6BF,77AACB,76B4DA,70ABD2,68A1C8,76ABD0,7FB4D5,7EB0CC,7DAEC4,6A99A7,5D8B93,5E858D,668A90,6B8B96,6C8795,5A7284,465968,3E4750,4A4F52,151C1F,080F12,212A2D,081317,000B0F,000D13,35444D,2D3E4B,445869,51697B,284058,07223C,6E89A4,7F9CB7
295469,224D62,4C788F,85B1C8,8CB8D0,73A1B9,3B6681,58849C,7FA8BF,3E6379,7191A4,5F7A88,4A636D,42585E,3B4B51,162527,2B383A,4D5959,626C6C,4A5454,2F3534,303635,3D403E,363937,3D3E3C,363735,292929,272628,2F3034,2F3034,282B30,242B34,162734,152C3B,3A5462,90A8B4,637A82,1A2E33,041413,19251F,131B11,303429,292A20,1B1D17,1F2324,141C23,212A38,485D73,6891B1,7EB0D4,77A8CE,6E9EC2,89B6DB,8EB9DA,6B96B1,567F95,6A919F,648991,618187,547077,3D535E,2E414E,2C3C4D,2E3947,35383D,0D0C0E,131516,13181B,121B1E,0C181C,05151B,64777E,BDD3DE,526C7A,657F90,173548,2B4962,0F2D48,53718C,42607D
83ACC2,769FB5,8CB7CC,90BAD1,7FA9C0,6C96AD,5F89A0,628BA2,3F647A,2B4C5F,304F5E,000813,516870,4D6166,2C3D40,273638,637170,5A6666,4D5757,394343,2F3736,353B3A,343937,262927,2D2E2C,343533,2D2C2E,252426,2D2E32,323337,21232B,0D131E,122232,546D7D,768F9F,58727E,4D636E,14282D,253633,18251D,171D12,1B1E0F,242418,26241C,20211F,22252A,272B36,192739,24425D,6389A9,81A7C7,86A9CB,96B7D8,83A2C1,607F98,618194,56727D,3D575E,2F454B,2D4045,28353D,262F39,282D3C,2A2B39,1B1A1E,1B1A1C,151718,3A4144,313C40,0C1C22,273D43,95B0BA,607D8B,486978,325366,001930,153951,84A7C1,385A77,153754
81A6BA,507589,234B5E,335A70,275066,3F687E,375E74,6C91A5,567A8C,3F6070,000917,00151F,486066,455A5C,3C5051,6F8180,6C7A79,768483,445050,343E3E,3D4544,3B4140,1E2321,373C3A,383B39,303331,1E2021,181A1B,25262A,2E2F33,292B33,202631,3B4D5E,5F7789,6B8395,748E9C,5D7581,172D33,2F3F3E,232F29,2C3227,323428,1F1E14,19170F,2C2A29,232329,191B26,272F40,102338,0E243D,556A85,92A7C2,778AA5,4A5E77,35485D,1E3140,14232C,192529,212A2D,1D2225,202026,221F28,1B121F,241C27,1B1A1E,111516,091013,101B1F,15272E,253C44,7C99A2,81A3B0,2D5260,4A7284,30596F,00253C,325B74,5D869F,3E6682,58809C
668898,476979,46677A,234759,06293D,6E93A7,6A8EA0,305466,395B6B,123342,02202B,011C26,506A70,465C61,708586,778B8C,778688,505E5D,3D4949,455151,303837,38403F,333836,1C211F,1B1E1C,2B2E2C,333535,2C2E2F,28292D,2E3135,2E3136,1E252E,132333,2F4759,829AAC,98B1C1,7B939F,233840,112225,2F3C3A,2D342D,34382D,36352B,2C2C26,242424,1F2226,1C212A,191F2C,2B3442,182233,2A3446,353E52,192236,0C1628,17202E,121B25,283135,262B2C,2B2D2D,232120,221B1E,281C22,201119,1D121C,212127,060F13,0F1B21,26383F,2C424D,15313C,537483,486F7E,396475,4A758A,00283E,35667C,80AEC6,3C6A82,47758D,3D6B83
7996A4,6F8F9C,7291A0,5D7E8D,2E4F5F,B6D7E7,577989,375867,274857,00101D,3A5863,00161F,4A676C,7D989C,688185,768B8D,505F62,667375,465254,283434,2A3231,303837,2D3230,434846,414442,363937,343636,2F3131,242829,2C2F33,35383C,262E35,2C3E49,3F5665,829CAA,89A3B1,2A4150,000611,14272C,152224,1C2522,181F18,2D2F29,363733,222424,202528,272F36,202730,282B33,272A32,2D2F3A,292C3A,1D202E,1D202E,1F242D,191D22,202425,1B1C1A,272420,241E19,251B1B,342628,332128,2B1E26,070D14,0F2128,354850,738994,425D6B,1B3C4B,365C6E,2F596C,345F74,204F65,0D3D55,34667D,407187,6495AB,47788E,003147
708993,49646E,2F4955,3E5A65,7893A1,A5C2D0,7595A2,587885,3F5F6C,51717C,5A7883,44636C,759299,85A2A7,678489,758E92,5F6F75,505C60,394448,212D2F,161E1E,2E3635,535958,656A68,494C4A,2B2E2C,323434,474949,363A3B,282C2D,282D2E,20292C,2F3F46,4D626A,8BA1AC,364C58,677D89,475B66,293A43,243034,1B2323,0A0F0D,171B16,2C302B,242A29,1D2525,202B2F,222B2F,2B2F30,303232,2A2B2F,202328,21242C,23262E,21252A,1F2425,262B29,20241E,2E2F26,292621,231C19,2C2222,2D1E22,231B22,4B5761,526A76,6E8896,678493,355366,13364A,567C94,4A728B,113D55,002944,6A9AB2,53839B,316278,5E90A4,184A5E,184C5D
3F5358,13272C,31474D,475E66,445D67,7D98A2,18343F,13313C,3D5B66,698792,50707B,74949F,82A1AA,688790,5D7C85,759198,62747B,333F45,1F2A2E,404C4E,6B7373,656D6C,4A504F,303635,292E2C,1E2321,373C3A,4D5250,373C3B,272C2B,313736,373F3E,293736,556766,495C61,7E9198,E5F7FF,E7F9FF,E8F7FF,D0DCE2,B9C0C3,9A9FA0,6F7472,4F5452,3A4340,273230,132120,0A1817,0B120D,121912,151C19,1F2727,2D3639,283337,1E2A2C,212E2C,24322C,233028,333E34,323932,2F302C,333131,373033,383A42,687B88,708D9C,567487,39586D,12314A,31526C,6287A3,355B79,0A304E,204865,4B7691,2E5A72,5C8BA1,2B5A6F,0C3C4E,346777
7D8C8E,3C4E4F,647578,172B30,1B3137,1B323A,000108,001922,56747F,62808B,63838E,688893,7699A3,789BA5,62858F,48656E,21343C,3F4C54,79858B,7E898D,5C6568,424A4A,414746,272D2C,282D2B,303533,404543,404543,373C3B,424746,4E5453,444D4A,303D35,303E38,869492,EAFBFE,D7E7EE,D1E0E9,D6E2EC,F4FDFF,EEF4F9,FAFFFF,FBFFFF,E9F0ED,DFE8E5,CCDAD6,9DAEAB,738480,566459,404E42,24302A,162521,142423,0A1E1F,0C211F,19302C,1F362E,1D352B,24372E,213229,222D2A,1D2524,202528,38434B,506979,628397,53738A,30516B,2E4E6B,3E5D7C,557697,09294C,0F3254,6386A7,557B99,49718A,2B556C,113C4F,3C6A7B,80AFBD
727F7D,5E6C6A,233130,485A5B,384B4E,11272C,041E25,112C36,5E7A85,7896A1,547481,456774,688B98,668996,517481,0A2833,42545F,77848C,657177,354044,535C5F,454D4D,2F3534,3A403F,2C312F,3D4240,424843,393F3A,3D4240,4D5250,464D4A,2F3631,182215,7C8679,E7F4EC,E0EEEC,CDD9DD,4D5A62,404A54,575E67,AFB2BA,C5C8CC,E6EBEA,EEF5F2,E3EFE9,EAFAF3,E9FEF6,D1E9DF,D5ECDE,C1D8C9,ABC0B7,95ADA5,75908C,4F6C69,304F4C,21433D,11322B,0B2D23,04231A,042118,182F2B,142927,1D2E31,50646F,7A98AB,6C90A8,7093AD,284766,547394,1F3D60,5F7CA1,2B486D,39567B,254366,446684,5B7E98,11384E,375F72,3D6877,75A1AE
737F7F,2B3938,6B787A,79888B,1B2B31,14272E,12272F,405963,4F6B76,567681,60828F,426572,799CAA,8CAFBD,335664,65818C,70818A,555F66,495458,455054,545D60,394343,323A39,2C3433,2F3835,39423F,2F3631,151F19,131A17,1F2825,2D3633,37413B,6D756A,DAE4D8,F8FFFB,BBC8C6,889496,BFCBD1,747D86,717881,30333B,4B4E52,AAAEAF,EFF4F3,DEE5E2,D6E1DE,E5F4F0,DBEBE4,E3F2EA,DEEEE3,E2F3EA,E2F7EF,D9F0EC,CEE6E4,BFD9D9,B0CACA,9BB6B3,829D99,547168,335047,2D4844,0B2426,00151D,324C5C,6F93AB,6C92B0,234969,3E6484,234668,385B7D,547196,7491B6,617CA1,092547,5E7B9A,23445E,21455D,577E94,527C8F,6D98A9
)

vListRGB=%vListRGB%`n
(
819197,84949A,607076,33434A,000008,243440,233441,3A525E,647F8D,244451,476A78,486B79,557886,688998,668693,7A939D,697478,6B7071,505556,2F3737,495151,374240,1F2C2A,12201C,091713,1D2C28,3C4A46,667571,97A59F,BAC8C2,D9E7E1,F4FFFE,F7FFFE,F2FAF9,F3FDFD,BCC8CA,E4EFF3,F4FFFF,F6FEFF,F6FEFF,D1D4DC,C0C3C8,D4D7DC,FDFDFF,FCFBFF,EEEDF1,EFEEF2,F6F5F9,E8E2E7,EEE9EA,E8E7E3,E1E5E0,E8EDEB,EAEFF0,E5E7F1,E3E5F0,DDDFE9,DFE6E9,E9F5EF,C2D4CD,B3CAC6,95AEB2,7C96A6,618099,779DBF,416D92,275378,437092,0D375A,2C5576,4D7294,567798,143052,567291,3B5776,102E4B,3A5C79,59809C,6E97B0,5E8AA2
8EA1A6,687A81,3F4F56,434F59,434F5B,707D8B,4E5E6E,506777,5F7C8B,163746,345967,2A4F5D,517281,557483,647F8D,5F737E,99A2A6,757A79,4B4F50,2A302F,242C2C,081311,1A2826,41524F,869794,BBCECB,E5F8F5,ECFFFC,EAFEF9,D7EBE6,AEBFBB,899A97,677377,939FA5,A5B1B7,9FABB1,9EAAB0,919DA3,7E8A90,6E787F,9198A1,6E757E,696B75,82838D,AEADB7,CAC6D1,E0DAE5,E5DDE8,FDF1FD,FFF4FC,F7F1F2,F3F0EC,F3F1F0,EDE9EE,E7E0ED,EBE3F4,F4EDFC,FBF8FF,E0E5E3,EDFAF2,E0F5F2,C3DDE3,D7F2FF,ADCCEB,5D84AA,3A668F,2C5B81,1B4A70,426F94,214E70,3F6889,436687,2B4A6B,2B4766,122E4D,516E8D,5F80A1,5E85A5,6F9BBA,6A98B7
49585B,38474A,2F3C44,38444E,45515D,566371,394B5C,4D6577,7290A1,608292,587C8C,133747,547584,829FAE,5B7583,7E909B,A4ADB1,505455,1B2023,121A1A,384144,7E8A8A,CFDFDE,E5F7F6,EBFDFC,EDFFFF,DCF1EF,889D9B,425755,1E3331,091E1C,001011,1A2A31,475561,3A4854,4B5B67,394955,43535F,51616D,5B6B77,5A6874,616F7B,737C89,656D7A,707683,5D606E,5E5F6D,585866,68616E,99919B,C0BDBF,D5D5D5,E9EBEC,F1F4F9,EDEAF9,E6E2F5,E9E4F3,DBDAE3,E0E7E4,E3F1EB,D8EBE8,E7FFFF,CDE6FA,7493B2,284F75,406C95,27567C,2A5B81,0E3E62,275577,7CA7C8,6086A6,5F80A1,173355,3D597B,2A4B6C,557A9C,6B94B5,5B8AAA,265777
000A0A,00090B,061115,121D25,464F5C,617080,4B5F71,566F83,7190A5,7DA0B4,688DA1,3E6274,80A1B1,7E99A7,6A828E,ABBCC5,626A71,0D1116,282E33,A5AEB2,ECF7FB,EFFEFF,ECFDFF,DDF0F3,C4D9DB,9AAFB1,576E70,2C4345,2E4449,465C61,60767B,758B91,899CA9,A2B5C4,9CAEBF,BACFDE,ABC0CF,ACC3D2,A0B7C6,A0B7C6,97ACBB,9CB1C0,A9BCCB,9EAEBE,C2D1E1,B1BECE,ACB6C7,A0A7B8,8C8C9C,767682,585C61,5A6164,889195,BDC4CD,E3E5F7,FAF9FF,F0EFFF,F4F6FF,E8F0EF,D3E1DB,D4E7E4,799197,2E475B,587594,50779D,2B5982,21527A,27587E,0E3E62,426F94,78A2C5,6187A9,103355,163758,5C7C9F,6285A7,638BAE,90BDDF,2A5C80,001E42
383F3C,242A29,192023,161E25,4C5562,616F81,40556A,3C566E,88A7C0,7296AE,5B8096,7295A9,ADCBDC,7F99A7,889BA8,47565F,0C141B,80868D,E5EDF4,F0FAFF,D2E0E6,D6E6EC,BFD1D8,82989E,4F666E,4E656D,5A747B,819BA2,AAC3CD,B7D0DA,BAD3DD,C5DCEB,A7BDCF,90A8BC,8DA4BA,8AA3B7,869FB3,86A1B5,7691A5,7A95A9,748FA3,748FA3,7C95A9,657D91,7B90A5,687B90,7B8FA1,8E9DB0,B8BFD3,BDC4D5,BCC6D0,A9B7BD,78888F,4D5965,62697C,9CA1B6,C1C5D7,DFE3EE,ECF7F5,E2F1ED,8A9F9C,000D13,172F43,4E6B8A,466D94,25537C,4879A1,001F45,5486AA,5888AC,295678,386182,183D5F,55789A,587A9E,85ABCE,5D89AE,3E6E92,20557A,32698E
30342E,191F1A,191D1E,1E242B,48515E,647284,5B7086,6A859F,8EAFC9,688BA5,6589A1,A4C5D9,A1BDCE,8CA3B2,4E606B,3F4B55,B4BDC6,F6FDFF,E9F2FB,CFD9E3,DEEDF6,B1C2CB,4E626D,3F5560,7C94A0,9CB6C2,B8D2E0,BAD5E3,A8C3D1,8FAAB8,8AA4B4,97B1C2,92AAC0,758FA7,8BA5BD,7F9BB3,829FB4,7C9BB0,6F8EA3,6F90A4,7192A6,638498,66859A,648398,7C99AE,6C879C,6F889C,71899D,697990,677689,6D7E8B,8CA1A9,ACC2CD,9FB2BF,69768C,3E4860,60677B,949CA9,CAD6D6,DFEEEA,C1D6D4,6D8389,5C7488,577392,254C73,3E6B96,1B4C74,1C4D73,5C8EB2,3F6F91,002B4D,254F72,082E50,496E90,6488AC,7299BF,6895BB,42759D,5087AE,619CC3
272A21,0F110B,0A0C0C,13171C,3E4653,778598,72869F,718CA7,5E7E9B,5D829E,90B4CC,D8F9FF,92ACBD,5A707C,43525B,DAE5ED,EBF4FE,CFD8E2,E4EEF8,DEEAF6,70808C,62747F,98AEBA,B3CDDB,BFD9E9,BAD7E6,A5C1D2,8CA8B9,809EB1,809EB1,89A7BA,97B5C8,96B0C8,809AB2,859FB7,7D99B1,7998AF,7393AA,7C9CB3,7698AF,6E91A5,6D90A4,789BAF,7295A9,65869A,597A8E,6C8BA0,7D9AAF,798EA9,8197B0,718A9A,55717C,58747F,7B94A4,A9BAD4,CBD8F2,778298,303B49,5E6B6D,CADBD7,E6FBF9,DDF3F9,8196AB,385473,557CA3,305D88,001C44,6899BF,45779B,043456,194769,477293,3C6586,53799B,749ABD,6690B5,3E6B91,78ABD3,659DC6,337098
202117,1D2017,1B1E1C,0C1015,1D2532,667486,647891,546C88,5A7A97,9DBFDC,D1F3FF,D5F4FF,ABC4D4,546774,CEDAE4,EBF6FE,E2EBF5,EBF5FF,A9B5C1,818F9B,98A9B6,CEE1EE,BFD6E5,B0CADA,A6C2D3,A1BFD0,99B7CA,94B2C5,8FAEC3,83A2B7,809FB4,8DAABF,98B3C8,8CA4BA,7792A7,809DB2,7998AD,7899AD,8FB0C4,7EA1B5,81A4B8,688EA0,608397,628599,5E8195,698A9E,6C8DA1,618097,748FAA,69849E,6C8A9D,7EA0AD,7B9CAB,617F90,647B95,8699B4,D6E4FB,96A3B1,2D3C3E,8A9B98,CCE0E1,E4F9FF,8BA0B6,3A5373,3A5E86,09345F,618FB8,406F95,2C5C7E,001D3D,78A5C6,91BDDC,779EBE,446A8C,7096B9,658FB4,527FA5,5F92BA,9CD4FD,2E6991
2A2E23,21241B,1B1E1C,24292C,39424C,4F5B6D,596B82,5A718B,8CAAC3,CEF0FF,ABCBE2,C2E0F3,B9D0E0,CBDDE8,E6F1F9,E4EDF6,E6F0FA,A3AFBB,96A4B0,C2D2DE,CFE2EF,BDD3DF,B1CBD9,B3CDDD,B0CCDD,AAC8D9,A2C0D3,96B6C9,8DACC1,89A8BD,8AA9C0,8EABC0,96AEC2,97ADBF,8FA7B9,87A1B2,839FB0,7F9DAE,7494A7,698A9D,658699,567A8A,658699,7798AB,7192A5,6B8B9E,6B8B9E,67869D,6985A3,5C7A95,7E9FB3,698E9C,7094A4,7394A7,708BA5,667D97,7F91A8,E0F0FF,77888B,4E615E,ACC0C1,E3F8FF,C3D5EC,496284,163961,2A547F,638DB7,29567B,134262,5685A4,6E9AB7,37617E,5B819F,6B8FAD,6A8DAE,759BBD,9ECAEF,7EAFD5,487CA4,00284F
292E25,282F28,242927,1C2326,252B36,475162,7C8B9E,A2B7CD,CDE8FD,7493A8,2A485B,A1BBCC,DAF0FC,E4F5FE,E7F0F9,DBE5EC,BCC6D0,B6C4D0,C4D4E0,CFE1EC,C3D6E3,BDD5E1,C3DDEB,C3DDED,BBD8E7,B0CFDE,A3C1D2,97B5C6,90AEC1,8EACBF,8EABC0,91ACC0,8DA4B4,869BAA,748B9A,627C8A,5C7785,5E7B8A,5F7E8D,5B7C8C,537484,4B6C7C,537484,587989,4C6A7D,4A687B,577588,5D7991,637F9D,708EAB,5D8094,7097A6,6B92A1,628698,6E8BA6,7890AC,798EA4,768998,DEF1F4,576C6A,90A5A7,EAFEFF,E8F9FF,2A4063,294972,6D93BD,335C83,0E385B,0F3C5D,A0CCE9,507894,254D66,85A8C2,698AA4,5A7A97,6D91AF,96BFE0,72A0C2,26587C,003055
19231D,19221F,192120,192023,202730,363F4C,526171,697B8C,A4BDCD,A7C1D1,A1BBCB,D3EBF7,CFE1EC,D3E0E8,E8F2F9,D8E0E7,BAC6D0,CAD9E2,D7E8F1,CEE1E9,BFD3DE,C2DAE6,C4DEEA,B6D1DF,BCD7E5,B2CFDD,ABC8D7,A6C3D2,A0BCCD,92AEBF,7D99AA,6F8898,96ACB8,A5B9C4,B7CBD6,C4DAE5,CDE5F1,D0EAF6,CDE8F6,C6E3F2,C6E3F2,B9D8E7,B5D3E4,AECCDD,9EB9CD,8DA8BC,7D95AB,668098,455F7D,3F5D7A,5C7F93,6E92A2,618897,5D8193,8DABC6,6F87A3,859AB0,5D707F,C9DCE1,859A98,92A7A9,E4F8FF,B7C8E2,253B5E,607CA5,5A7CA7,173C62,113759,A1C8E8,416985,173D55,9BBDD4,6E8DA2,29455D,1F3A54,203E59,0D314F,2E5777,3B6889,467797
1C2927,172422,172121,1E272A,293138,2C353E,24303A,192935,172B36,3F5862,5E7781,89A0A8,D5E7EE,DFEDF3,ECF5F9,DEE6ED,D9E6EE,D4E4EB,CEDFE8,C8DBE3,C4D9E1,C3DAE2,BCD5DF,B0CBD5,C3DEE8,C1DEE7,B6D2DD,9FBBC6,90AAB6,99B3C1,BCD6E4,DDF5FF,DAEEF9,DDF2FA,DFF4FC,D9F0F8,CEE7F1,C1DBE7,B6D1DF,B0CADA,BAD7E6,B6D2E3,B3CEE2,B6CFE3,BFD7ED,CDE4FA,CCE2FB,C1D6F1,A9C1DF,86A3BE,4D6E82,5B7F8F,5F8393,7EA2B4,57758E,8DA5C1,7E93A9,8EA1B0,A5B9BE,B8CCCD,9BB0B2,DAEDFA,7D8EA9,516489,859FC7,28466F,193B5F,6487A8,7196B2,4D7189,7899AD,A5C5D8,92ACBD,9AB4C5,94ACC0,829DB2,4E6D86,41647E,0A324E,002742
213334,1C2E2F,192628,162125,182125,1D262A,212C30,243036,1E2E34,162A2F,05191E,2C4143,E8F8FE,EFFBFF,D5E0E4,D9E4E8,DCEAF0,DAEAF0,D5E7EE,CFE2E9,C9DFE5,C1D9DF,BFD9DF,C4DEE4,B9D3D9,B0CAD0,AEC8CE,BFD9DF,DBF3F9,E7FEFF,DEF5FD,D0E7EF,D0E5ED,CDE3E9,C7DCE4,BFD6DE,B6CFD9,B0CAD6,B0CBD9,B2CCDC,9FB8CC,ACC4DA,AFC7DF,A5BBD4,9FB4CF,A4B6D3,AABCDB,AFC1E0,C0D4F3,CBE4FE,BCDAED,5C7D8C,4D707E,6D8EA1,7795AE,778FAB,889DB3,91A4B3,BDD1D6,C7DBDC,C3D7DC,E0F6FF,99ACC7,5A6D92,6079A1,173159,476588,A5C4E3,163751,6A8AA1,9AB8C9,C6E0F0,E8FDFF,D1E6F5,D0E3F2,E6FDFF,97B0C4,8AA7BC,6F91A8,30556B
1C3237,1B2F34,18292C,162226,161F22,1B2323,212929,242E2E,101E1D,223231,152726,1D2F2E,CCDBDD,E6F2F6,D3DEE2,EAF5F9,D5E3E9,E0F0F6,DCEFF4,D1E6E8,D0E4E9,CCE3E5,C4DDE1,C1DDDE,B7D0D2,C3DCDE,D1EAEC,D7EEF0,D1E8EA,CDE2E4,CCE0E5,CFE3E8,C5DBE1,C4DCE2,C7DEE6,C8E1EB,C3DEE8,B8D4DF,AFC9D9,ABC5D6,A8C0D6,B8D0E8,BBD0EB,B4C9E5,B2C3E4,AABBDC,A3B1D5,A0B0D4,97A9C8,93A8C3,B5D1E2,DFFFFF,6D8E9D,507181,7D98B2,879FBB,96ABC1,96A9B8,BED2D7,EAFFFF,E5F9FE,8DA3AF,9CAECB,5C6F94,182E57,4E678F,839DC1,1F3B59,506E87,A5C3D6,9CB5C5,CFE5F1,D4E6F1,DDEEF7,CBDBE7,E2F3FF,92A7B6,556E7E,486377,57778A
1D3A3F,1E363C,203439,273639,2F3939,313736,282F2C,1D2623,28342E,202E28,182723,2C3D3A,A2B0AF,EEFBFD,DCE7EB,D2DDE1,D7E6E9,DFF0F3,D6E9EC,CEE3E4,D7ECEE,D3EBEB,C5DCDE,BFD9D9,D0E8E8,D1E9E9,D3EBEB,D5EAEB,D6EAEB,D6EAEB,D9EBEC,D8EBEE,DDF3F9,D2ECF3,CCE5EF,C8E3ED,C5DFEB,BDD8E6,B7D1E2,B4CFE3,B5CFE7,B4CCE8,A6BBDA,A0B5D5,ADBFE4,AFC1E6,AAB9E0,ADBDE2,A1B0D0,9EB2CB,9CB6C6,B3D1DC,C5E5F2,7A98A9,7C97B1,97AEC8,9BB0C6,C3D6E5,CCE0E5,ECFFFF,899DA2,172D39,6A7C99,56698E,253A60,6E85AB,7A93B5,385270,839FB7,A5C1D2,B5CDD9,E2F7FF,D5E5EC,DCEAF0,E2EDF5,BFCBD5,364652,001420,051E2E,152F3F
1E353D,1F353B,213439,263236,2A3434,313736,353C39,383F3C,303A34,37453F,32403C,1B2927,394746,DDEAEC,ECF8FC,B3BFC5,D4E4EA,D8EBEE,D4E7EA,D6EAEB,DBF1EF,CEE4E2,C8DEDC,DAF0EE,DDF2F0,D9EEEC,D6EBE9,D5EAE8,D8EAE9,D9EBEA,DBECE9,D6EBE9,D2EBEF,CAE4EB,C6E2E9,CAE5EF,CCE6F2,C6E1EF,C0DAEB,BED7EB,B2CAE2,BBD2EC,B8CDEC,B7CAEB,BCCFF2,B1C3E8,A8B7DE,B2C0E4,ACB7D5,A6B4CA,9CB0C1,9BB2C2,C4DDED,9CB4C8,7489A4,B4C7E2,C8D8EF,D9E7F9,EBFBFF,98A8AE,03161E,233546,647792,0D2242,829BBD,7F9ABC,1D3957,91ADC5,AFCADE,BCD6E4,DEF4FF,C9DEE6,D9EBF2,DEEEF5,BACAD1,4E6067,000A12,061D25,001822,00131D
2B3840,354349,253137,0C171B,181F22,2C3434,283030,171F1E,242E2E,1D2929,313D3F,3F4C4E,18272A,69797F,EBFBFF,B9CBD2,D0E1EA,D7E9F0,D7EAED,D6EBE9,DAEDEA,D5E8E5,D4E5E2,DAEBE8,DBE9E8,DFEEF0,E0EFF1,DAE9EB,D7E7E6,DBECE9,DBEFEA,D6ECE7,D0EAEA,CAE5E9,D8F2F8,CCE6ED,D2ECF3,C3DEE8,B9D3E1,C1DAEA,BCD4E8,B9D0E6,C4D9F4,BDCFEC,BFD1F0,B1C2E3,B8C9EA,B9C7E4,BDC7DF,BDC4D8,A1ACC0,A6B3C9,C0CDE7,B1BED8,AAB5D1,D6DFFA,DDE3FA,DFE5F8,6E7586,0F1826,101C2E,27354B,4E5F7A,546A86,95B7CF,5F849A,5E7F92,ACCBDA,ABC7D2,CFE8F2,D9EFFA,D6ECF7,D5EEF8,AAC4D0,66808C,36535C,2C4950,264548,1D3C3D,1E3E3D
273A3F,25383D,243538,28373A,273638,1B282A,152322,1F2D2C,162325,0F1C1E,0B1A1D,2C3D40,293C41,071A1F,51646B,DAEDF5,D4E6F1,DFF0F9,D8EBEE,CEE0DF,D2E3E0,DBEAE6,DFEDE9,E3F0EE,E9F2F5,DEEAEC,DBE6EA,E2EEF2,E5F2F4,DBECE9,D5E7E0,D3E7E2,D8EDEB,CDE2E4,CFE3E8,D0E3EA,D9ECF3,D0E5ED,C7DAE7,C3D6E5,CCDEEF,C7DBED,C1D4E9,CFE1F8,C3D4EE,C3D4EF,B8C9E4,BCCDE7,B5C6DB,B6C7DA,A7B7CE,98A9C4,BFCFEC,D3E1FE,D7E1FF,D4DDF8,DEE4FB,83899C,2D3445,0A1223,152335,061A2C,455C72,95B4CB,3E6379,4E7689,A2C4D4,9AB7C5,D0E9F3,E4FBFF,BCD2DD,D5EEF8,CCE8F3,C8EAF7,587E8A,28515A,345E63,245051,2C5754,1E4A44
14373A,193C3F,1A3C3C,1E3D3E,2A4646,2D4747,2D4845,354D4B,2B4041,354A4B,374C4E,2D4446,33494E,21373D,11262E,384D55,B6C8D3,DCEDF6,EFFFFF,E1F0F2,D7E5E3,D7E5E1,DDE8E6,E2EDEB,E6EDF0,E6EFF3,E6EEF5,E1EAEE,DFE8EB,DFECEA,E0EEEA,DFEDE9,DAE4E4,E3ECEF,DFE8EC,DEE7EB,DBE5EC,E5F0F8,E1EDF7,C6D2DE,CCD9E7,DFEEFE,D2E0F2,BAC9DC,C8D6EC,C8D9EE,C1D2E7,C0D7ED,B1D4E8,9FC8DE,A2CAE3,A1C6E2,BAD9F8,CBE7FF,D2E8FF,B7C8E2,8D9BB1,758292,707D8B,253742,172F3B,001826,93B8C6,416779,365870,9AB9D2,809BAF,88A1B1,E7FAFF,D4E6F1,E6FBFF,87A0AA,5D7B86,B3DAE3,6C9AA5,295D64,2B6368,235F5F,347371,387873
2E5154,284B4E,133535,042324,0E2D2C,133231,03201D,000D0A,052121,001A1A,1A3839,234044,1B393E,2E4C51,314E55,1C383F,273B46,6E7F88,B3C3C9,D9E8EA,E9F7F5,E7F4F2,DDE8E6,D9E1E1,DDE3E8,E0E6ED,E4EAF1,E7EDF4,E6EFF2,E4EEEE,E1ECE9,DFE8E5,E3E5E6,EBEAEE,E3E2E6,E2E3E7,CFD2D7,CFD2DA,DBE0E9,D3DAE3,C2CBD5,C5CEDB,E2EDFB,E8F5FF,C7D6E6,CEDEEF,D4E4F5,AEC6D8,A6CCE4,8BB8D3,97C3E2,AED9FA,A8D1F2,A1C8E8,6587A4,092740,000B1F,223948,293D48,2B4048,00111C,2D4852,C0DEE9,7793A4,647995,AAB9D9,AAB7D1,D2DDF1,DDE7F8,D4E0EC,C8D7E0,637880,6D8A93,A7CAD4,77A1AD,295A64,52868D,9ED5DA,B3ECEE,B8F1F2
384C51,2A3E43,1F3235,2F4245,506566,5D7273,556D6D,4F6969,385657,2C4B4C,1F4245,274E50,194245,002429,00232A,02272F,142D37,172831,1F2F36,4D5C5F,99A7A6,D0DCDC,E3EDED,E5EEF1,F4FAFF,E3E8F1,DCE1EA,E5EAF3,EBF1F6,E6EDF0,E4ECEB,ECF1EF,F6F1F3,E6DDE0,E2DBDE,F8F1F6,F4EEF3,D4D0D6,C3C3C9,BEC0C8,D8DDE6,D7DEE7,BBC4CE,D0DAE4,CFDBE7,DFEDF9,C7D5E1,C8DAEB,BFD7F5,AECBF0,9BBFE5,97BEE4,709DC2,8ABADC,5382A1,001F37,001B2D,0D2E3D,203943,21343C,1F2B35,323A47,4C5160,A2A3B8,C1BADF,B6ADD5,DED3F4,FCF3FF,E0DAED,FBFBFF,E3E7F2,D2DCE6,DDEFFA,D3EBF7,9CB7C5,678493,84A1AF,C9E4F2,DEF8FF,CEE6F2
39494F,35454B,24343A,1E2F32,314245,415556,43585A,405759,5C7577,6F8A8E,607D81,59797E,63858B,61858D,537880,3A5B64,4C6470,4D616C,394C53,1F3237,152728,263537,535F63,838D94,B6BFC9,DBE1EE,EFF5FF,E3E9F4,D9E0E9,DFE8EC,E0EAEA,DAE0DF,DCD7D9,F6ECF2,F5EEF3,9D969B,5B555A,2A262C,201E24,292C31,474A52,A8AEB5,E3ECF5,C4CFD7,E0EAF4,D1DDE7,D7E3ED,D2E2F3,ACBDDE,AEC4EE,99B6E2,6A90BA,113F68,2D6386,5D94B3,79B1CA,79A8BD,7EA5B4,8AA5B3,273845,343B4A,19192B,585166,CAC0DE,CBC3EC,D9D2FD,C7BFE4,C5BDDB,CAC5DA,CBCBD9,C0C2CD,888E99,8894A0,8696A3,6F7F90,8394A7,79889B,707E91,A1ABBD,8E98AA
385056,3E565C,2D4349,15292E,12262B,192C2F,14242A,0A1A20,0D1B21,0D1B21,253038,29333D,29313E,3F4655,4E5564,525D6B,526574,5F7783,69838A,70888E,788E93,71858A,5E7077,53626B,697684,B0BACB,E5EFFF,E5F0FE,DFE8F5,EBF6FE,EBF8FA,DCE5E8,DEE1E6,E0DEE4,B0B0B6,0C0C12,000004,070911,03060E,000209,000007,4A535C,E7F0F9,EBF6FE,ECF7FF,E0EDF5,D4E1E9,495769,6E7FA0,758BB5,7A9AC5,4F76A2,01315B,001B40,256080,75ADCA,75A7BE,8BB5C8,88A6B7,485C6E,10182F,000014,312B4A,646488,2B3C67,3A537D,3B4F72,162742,243245,2D3846,303A44,2A333D,202936,142131,000B1E,1F2D43,16223A,020E26,2D384E,1E293F
52656D,4F626A,596A73,73848D,809299,6E7E85,5B6B72,606D75,556068,374049,414A54,313744,2A2F3E,252837,090B1D,262E3F,000F1E,092634,102D36,08252C,122F34,254148,314A54,384E5A,415364,394A5D,455467,647485,8291A1,98A8B4,B9CCD1,DDEDF3,DEE9F1,E9F2FB,E2EDF5,414C54,2A353D,1C272F,1B262E,3E4951,5A646E,CDD9E3,E0ECF6,CDD9E3,7B8791,717D87,404C56,465869,7F9CBB,658CB2,6590B7,4D7EA6,6397BF,4A81A8,598FB2,5B8EAE,7FACC7,84ADC4,8FAFC6,16324A,0D233F,0D2041,0C1E43,18325A,16416C,053860,1E4768,486983,3B5367,071626,000613,131924,161B2A,0F1627,10192D,0D1931,0B1A34,1C2D47,30415B,34465D
37394B,3A3C4E,464958,535867,5A626F,5E6774,6C7882,7B8A93,7E8F98,778994,778B96,7A909C,718793,7A91A0,617888,567080,537281,486B79,3D5F6C,30535D,274B53,20434D,163643,082637,102B40,162E46,0A2039,061D33,011729,132A39,273D48,5D777E,829BA5,96B1BB,ABC6D0,B4CFD9,9CB5BF,98AEB9,859BA6,97ABB6,C4D6E1,9CAEB9,61737E,52626E,22323E,394753,3F4D59,89A6B5,5E98AE,60A9C5,3E84A2,5B9BBD,6AA4C8,80B4D9,5985AA,597FA1,9BBCDD,284A68,3E607D,6F97B4,6A98BA,73AACF,75B3DC,73B7E2,75BAE5,67AAD1,75ABCC,7FA7C3,738BA1,343E50,333242,3F394A,383245,474559,43475F,2F3D54,3D536C,819DB5,A7C7DE,7398AE
)

vListRGB=%vListRGB%`n
(
000118,000519,000B1F,041224,061627,071A29,0E2430,162E3A,1C3642,25414C,213D48,2B4856,3A5765,51707F,4F6E7D,587989,537789,4F7685,7198A7,7AA1AF,557D89,557C8A,7195A7,6B8EA2,597A94,5C7A95,516D8B,56718B,476479,2C4859,193644,24444F,173B45,214851,345B64,21454F,6D909A,5D7D88,3D5B66,4E6A75,4A6470,425A66,384E5A,405662,445562,3D4E5B,4E5E6B,87A8B7,88CDDE,22758A,3B86A0,74B6D3,6BA4C4,77A5C7,507597,637FA1,6A83A3,14304F,3A5B7C,76A3C4,7CB6DA,7BC1E9,5FB0DD,4C9AC8,1E628D,487FA6,6D9ABC,5C7C99,53687E,4B5468,565569,504C5F,413F55,43455D,353F57,283953,273F57,67869D,90B2C9,6A8FA3
6E98AF,58859A,38657A,194759,073344,002735,001926,000D1A,000A16,00222E,001B28,0D2C3B,1B3847,253F50,243C4E,2F4A5E,35586C,456D80,2E5669,234B5D,4A7586,588295,446D84,456D86,567C9C,4A6D8E,426587,5C7E9C,6F90AA,63839A,628494,416773,13404B,26555D,3C6A72,09373F,3F6A73,1F4851,204350,5B7D8A,4C6C79,486573,506B79,627C8A,657A89,647988,3E5160,0F303F,003746,2F7684,5695A9,619AB0,6594B0,567C9A,476382,3D5271,293E5A,162B4A,516D8C,7197B9,5185AA,3A79A5,2872A2,3574A6,375886,0A1A45,202B51,4C5576,616A85,363E55,040D21,00091C,00071E,00081E,000017,000A22,000A22,445C74,6D8599,465E72
72A9C4,7CB5CE,82BBD4,7DB7CD,78B1C6,72AABD,6399AA,538696,396A78,204D5B,002130,062D3C,0C2E3E,153646,1D394A,1D3B4E,05273F,062C44,052C42,022B41,0C354B,214B62,38607C,466D8D,476D90,4F749A,6589AF,6387AB,46698A,466983,7A9FB5,456C7B,3C6A72,4E7E84,47757C,346269,37636A,3B656C,355C65,426670,567983,2F4F5A,24424D,28444F,06202E,59737F,3F5665,0C2937,001522,71A0AE,90BCCD,7BA5B8,789CB4,224059,273F57,3B4F68,35455C,2B3D54,495E79,577391,4A7093,3C6A93,2B5F8D,386090,404877,120B36,201D44,343756,414C67,3D5268,254257,325569,366077,39657C,547E95,799FB7,23435A,051E32,0F2335,1D2D3E
6593B5,78A8CA,83B4D4,76AAC8,6CA2BB,77ADC4,88BFD4,91C9DC,7EB4C5,7EB5C4,8FC3D3,90C3D3,3E6C7D,123E4F,1D495A,355D70,6C8FA9,395976,12354F,1C415B,2D5470,204664,062C4E,002046,00224C,00133F,052854,13365E,193D61,668AA8,B6DBF5,567C8E,365D65,4E7478,395F63,688E92,63898E,5E8288,4F7379,5A7C82,51727B,496871,57767F,405F68,132F3A,57747D,213D48,1B333F,233441,344353,6A7C8D,596F81,40586A,082032,314A5A,566B7A,2F404D,2B3B48,293848,2C3A4D,374561,2F4061,1C2F55,2A3660,201E48,1E1940,303254,14223F,19354D,648FA4,7FB6CB,85C7DA,79BFD6,77C0D6,79BCD3,83BCD1,2C576A,224353,4E6470,748490
6690BA,73A0C6,7DAAD0,7CACCE,7EAFCF,82B7D2,82B8CF,7CB3C8,84B9CD,74AABB,90C2D4,98C9D9,5A8899,3F6B7C,305B6C,365D73,385673,526F8E,476685,466886,678BA9,668BAD,567AA0,6487B2,5476A4,406494,446596,30537F,13365E,44698B,6C90AE,0A2D41,06262C,274546,001718,112F30,69868A,A8C7CA,AFCED1,A7C6C9,91AFB4,99B7BC,7F9FA5,2F4F55,416167,76969C,2E4E54,2A434D,353E4B,252B38,303B49,2B3A4A,182B3A,000D19,4E646F,455B61,304348,49585B,3C464D,272D38,22293A,11152D,1C203D,525778,6E7093,858CAD,939EBC,4A5F7A,001F38,29556C,5B91A8,75B3CB,6BAEC7,73B6CF,75B2CC,7EB4CB,4C7788,365865,233944,071920
82ACD9,7EABD6,7CA9D4,80AFD5,8BBBDD,92C4E2,8DBED8,82B2CA,7BAAC0,729DB2,80A8BB,7598AC,628295,668497,355064,3A526A,3B5272,30496B,3A5577,314D6F,1D3C5D,3E5E82,5B7BA4,41628F,48699A,416294,416093,4C6C9D,5877A4,7A9BC2,6C8FB0,3A596E,596F75,425350,2E403F,324443,435758,4F6465,7D9496,E3FCFE,E5FFFF,CDEAEE,85A3A8,4A6A6F,5D7D82,779A9E,426569,304D54,2C4149,3C4E59,0D212C,1F3540,2B444E,000107,495F64,5A6F70,3A4B47,4A5852,25302D,151D1C,283135,1A242E,2A3543,6D7E91,98B2CA,91AFCA,6F8AA4,334C66,122B45,627B95,87A1BF,6985A4,708CAF,5E7A9D,4A6786,516E89,3D586C,304A58,51676D,768A8F
386493,527FAB,729FCB,83B1DA,81B1D5,75A4C4,6998B4,6692AA,6B94AD,486F85,224259,042136,476074,A3B8CD,8C9FB4,ABBCD6,C1D6F6,7389AD,375072,3C5779,5F7B9E,7292B6,7C99C5,7FA0CE,6C8BBE,7191C6,5C7BB0,5473A6,5C7BA8,7495BC,7DA0C2,B7D6EB,9EAEB4,BAC5C2,D6E3E1,818F8D,404E4D,9AACAB,C0D4D5,DCF4F4,CBE4E6,8CAAAB,567377,83A4A7,4A6B6E,3C5F62,466B6F,698C90,8FA9B0,99B3BA,5E7781,244047,233F46,000F13,314949,556A67,44554C,536156,263127,18231B,333E3C,1A2729,202D35,5F7783,507589,2D576E,062B41,042038,001530,3D4B68,4B5676,1D254A,252E54,515C82,4D597D,2E3E5B,3D5065,6C828E,8EA1A8,7D9294
)
Sort, vListRGB, F JEE_SortReverseList

;e.g. dimensions:
;4x4 = 16
;16x16 = 256
;4096x4096 = 16777216

;get dimensions:
vImgW := 0
Loop, Parse, vListRGB, `n
{
	vTemp := StrSplit(A_LoopField, ",").Length()
	if (vTemp > vImgW)
		vImgW := vTemp
}
StrReplace(vListRGB, "`n", "", vImgH), vImgH += 1
MsgBox, % vImgW " " vImgH

;produce the header:
vStride := vImgW*3 + Mod(vImgW, 4) ;3 bytes per pixel + padding per row
vSize := vStride * vImgH ;bytes per pixel row * row count
;the +1 below is there because we insert a UInt (4 bytes),
;in order to insert 3 bytes, so it might go past
;the end of the structure by 1 byte
VarSetCapacity(vData, 54+vSize+1, 0)
StrPut("BM", &vData+0, "CP0") ;(identifier)
NumPut(54+vSize, vData, 2, "UInt") ;(file size)
NumPut(0, vData, 6, "UInt") ;(reserved)
NumPut(54, vData, 10, "UInt") ;(bitmap data offset)

;produce the header (BITMAPINFOHEADER struct):
NumPut(40, vData, 14, "UInt") ;biSize
NumPut(vImgW, vData, 18, "Int") ;biWidth
NumPut(vImgH, vData, 22, "Int") ;biHeight
NumPut(1, vData, 26, "UShort") ;biPlanes
NumPut(24, vData, 28, "UShort") ;biBitCount ;(1=Monochrome, 4=16 Color, 8=256 Color, 24=24-bit)
NumPut(0, vData, 30, "UInt") ;biCompression
NumPut(vSize, vData, 34, "UInt") ;biSizeImage
NumPut(0, vData, 38, "Int") ;biXPelsPerMeter
NumPut(0, vData, 42, "Int") ;biYPelsPerMeter
NumPut(0, vData, 46, "UInt") ;biClrUsed
NumPut(0, vData, 50, "UInt") ;biClrImportant

;add pixel colour data
vOffset := 54
Loop, Parse, vListRGB, `n
{
	Loop, Parse, A_LoopField, % ","
	{
		
		vNum := "0x" A_LoopField
		vNum := LVX_RevBGR(vNum)
		;putting UInt 0x00AABBCC puts bytes 'CC BB AA 00'
		NumPut(vNum, &vData+vOffset+((A_Index-1)*3), 0, "UInt")
	}
	vOffset += vStride
}

;create the file:
vPath = %A_ScriptDir%\z bmp %A_Now%.bmp
if FileExist(vPath)
	return
oFile := FileOpen(vPath, "w")
oFile.RawWrite(vData, 54+vSize)
oFile.Close()
Run, % vPath
return

;==================================================

JEE_SortReverseList(vTextA, vTextB, vOffset) ;for use with AHK's Sort command
{
	return vOffset
}

LVX_RevBGR(i) {
    Return, (i & 0xff) << 16 | (i & 0xffff) >> 8 << 8 | i >> 16
}


padanges
Posts: 24
Joined: 15 Jul 2019, 06:59

Re: graphics: create bmp files from scratch

10 Aug 2020, 15:55

Hi there,
it's an old topic, and it's very well explained and documented, but while rewriting it myself I found out that the least clear line is:

Code: Select all

VarSetCapacity(vData, 54+vSize+1, 0)
To be specific, that "+1", which, as I understand is explained by the lines:

Code: Select all

;the +1 below is there because we insert a UInt (4 bytes),
;in order to insert 3 bytes, so it might go past
;the end of the structure by 1 byte
But, while everyhting else within this script (the "bmp from scratch", without using GDIp) is understandable - I still feel that I don't get that. Why is that "+1" necessary? Because even without that "+1" the script gave the same results (for my couple of tests).
swagfag
Posts: 4092
Joined: 11 Jan 2017, 17:59

Re: graphics: create bmp files from scratch

15 Aug 2020, 14:26

its a hack to guard against inducing undefined behavior/memory corruption/crashes in some (probably very rare, yet still plausible) cases
imagine u have to write out an 24bpp image that is a single row of 4 pixels. u reserve enough memory somewhere for a 4x1 24bpp image(accounting for padding, in this case there is none)
#### [???? ???? ????] ####
u start writing ur bytes in, using the 0x00RRGGBB, "UInt" gimmick:
  1. #### [BGR0 ???? ????] ####
  2. #### [BGRB GR0? ????] ####
  3. #### [BGRB GRBG R0??] ####
  4. #### [BGRB GRBG RBGR] 0### - whoops, u overwrote memory that wasnt urs
padanges
Posts: 24
Joined: 15 Jul 2019, 06:59

Re: graphics: create bmp files from scratch

22 Aug 2020, 18:20

This forum rocks :thumbup: even for a 3 year old post it's possible to get a reply :D
Thank you - this illustrates the question well.
fiendhunter
Posts: 35
Joined: 24 Jul 2019, 15:27

Re: graphics: create bmp files from scratch

12 Nov 2020, 08:02

really good work.

Return to “Scripts and Functions”

Who is online

Users browsing this forum: gwarble and 23 guests