Invalid Screenshots in .jpg instead of .png


mireq

Members
Jan 6, 2019
8
15
From MIUI 12.5 on my Poco X3 Pro are screenshots saved as jpg instead of png. I see, that MiuiSystemUI.apk in xiaomi.eu is patched and com.android.systemui.screenshot.SaveImageInBackgroundTask contains png path, but from 12.5 screenshots are saved using MiuiScreenshot.apk and MiuiSystemUI.apk is only as fallback. To save in png format MiuiScreenshot.apk needs to be patched too.
 

Attachments

  • screenshot_patch.txt
    740 bytes · Views: 95

Igor Eisberg

Developer
Staff member
Oct 6, 2016
7,309
322
It's not "patched" because we don't even touch it. This isn't a bug, that's Xiaomi's design choice.
 

mireq

Members
Jan 6, 2019
8
15
It's not "patched" because we don't even touch it. This isn't a bug, that's Xiaomi's design choice.
Thanks. In MIUI >=11 < 12.5 was for screenshots responsible MiuiSystemUI.apk and suffix in decompiled binary was .jpg. In version 12.5 i noticed, that suffix is .png, that's why I thought it was patched. Sorry for false alert.
 

mireq

Members
Jan 6, 2019
8
15
I dont need to ask, i have tried and it does not work. I checked MiuiSystemUI.apk (https://pastebin.com/y46xcVvG line 81), i checked CustoMIUIzer source code (https://code.highspec.ru/Mikanoshi/...mikanoshi/customiuizer/mods/System.java#L6111 line 6111), it hooks to com.android.systemui.screenshot.SaveImageInBackgroundTask which is never called (only if com.miui.screenshot service is broken). I have checked adb output and it really calls com.miui.screenshot (https://pastebin.com/SDg4ZmB9)
 

mireq

Members
Jan 6, 2019
8
15
CustoMIUIzer configured, EdXposed enabled, system restarted after settings change and screenshots saved as jpeg. If i disable com.miui.screenshot app, then screenshots are saved as png, but screenshot gesture is not working, long screenshot not working + annoying bubble saying, that screenshots are not working ;) Maybe its working in MIUI12.5 A10?
Screenshot_20211108-175604.png
Screenshot_20211108-175530.png
Screenshot_2021-11-08-18-21-09-367_com.miui.gallery.jpg
 

Igor Eisberg

Developer
Staff member
Oct 6, 2016
7,309
322
CustoMIUIzer configured, EdXposed enabled, system restarted after settings change and screenshots saved as jpeg. If i disable com.miui.screenshot app, then screenshots are saved as png, but screenshot gesture is not working, long screenshot not working + annoying bubble saying, that screenshots are not working ;) Maybe its working in MIUI12.5 A10?
View attachment 39561View attachment 39562View attachment 39563
Well, CustoMIUIzer has to be updated then, since Xiaomi has decoupled many of their features into separate apps, MiuiScreenshot is a major example. Even the Partial screenshot feature that used to be in MiuiSystemUI is no longer included there, and is exclusively part of MiuiScreenshot.

The switching to JPEG might have been due to some limitations of PNG dimensions or memory allocation requirements, especially relevant for scrolling screenshots.
 
  • Like
Reactions: Blastboom Strice

mireq

Members
Jan 6, 2019
8
15
The switching to JPEG might have been due to some limitations of PNG dimensions or memory allocation requirements, especially relevant for scrolling screenshots.
No ;) Internally screenshot is uncompresed (ARGB_8888 https://pastebin.com/B35N0zWS - this can be few GB for long screenshots). Memory requirement for LZ77 (used in PNG) is really small (less than 1MB). Maximum dimensions are 4294967295 x 4294967295px. There are really no technical reasons for JPEG.
 

Igor Eisberg

Developer
Staff member
Oct 6, 2016
7,309
322
No ;) Internally screenshot is uncompresed (ARGB_8888 https://pastebin.com/B35N0zWS - this can be few GB for long screenshots). Memory requirement for LZ77 (used in PNG) is really small (less than 1MB). Maximum dimensions are 4294967295 x 4294967295px. There are really no technical reasons for JPEG.
Perhaps, but I personally stumbled upon a case where a long screenshot was unreadable by a certain application. Can't remember the details but it was a PNG.
 
Dec 3, 2020
870
182
The switching to JPEG might have been due to some limitations of PNG dimensions or memory allocation requirements, especially relevant for scrolling screenshots.
Just to know, scrollshots are in png format. :emoji_sweat_smile:
EDIT: Wait, are they now in jpg too? I think it used to be png few motnhs ago...
CustoMIUIzer configured, EdXposed enabled, system restarted after settings change and screenshots saved as jpeg. If i disable com.miui.screenshot app, then screenshots are saved as png, but screenshot gesture is not working, long screenshot not working + annoying bubble saying, that screenshots are not working ;) Maybe its working in MIUI12.5 A10?
Customiuizer is actually for miui 11 if I remember well. I think the developer doesn't yet have a device with miui 12. I've found some other apps to create png screenshots, but after detailed compairing I found out they ~were the same (png and jpg). Maybe compression was already applied before converted to png. So after trying to get a png screenshot, I ~just gave up. You ~could take scrollshots instead if you want png, but I think again the resolution, color depth etc ~are the same even if it was a simple jpg screenshot. I ~dunno what's happening. :emoji_laughing:

On another note, I think it's better to use LSPosed, instead of EdXposed. Edxposed ~is outdated and probably fails safetynet.

Check here how to do it (lsposed section).
 
  • Like
Reactions: katerpanne