Search Forum.. 

12864 B/W StartScreen PNG Convertor (PHP)

 I Developed this code, to be able to convert images without using the digole script

It it a very straight forward script that needs GD2 library in PHP.

It opens IMG.png, and outputs output.bin. output.bin will be 1024 bytes to be sent directly to the screen ("SSS",0x00,0x04,Sendfile(output.bin))

IMG.png must be 128x64 and Black and White colors only.

 

<?php

 //*************************************************

//PNG2BIN

//Programmer: Gregory Michalik

//**************************************************

 

$im = imagecreatefrompng("IMG.png");

$a=fopen("output.bin","w");

for($y=0;$y<64;$y=$y+8){

for($x=0;$x<128;$x++){

$data="";

for($y2=$y;$y2<$y+8;$y2++){if(imagecolorat($im,$x,$y2)==0){$data.="0";}else{$data.="1";}}

fputs($a,pack('H*', str_pad(base_convert($data, 2, 16), 2, "0", STR_PAD_LEFT)));

}}

fclose($a);

?>

RE:12864 B/W StartScreen PNG Convertor (PHP)

If you use this code, please give credit.

Copyright Digole Digital Solutions, 2008-2022. All rights reserved.
Powered by Digole