[TOOL] Converter QMG/ASTC->PNG

dwitherell

Retired Forum Moderator
May 2, 2011
4,061
9,252
0
what would u edit in the jar... and how would u go about that? I
Assuming the n4 4.4.4 base follows similar patterns seen on recent phones, you'll need to decompile a deodexed services.jar to make the edit.

Not sure on the note 4 4.4.4 location but on a note3 4.4.2 the hook resided in PackageManagerService.smali (com/android/server/pm/PackageManagerService.smali) in a method called compareSignatures([Landroid/content/pm/Signature;[Landroid/content/pm/Signature;)I

There are any number of ways to perform the edits that elicit the desired effect, but that latter part is produced when the method returns a 0x0

Hopefully this wasn't too vague - happy tinkering :)
 

dajumper

Senior Member
Jun 28, 2008
1,954
309
0
41
Not working it say aborted

---------- Post added at 10:27 AM ---------- Previous post was at 10:26 AM ----------

This converter *MUST* be used on device originally supporting QMG, ASTC, etc.. pictures in resources such as: SM-N910, SM-G901, GT-I9305 (only 4.4.4 ROMs) and may be some others recently released.
This converter has neither QMG nor ASTC decoder, it uses the one integrated in the ROM. That's why you can use it only on device originally supporting QMG/ASTC images. Treat it as temporary solution till someone create independent QMG/ASTC decoder.

This is for developers who has experience in linux shell and adb. If you are generic curious user then simply skip it.
You need to extract picconv.zip and push 2 files (picconv and picconv.dex) into /system/bin. Then set 755 permission to picconv (chmod 755 /system/picconv).

how to use:
1) copy whole res folder of desired apk to device. For example /sdcard/tmp/res
2) start adb shell
3) execute: picconv /sdcard/tmp/res /sdcard/tmp/out

Tool will print out converted pictures. In /sdcard/tmp/out you will find all pictures converted to png with the same folder structure. 9.qmg (images with 9patches) will be converted to 9.png with stripes on the edges (same as apktool does), so they are ready to use in apk creation in apktool.
Current version of apktool wrongly strips 9. from 9.qmg images. My tool detects it and correctly convert to 9.png. Tool also converts 9pathes 9.png (if you directly unzip apk) to 9.png with stripes. Thus you may provide res folder with qmg, astc and png pictures. All of them will be converted to images ready to use in apktool. Other files in res folder won't be touched (and won't be copied to destination folder).

Update 1.1:
- add support for .astc extension.

Update 2.0:
- now it's possible to add any extension.
Check picconv script, you can add any extension after -t option. (default set of extensions: png qmg astc webp).

Update 2.1:
- .9. won't be stripped from png if it has been extracted by apktool.
- png will be simply copied if no re-compress required (like .png and .9.png from apktool). You can use option -r if you want to re-compress all png images (useful if some proprietary png format used).

Known issues (up to v2.1):
- if some files produce errors (or warnings, which are actually errors) in decoding, then tool doesn't exit after finish. You can press <ctrl+c> to force finish.

NOTE 1: Even if your ROM supports QMG/ASTC resources, it doesn't mean it can handle APK resources from other device using QMG/ASTC. For example my S3 (I9305 4.4.4 ROM) cannot load some (but some are ok) ASTC pictures. So, for best result, you need to convert such images on device from which you get APK.

NOTE 2: After conversion, you have to use APKTool to assemble APK. You cannot just zip images back to APK! (because all .9.png files must be converted by APKTool to format used in APK).

Tool is intentionally was created as console tool to use it in scripts. I have no plan to create GUI version.
Can you post the images from systemui.apk please? Because I get error aborted he say





Great~~
i convertd images using shell script.
primitively ....

Sent from my SHV-E210S using XDA Free mobile app


---------- Post added at 11:07 AM ---------- Previous post was at 10:27 AM ----------

Not working it say aborted

---------- Post added at 10:27 AM ---------- Previous post was at 10:26 AM ----------



Can you post the images from systemui.apk please? Because I get error aborted he say
Nobody?
 

carl1961

Senior Member
Dec 5, 2010
7,516
6,198
0
Tickfaw
It doesn't look like binary-xml. It's image. May be it's kind of vector image (for better scale).
@sorg astc is compressed png it can be uncompressed with astcenc.exe to a tba
image then xnconvert or paint.net or some image too to PNG

attached is tools I used for converting those astc image files to png . astcenc.exe is command line tool. I was wondering how hard it would be to make a script to convert a batch of astc images instead of like one at a time. and keep original name like you did with your tool

http://www.mediafire.com/download/mbxqu39zwbuw220/astc.zip

EDIT: I found a script used for ffmeg imaged files and converted it to use with astcenc.exe instead , I batched convereted 226 with on click, just put these two files in folder with astc file and click on bat file

http://forum.xda-developers.com/attachment.php?attachmentid=3013976&d=1415934075
 
Last edited:

sorg

Senior Member
Sep 5, 2006
1,049
1,136
143
台灣
@sorg astc is compressed png it can be uncompressed with astcenc.exe to a tba
image then xnconvert or paint.net or some image too to PNG

attached is tools I used for converting those astc image files to png . astcenc.exe is command line tool. I was wondering how hard it would be to make a script to convert a batch of astc images instead of like one at a time. and keep original name like you did with your tool

http://www.mediafire.com/download/mbxqu39zwbuw220/astc.zip

EDIT: I found a script used for ffmeg imaged files and converted it to use with astcenc.exe instead , I batched convereted 226 with on click, just put these two files in folder with astc file and click on bat file

http://forum.xda-developers.com/attachment.php?attachmentid=3013976&d=1415934075
it's good to read whole thread before post. My tool already support ASTC pictures.
Tools from MALI SDK don't convert it correctly. I've tried several pics long time ago - result is upside down picture with opaque (originally was transparent) background.
The best way is to ask people in Note 4 forum to convert these pics for you using my tool. Fortunately, only some packages use this format.
 

carl1961

Senior Member
Dec 5, 2010
7,516
6,198
0
Tickfaw
it's good to read whole thread before post. My tool already support ASTC pictures.
Tools from MALI SDK don't convert it correctly. I've tried several pics long time ago - result is upside down picture with opaque (originally was transparent) background.
The best way is to ask people in Note 4 forum to convert these pics for you using my tool. Fortunately, only some packages use this format.
I mainly posted for those with no note 4 phone who come here

Thanks @sorg for the heads up, the astc converter did have png's upside down, I did batch script when converting the tgb to png to flip 180 deg

for %%a in ("*.*") do nconvert -out png -rotate 180 "%%a" "%%~na" tga
 

hansmoon

Senior Member
Nov 25, 2011
57
38
0
convert -flip aaa.tga aaa.png

- by imagemagick command line

not rotate 180 but vertical flip

Sent from my SHV-E210S using XDA Free mobile app

---------- Post added at 02:13 AM ---------- Previous post was at 02:06 AM ----------

astc can be converted in PC

astcenc.exe in mali texture compression tool

astcenc -d aaa.astc aaa.tga
convert -flip aaa.tga aaa.png

astcenc -d aaa.astc aaa.dds
(some 2 channel astc images that has no alpha channel)
and then in Photoshop with dds plug-in, apply alpha channel )

Sent from my SHV-E210S using XDA Free mobile app
 
Last edited: