[TOOL] Converter QMG/ASTC->PNG

sorg

Senior Member
Sep 5, 2006
1,049
1,136
143
台灣
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.
 

Attachments

Last edited:

hokamp

Member
Aug 28, 2010
36
11
0
I tried it on Note 3 Neo 4.4.2 and its give me a segmentation fault in some images.

Sent from my SM-N910C using XDA Premium HD app
 

sorg

Senior Member
Sep 5, 2006
1,049
1,136
143
台灣
I tried it on Note 3 Neo 4.4.2 and its give me a segmentation fault in some images.

Sent from my SM-N910C using XDA Premium HD app
attach these images - i will see. As far as i know, Samsung starts to support qmg images from Android 4.4.4.

If you mean boot animation or battery images - then it's not supported! Only qmg images from APK supported, and only in ROM where such APK originally supported.
 
Last edited:
  • Like
Reactions: cerj

sorg

Senior Member
Sep 5, 2006
1,049
1,136
143
台灣
I think the astc is a file that is there in place of xml... This is only what I was told.. I do not have the Note 4 or any Note 4 apks yet, so I have not looked myself..
It doesn't look like binary-xml. It's image. May be it's kind of vector image (for better scale).
 
  • Like
Reactions: cerj

sorg

Senior Member
Sep 5, 2006
1,049
1,136
143
台灣
UPD. Yes, my tool can convert astc images too :)
just rename it to qmg first. Even my S3 can convert.
I will update tool to support astc without renaming.

Updated to 1.1 with astc extension support.
 
Last edited:
  • Like
Reactions: and2 and cerj

hansmoon

Senior Member
Nov 25, 2011
57
38
0
Hi @sorg how about astc files? this method convert them too?
astc can be converted to tga, dds ...
USE Mali Texture compression Tool
astcenc.exe d option.
Additional TRANSPARENCY control must be neefed.
astc has many various type image.
You must manage it case by case...

Sent from my SHV-E210S using XDA Free mobile app

---------- Post added at 09:20 AM ---------- Previous post was at 08:28 AM ----------



i converted 9.png
 
Last edited:
  • Like
Reactions: cerj and Albe95

sorg

Senior Member
Sep 5, 2006
1,049
1,136
143
台灣
astc can be converted to tga, dds ...
USE Mali Texture compression Tool
astcenc.exe d option.
Additional TRANSPARENCY control must be neefed.
astc has many various type image.
You must manage it case by case...
If astc natively supported by ROM then just use my converter. It will convert to proper png with all transparencies.
 
  • Like
Reactions: Albe95 and cerj

hansmoon

Senior Member
Nov 25, 2011
57
38
0
what about additional SUPPORT .webp ?

I can convert it with same way.

I convert images easily using YOUR tool.

THANK YOU.

Sent from my SHV-E210S using XDA Free mobile app
 
  • Like
Reactions: cerj

hansmoon

Senior Member
Nov 25, 2011
57
38
0
Yes.. I convert .webp with imagemagick.

I think, this tool can convert webp also.

Sent from my SHV-E210S using XDA Free mobile app
 
  • Like
Reactions: cerj