Attend XDA's Second Annual Developer Conference, XDA:DevCon 2014!
5,808,050 Members 42,829 Now Online
XDA Developers Android and Mobile Development Forum

[WINDOWS+LINUX+ANDROID] PNG2RLE - Create your own kernel boot logo easily

Tip us?
 
alireza7991
Old
#1  
alireza7991's Avatar
Senior Member - OP
Thanks Meter 2,266
Posts: 763
Join Date: Sep 2012
Location: Shahrekord

 
DONATE TO ME
Prompt [WINDOWS+LINUX+ANDROID] PNG2RLE - Create your own kernel boot logo easily

Screenshot from sources/usage.

About

PNG2RLE is a cross-platform tool which convert png images to rle image. RLE image format is used by some devices as kernel logo format because it's fast and provides a pretty good compression. There are some similar scripts but they are neither cross-platform nor standalone and they need to ImageMagick (which png2rle does not). This has made png2rle be the easiest to use one.

Since it's cross-platform you can use it on a windows machine, a linux one or even run it on your Android device!

The project is open source, Sources are here : https://github.com/alireza7991/png2rle

How to use

It's pretty straghtforward. Just get binaries for your OS, put there some where, put you png file there as well and open terminal/command line:

Code:
./png2rle_linux XYZ.png KMN.rle
*"png2rle_linux" is just in case you are using it on linux. for android it's "png2rle_android" and for windows "png2rle.exe".
*"XYZ.png" is name of the png file and "KMN.rle" is name of output rle file.

Technical Info

about RLE compression: format uses a simple compression method, use 2 cells for each pixel, one stores pixel info and second one stores number of repeats of pixel. so if we have 10000 black pixel in a line, it will be a pixel with 10000 repeats.

about RLE pixel format: Unlike PNG, RLE uses 16bits pixels, this means there is 5 bits for red, 6 for green and 5 for blue. no alpha is implemented. this makes RLE pixels be 50% smaller than RBGA pixels in PNG.

How PNG is converted to RLE:

Since these two format use completely different compression and pixel format, we have to first convert PNG to raw rgba8888 pixels, then it should be converted to rgb888 and finally a hybrid converter converts it to rle565 (converting to both rgb565 and rle565 at same time).
More details about how I could convert png to rle is available in the main.c file in sources.

Download Mirrors

V1.0 : Linux Windows Android

Licence

Code:
/* 
 * PNG2RLE , standalone cross-platform png to rle converter.
 * Copyright (C) 2014 Alireza Forouzandeh Nezhad <alirezafn@gmx.us> <http://alirezafn.net>
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2
 * of the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 *
*/
Special thanks to lodepng library developer which I have used for handling png files.
Debugging is twice as hard as writing the code in the first place.
Therefore, if you write the code as cleverly as possible, you are,
by definition, not smart enough to debug it.

Brian Kernighan
The Following 17 Users Say Thank You to alireza7991 For This Useful Post: [ Click to Expand ]
 
alireza7991
Old
#2  
alireza7991's Avatar
Senior Member - OP
Thanks Meter 2,266
Posts: 763
Join Date: Sep 2012
Location: Shahrekord

 
DONATE TO ME
reserved.
Debugging is twice as hard as writing the code in the first place.
Therefore, if you write the code as cleverly as possible, you are,
by definition, not smart enough to debug it.

Brian Kernighan
The Following 5 Users Say Thank You to alireza7991 For This Useful Post: [ Click to Expand ]
 
Morningstar
Old
#3  
Morningstar's Avatar
Senior Member
Thanks Meter 118
Posts: 277
Join Date: Apr 2006
Very interesting.....I'll have to play around with this when I get home. Nice work!

○●~astra petas~●○
~astra petas~
The Following User Says Thank You to Morningstar For This Useful Post: [ Click to Expand ]
Tags
kernel, logo, png, rle
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes