[TOOL] Converter QMG/ASTC->PNG

Search This thread

sorg

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

  • picconv.zip
    3 KB · Views: 2,165
  • picconv_1.1.zip
    3.1 KB · Views: 436
  • picconv_2.0.zip
    3.4 KB · Views: 501
  • picconv_2.1.zip
    3.7 KB · Views: 12,807
Last edited:

hokamp

Member
Aug 28, 2010
36
11
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,137
台灣
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,137
台灣
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,137
台灣
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
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 ----------

test_9.png


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

sorg

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

Top Liked Posts

  • There are no posts matching your filters.
  • 55
    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.
    7
    You can use this tool even in recovery. You just need:
    1) mount system and data partitions
    2) get BOOTCLASSPATH variable (you need to boot into android and in adb shell execute the command set).
    3) add export BOOTCLASSPATH=blahblahblah into /system/bin/picconv script, where blahblahblah is what you get in step 2.
    5
    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
    4
    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 :)
    4
    Sorg you are the man... Thank you so much.. I know a few themers including myself that will find this very handy.. Very Very nice of you to share
Our Apps
Get our official app!
The best way to access XDA on your phone
Nav Gestures
Add swipe gestures to any Android
One Handed Mode
Eases uses one hand with your phone