Digole
©DIGITAL
SOLUTIONS

Serial Display emulator    New Display User manual

Forum login or
Login:
Password:
  
Forum Catagory
Digole Serial Display (210)
  12864 LCD/OLED module (23)
  24064 LCD module (3)
  Color LCD Modules (29)
  Color OLED module (20)
  Online Emulater (5)
  Universal GLCD module (1)
  Universal Text LCD module (2)
Mini Display Panels (0)
  Mini LCDs (0)
  Mini OLEDs (0)
Pattern Drive Module (0)
~Buy & Sell on Digole (2)
~Others~ (5)
Forum : Digole Serial Display : 12864 LCD/OLED module :

 Search Forum.. 
 Creat New Topic   Reply 

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/Digole Technologies Inc., 2008-2024. All rights reserved.
Powered by Digole