[LG V20 Themes, Apps, and Mods] emdroidle:
You may or may not have noticed "raw_resources" on your device (/dev/block/bootdevice/by-name/raw_resources). Due to another distraction going away (looks like LineageOS isn't going to be long for the V20, the quality is too low despite my efforts), I've gotten back to this project and reached my goal.

The goal had been to modify the images in raw_resources, the program is attached to this message. Grab rrchlogo.py.gz and uncompress it, then boot to recovery. To replace the LG logo on start follow these steps:

`dd if=/dev/block/bootdevice/by-name/raw_resources of=raw.bin`

`adb pull /raw.bin`

`python rrchlogo.py new_logo.png raw.bin raw.new.bin`

`adb push raw.new.bin /`

`dd if=raw.bin.out of=/dev/block/bootdevice/by-name/raw_resources`

While you've got raw.new.bin handy, you're welcome to do other things such as what was suggested by [MENTION=5285354]4shared[/MENTION] here. Due to ethics concerns I'm unwilling to automate that step.

Now, a word about the format used in raw_resources. The data is very simple run-length encoding. All the data is 4-byte tuples: 1-byte repetition count, 1-byte blue luminosity, 1-byte green luminosity and 1-byte red luminosity. This is a very primitive image encoding by today's standards. Simple encodings are par for the course inside a bootloader though.

The weakness of this format is it doesn't deal well with anything which isn't large areas of single-color. Take a look at the two attached images. In raw_resources the one on the left the first two lines would be encoded as the bytes 0xFE 0xFF 0xFF 0xFF; 0xFE 0x00 0x00 0x00. There would be 126 copies of this 8 bytes resulting in use of 1016 bytes.

The one on the right is much worse for RLE. The first two pixels of the first line would be encoded as 0x01 0xFF 0xFF 0xFF; 0x01 0x00 0x00 0x00. Then there would be 126 copies of this for the rest of the line. Then there would be 253 copes of that sequence for the whole image resulting in use of 258064 bytes.

Meanwhile the PNG format encodes the image on the left as 168 bytes, the one on the right as 163 bytes. RLE is decent for large regions of solid color and horizontal lines. Thin vertical lines are killer for this RLE implementation.

Due to these limitations, do not expect to put large smoothly shaded images onto your startup screen. `rrchlogo.py` tries to shrink the existing data to the extent it can. As a result you can make use of roughly 2MB of the 4MB space allocated. That is only enough to guarantee a 724x724 image. Personally on start mine displays in black and white, an address and a US$60 reward for return in an 84-point font (I don't feel the need to display a company logo on start, I simply want my device back!).

Beware this is believed to be functioning first try at this. Bugs could cause the bootloader to crash giving you a brick (testing suggests this is unlikely, but not impossible). This also lacks the ability to allow you to move where onscreen the images are displayed.

I'm also attaching `rrdecode.py`, a Python script which simply decodes all the images out of a raw_resources.bin file.

This can also be found on GitHub here. I have tested this and found it to work with raw_resources for the LG V20. This may work with raw_resources from earlier devices (V10, G4, G5) or later devices, but this hasn't been ascertained.