[Tool/Web/Other] Generate vehicle colors to png
#1

Hay there, here is something useful for User Control Panels or just to generate SA vehicle colors to png images.

You can define height and width.

PHP Code:
<?php
$width 
50;
$height 50;
$colors = array(
// The existing colours from San Andreas
0x0000000xF5F5F50x2A77A10x8404100x2637390x86446E0xD78E100x4C75B70xBDBEC60x5E7072,
0x46597A0x656A790x5D7E8D0x58595A0xD6DAD60x9CA1A30x335F3F0x730E1A0x7B0A2A0x9F9D94,
0x3B4E780x732E3E0x691E3B0x96918C0x5154590x3F3E450xA5A9A70x635C5A0x3D4A680x979592,
0x421F210x5F272B0x8494AB0x767B7C0x6464640x5A57520x2525270x2D3A350x93A3960x6D7A88,
0x2219180x6F675F0x7C1C2A0x5F0A150x1938260x5D1B200x9D98720x7A75600x9895860xADB0B0,
0x8489880x304F450x4D62680x1622480x272F4B0x7D62560x9EA4AB0x9C8D710x6D18220x4E6881,
0x9C9C980x9173470x661C260x949D9F0xA4A7A50x8E8C460x341A1E0x6A7A8C0xAAAD8E0xAB988F,
0x851F2E0x6F82970x5858530x9AA7900x601A230x20202C0xA4A0960xAA9D840x78222B0x0E316D,
0x722A3F0x7B715E0x741D280x1E2E320x4D322F0x7C1B440x2E5B200x395A830x6D28370xA7A28F,
0xAFB1B10x3641550x6D6C6E0x0F6A890x204B6B0x2B3E570x9B9F9D0x6C84950x4D84950xAE9B7F,
0x406C8F0x1F253B0xAB92760x1345730x96816C0x64686A0x1050820xA199830x3856940x525661,
0x7F69560x8C929A0x596E870x4735320x44624F0x730A270x2234570x640D1B0xA3ADC60x695853,
0x9B8B800x620B1C0x5B5D5E0x6244280x7318270x1B376D0xEC6AAE0x000000,
// SA-MP extended colours (0.3x)
0x1775170x2106060x1254780x452A0D0x571E1E0x0107010x25225A0x2C89AA0x8A4DBD0x35963A,
0xB7B7B70x464C8D0x84888C0x8178670x817A260x6A506F0x583E6F0x8CB9720x824F780x6D276A,
0x1E1D130x1E13060x1F25180x2C45310x1E4C990x2E5F430x1E99480x1E99990x9999760x7C8499,
0x992E1E0x2C1E080x1424070x993E4D0x1E4C990x1981810x1A292A0x16616F0x1B66870x6C3F99,
0x481A0E0x7A73990x746D990x53387E0x2224070x3E190C0x46210E0x991E1E0x8D4C8D0x805B80,
0x7B3E7E0x3C17370x7335170x7818180x83341A0x8E2F1C0x7E3E530x7C6D7C0x020C020x072407,
0x1630120x16301B0x642B4F0x3684520x9995900x818D960x99991E0x7F994C0x8392920x788222,
0x2B3C990x3A3A0B0x8A794E0x0E1F490x15371C0x15273A0x3757750x0608200x0713260x20394B,
0x2C50890x15426C0x1032500x2416630x6920150x8C8D940x5160130x090F020x8C573A0x52888E,
0x995C520x99581E0x993A630x998F4E0x99311E0x0D18420x521E1E0x42420D0x4C991E0x082A1D,
0x96821D0x197F190x3B141F0x7452170x893F8D0x7E1A6C0x0B370B0x27450D0x071F240x784573,
0x8A653A0x7326170x3194900x56941D0x59163D0x1B8A2F0x38160B0x0418040x355D8E0x2E3F5B,
0x561A280x4E0E270x706C670x3B3E420x2E2D330x7B7E7D0x4A44420x28344EFF
);
for(
$i 0$i 256$i++)
{
    
$im imagecreatetruecolor($width$height);
    
imagefill($im00,$colors[$i]);
    
header('Content-type: image/png');
    
$save "colors/$i.png";
    
imagepng($im,$save);
    
imagedestroy($im);
}
?>
Result is something like this:
Reply
#2

Nice, this would be useful.
Reply
#3

Why would it need to be images? You can create colored squares extremely easy with simple CSS. It'd also be more efficient considering no images would have to be downloaded, wasting valuable time and bandwith.
Reply
#4

Quote:
Originally Posted by Vince
View Post
Why would it need to be images? You can create colored squares extremely easy with simple CSS. It'd also be more efficient considering no images would have to be downloaded, wasting valuable time and bandwith.
This^
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)