FORUMS
Remove All Ads from XDA

[MOD][SPLASH][OP5t] Splash Screen Image Injector

192 posts
Thanks Meter: 479
 
By makers_mark, Senior Member on 23rd December 2017, 05:34 AM
Post Reply Email Thread
This is a program that I wrote to decode and re-encode the OnePlus 5T "logo.bin" file. Please read below so you can better understand this type of encoding being used:
What Is A Raw Image?

A raw image, whether it be a file or an image in memory, is simply pixel data. There is no extra information like width, height, name, end of line... Absolutely nothing, just pixel data. If you have an image that is raw and the resolution is 1080x1920 and you are using a typical RGB24 or BGR24 (like the ones used here), then your exact filesize or size in memory will be 1080x1920x3! We use 3 here because there is one byte for the R or red component, one for the G (green), and one for the B(blue).

What Is A Run Length Encoded Image?

A run length image encoding uses a count ;usually a single byte (char), 2 bytes (short int), or 4 bytes (long int); and then the pixel components. So instead of writing out 300 bytes of '0's to make a line of 100 black pixels. Black is RGB(0,0,0). You could encode this as 100, 0, 0, 0. And only use 4 bytes of data to get the exact same image as the 300 byte raw image. All the run length encoding I've found, except the Motorola style which is a little different, use a run length encoding that is pixel-oriented like this.

Now I've found this new one and it is a byte-oriented run length encoding. This is for runs of bytes, not pixels. You may think, well whats the big deal? When you add a little area of color, you increase the run length encoded image in you logo.bin immensely! You use 6 bytes per pixel if there aren't any runs of color data. If you had an image that was a 1080x1920 black image with a 25 pixel horizontal line in the middle. The encoder would be doing runs of black data efficiently until it reached the red area.
.....0 255 0 255 0 255 0 255 0 255 0 133 /// we've reached the top left corner of the red line /// 13 1 30 1 255 1 // << that was just one red pixel!! in bgr color order (13, 30, 255) <<// And it keeps going through the rest of the red pixels on that line using 6 bytes per pixel, which is the opposite of compression. Before reaching the red line the encoding was decoding to 255 zeros over and over, until finally 133 zeros. 255 zeros is 85 black pixels stored in just 2 bytes!

This type of encoding is ONLY good for grey scale images. It is not good with color, but it still will handle color of course. In grey scale, the Red, Blue, and Green data components are always the same values. All the way from black (0,0,0) to white (255, 255, 255); including every shade of grey in between>>>(1,1,1) (2,2,2) (3,3,3)....(243, 243, 243) (254, 254, 254)<<<

One other difference in this method of run length encoding is that the color byte is before the count, which is backwards from all of the other methods.
The attachment contains the executable that was compiled using mingw32 on a 64 bit Windows 10 PC. The PNG library that I used is LodePng, the source is in the download.

Big thanks to @RajGopi for sharing his logo.bin with me and requesting this mod, and testing it as well!

To use the OnePlus 5T Logo Injector:

Decode your logo.bin:
Code:
OP5tLogo -i logo.bin -d
All the PNG 's will be extracted from logo.bin. Edit the PNG(s) that you want to change...
Note:
Your original "logo.bin" file is never changed, it is just read. If the file you try to load isn't a logo.bin file, or a different style, then the program will tell you and exit.
Inject the image(s) back in to the logo.bin:
Code:
OP5tLogo -i logo.bin -j fhd_oppo fhd_at
To list whats in your logo file:
Code:
OP5tLogo -i logo.bin -l
For a more detailed list:
Code:
OP5tLogo -i logo.bin -L
If the colors are messed up use the "-s" switch while decoding.
Code:
OP5tLogo -i logo.bin -d -s
If you had to use the "-s" switch to decode properly, you'll have to use it to inject also:
Code:
OP5tLogo -i logo.bin -j image_name -s
Note:
You can put as many names after "-j" as you want, and it's not case sensitive. You also don't have to put the whole name. If you just put "-j fhd" every image in the logo.bin that starts with "fhd" will be injected. There has to be a PNG with the name in the directory though
The size of your modified.logo.bin will displayed along with the original size, if everything went good. The 'splash' partition is 16 MB on the OnePlus 5T. If you use too much color on too many of the images you will easily go over 16 MB. The program will tell you and delete the "modified.logo.bin" that was created. If for some strange reason you would like to keep it, use the "-B" flag on the command.

The last step is to flash the modified logo file via fastboot with the command
Code:
fastboot flash LOGO modified.logo.bin

Use this at your own risk.
Always make backups.
Always.
Attached Files
File Type: zip OP5tLogo.zip - [Click for QR Code] (64.2 KB, 1084 views)
The Following 17 Users Say Thank You to makers_mark For This Useful Post: [ View ] Gift makers_mark Ad-Free
23rd December 2017, 09:35 AM |#3  
makers_mark's Avatar
OP Senior Member
Flag Kings Mountain
Thanks Meter: 479
 
More
Quote:
Originally Posted by RajGopi

Glad to see your work here.
Been waiting for this.
Merry Christmas

Merry Christmas to you too. Thank you for being humble, understanding, patient, polite, and more than likely an upstanding individual in your realm.
The Following 2 Users Say Thank You to makers_mark For This Useful Post: [ View ] Gift makers_mark Ad-Free
23rd December 2017, 07:52 PM |#4  
Senior Member
Westlake, OH
Thanks Meter: 398
 
More
Cool, thanks for this!
23rd December 2017, 08:51 PM |#5  
Bradl79's Avatar
Senior Member
Flag J'Ville
Thanks Meter: 4,433
 
Donate to Me
More
thank u so much, i was trying to figure out how to do it with the OP3/T/5 and could not figure it out, it just crashed.
24th December 2017, 05:30 AM |#6  
Quote:
Originally Posted by Bradl79

thank u so much, i was trying to figure out how to do it with the OP3/T/5 and could not figure it out, it just crashed.

- Extract the .exe
- Right click while holding 'shift' in the same folder where the .exe is located and 'open command window' here
- Place logo.bin in the same folder
- Run the commands from OP
The Following User Says Thank You to RajGopi For This Useful Post: [ View ] Gift RajGopi Ad-Free
27th December 2017, 01:41 PM |#7  
PeterGuru's Avatar
Senior Member
Flag Mississauga, Ontario, Canada
Thanks Meter: 1,346
 
Donate to Me
More
Quote:
Originally Posted by makers_mark

Flash the "modified.logo.bin" file through fastboot.

Please forgive my ignorance. I think I got everything done properly. I just don't know what you mean by the above statement.

Normally, if I flash a new recovery in fastboot, I use the phrase fastboot flash recovery xxxx.img

What phrase do I use to flash the new logo.bin file?

Thanks,
Peter

P.S. Where on my OP5T is the original logo.bin file located?

P.P.S. I believe I found my logo.bin file; however, it appears I made some kind of mistake and now I simply have a black splash screen, and nothing I do gets the default splash screen back, including Nandroid restore. It always remains black. Does anyone have an original OP5T logo.bin file they can give me to download? Also, the file I found is called LOGO, not logo.bin. It's in the following directory:

/dev/block/bootdevice/by-name/

P.P.S. I also believe I found the right command in fastboot. Is this the command to flash the logo.bin file:

fastboot flash LOGO logo.bin ???
29th December 2017, 05:56 AM |#8  
Quote:
Originally Posted by PeterGuru

Please forgive my ignorance. I think I got everything done properly. I just don't know what you mean by the above statement.

Normally, if I flash a new recovery in fastboot, I use the phrase fastboot flash recovery xxxx.img

What phrase do I use to flash the new logo.bin file?

Thanks,
Peter

P.S. Where on my OP5T is the original logo.bin file located?

P.P.S. I believe I found my logo.bin file; however, it appears I made some kind of mistake and now I simply have a black splash screen, and nothing I do gets the default splash screen back, including Nandroid restore. It always remains black. Does anyone have an original OP5T logo.bin file they can give me to download? Also, the file I found is called LOGO, not logo.bin. It's in the following directory:

/dev/block/bootdevice/by-name/

P.P.S. I also believe I found the right command in fastboot. Is this the command to flash the logo.bin file:

fastboot flash LOGO logo.bin ???

Try this one, flash in recovery just like any flashable zip
Let me know if you still want stock logo
Yes, fastboot flash LOGO logo.bin
The Following User Says Thank You to RajGopi For This Useful Post: [ View ] Gift RajGopi Ad-Free
29th December 2017, 06:43 AM |#9  
makers_mark's Avatar
OP Senior Member
Flag Kings Mountain
Thanks Meter: 479
 
More
Quote:
Originally Posted by PeterGuru

Please forgive my ignorance. I think I got everything done properly. I just don't know what you mean by the above statement.

Normally, if I flash a new recovery in fastboot, I use the phrase fastboot flash recovery xxxx.img

What phrase do I use to flash the new logo.bin file?

Thanks,
Peter

P.S. Where on my OP5T is the original logo.bin file located?

P.P.S. I believe I found my logo.bin file; however, it appears I made some kind of mistake and now I simply have a black splash screen, and nothing I do gets the default splash screen back, including Nandroid restore. It always remains black. Does anyone have an original OP5T logo.bin file they can give me to download? Also, the file I found is called LOGO, not logo.bin. It's in the following directory:

/dev/block/bootdevice/by-name/

P.P.S. I also believe I found the right command in fastboot. Is this the command to flash the logo.bin file:

fastboot flash LOGO logo.bin ???

Thanks for the question, but 49 out of 50 times I do not have the device that I am working with. When you use fastboot program, you flash `x` partition with `y` file.

It doesn't matter what `y` is, but `x` is the name of the particular partition that is case sensitive. You can rename `y` whatever you want. It is hard to find partition dumps or names, so I can not worry about what the actual partition name is for a particular device. I could of asked @RajGopi when he tested, but I did not. With nearing 9 million people on XDA, I will gladly let people do their own research or what not before flashing anything for unsaid reasons which others will understand unsaid. In the past I have guided people to this thread. But thank you for wanting more clarification on the actual command with fastboot, I will include it in the post since this program is made specifically for the OP5t.
The Following User Says Thank You to makers_mark For This Useful Post: [ View ] Gift makers_mark Ad-Free
29th December 2017, 01:22 PM |#10  
PeterGuru's Avatar
Senior Member
Flag Mississauga, Ontario, Canada
Thanks Meter: 1,346
 
Donate to Me
More
Quote:
Originally Posted by RajGopi

Try this one, flash in recovery just like any flashable zip
Let me know if you still want stock logo
Yes, fastboot flash LOGO logo.bin

Worked perfectly. Thank you.

Peter

---------- Post added at 07:22 AM ---------- Previous post was at 07:21 AM ----------

Quote:
Originally Posted by makers_mark

Thanks for the question, but 49 out of 50 times I do not have the device that I am working with. When you use fastboot program, you flash `x` partition with `y` file.

It doesn't matter what `y` is, but `x` is the name of the particular partition that is case sensitive. You can rename `y` whatever you want. It is hard to find partition dumps or names, so I can not worry about what the actual partition name is for a particular device. I could of asked @RajGopi when he tested, but I did not. With nearing 9 million people on XDA, I will gladly let people do their own research or what not before flashing anything for unsaid reasons which others will understand unsaid. In the past I have guided people to this thread. But thank you for wanting more clarification on the actual command with fastboot, I will include it in the post since this program is made specifically for the OP5t.

Thank you for the detailed reply. I appreciate all your hard work. Have a great day.

Peter
The Following User Says Thank You to PeterGuru For This Useful Post: [ View ] Gift PeterGuru Ad-Free
29th December 2017, 02:42 PM |#11  
PeterGuru's Avatar
Senior Member
Flag Mississauga, Ontario, Canada
Thanks Meter: 1,346
 
Donate to Me
More
Quote:
Originally Posted by RajGopi

Try this one, flash in recovery just like any flashable zip
Let me know if you still want stock logo
Yes, fastboot flash LOGO logo.bin

Argh! While your zip file worked perfectly, I'm now trying to modify the PNG file. I got everything done correctly (I think), but when I flash it, I still have your logo, not mine. Obviously there's something I'm doing wrong. Is there anything special about the PNG file? When I copy the modified logo.bin file back to the ZIP file, do I use standard compression or no compression?

Any ideas?

Peter

P.S. I'm trying to get the following PNG file as my Splash Boot image. If someone could create a flashable zip, that would be great, but I still would like to know what I did wrong. I want to learn how to do it, as I did with my OnePlus5.

The Following User Says Thank You to PeterGuru For This Useful Post: [ View ] Gift PeterGuru Ad-Free
Post Reply Subscribe to Thread

Tags
splash logo.bin

Guest Quick Reply (no urls or BBcode)
Message:
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes