Skip to content

Instantly share code, notes, and snippets.

@GarnetSunset
Created May 30, 2020 23:13
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save GarnetSunset/87209a481c7dd52e40bb08d38737812e to your computer and use it in GitHub Desktop.
Save GarnetSunset/87209a481c7dd52e40bb08d38737812e to your computer and use it in GitHub Desktop.
import io
offset0 = 0x4000
offset1 = 0x5000
offset2 = 0x740000
offset3 = 0xD2F000
offset4 = 0x146A000
outpt = open("logo_new_mi9t.img", "wb")
emptyContent = [0 for i in range(0x1A59000)]
mi9offset = [0x4C, 0x4F, 0x47, 0x4F, 0x21, 0x21, 0x21, 0x21, 0x05, 0x00, 0x00, 0x00,
0x3B, 0x07, 0x00, 0x00, 0x40, 0x07, 0x00, 0x00, 0xEF, 0x05, 0x00, 0x00,
0x2F, 0x0D, 0x00, 0x00, 0x3B, 0x07, 0x00, 0x00, 0x6A, 0x14, 0x00, 0x00,
0xEF, 0x05]
outpt.write(bytearray(emptyContent))
#export in photoshop as 24bit windows bmps
outpt.seek(offset0)
outpt.write(bytearray(mi9offset))
#Locked pic has to be 1080x2340
outpt.seek(offset1)
img = open("pic1.bmp", "rb")
outpt.write(img.read())
#Fastboot pic has to be 1080x1920
outpt.seek(offset2)
img = open("pic2.bmp", "rb")
outpt.write(img.read())
#Unlocked pic has to be 1080x2340
outpt.seek(offset3)
img = open("pic3.bmp", "rb")
outpt.write(img.read())
#Error pic has to be 1080x1920
outpt.seek(offset4)
img = open("pic4.bmp", "rb")
outpt.write(img.read())
outpt.close()
@Arun-ez
Copy link

Arun-ez commented Oct 2, 2021

hello sir please can you make a py script for Mi 11x to make logo.img ?

@GarnetSunset
Copy link
Author

Modify it to make it match your res, good luck!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment