Page 4 of 7

py amazfit tool

Posted: 17 Aug 2019, 20:13
by afwafwafw
https://github.com/lolyinseo/py_amazfit ... ee/dev_gtr
https://github.com/ghtalpo/amazfit_verge_lite_tools

what is...
  • can pack/unpack .bin file for amazfit verge lite/gtr(original watchfaces)
what isn't...
  • 100% compatibility with amazfit_bip_tool
  • 100% compatibility with .json structures of bip
requirements
  • python3(tested on 3.7.4)
  • pillow(tested on 6.1.0)

Code: Select all

## usage
* for verge lite
  * see scripts folder
    * to unpack
      * python main.py WATCH_FACE_FILE.bin
    * to pack
      * python main.py WATCH_FACE_FILE.json
    * to convert from extracted GTR watchface(experimental BIP support also)
      * python convert.py EXTRACTED_WATCH_FACE_FOLDER
  * for windows users(experimental) : USE AT YOUR OWN RISK
    * copy & unzip amazfit_verge_lite_tools_WIN32.zip from release/win32
      * to pack
        * drag & drop WATCH_FACE_FILE.json into main/main.exe
      * to unpack
        * drag & drop WATCH_FACE_FILE.bin into main/main.exe
      * to convert from extracted GTR watchface(experimental BIP support also)
        * drag & drop EXTRACTED_WATCH_FACE_FOLDER into convert/convert.exe
* for GTR
  * to unpack
    * python main.py --gtr WATCH_FACE_FILE.bin
  * to pack
    * python main.py --gtr WATCH_FACE_FILE.json
  * for windows users(experimental) : USE AT YOUR OWN RISK
    * copy & unzip amazfit_gtr_tools_WIN32.7z from release/win32
      * to pack
        * drag & drop WATCH_FACE_FILE.json into main_gtr/main.exe
      * to unpack
        * drag & drop WATCH_FACE_FILE.bin into main_gtr/main.exe
It's a python port of Валерий Миронов's AmazfitBipTools(v.1.0.3.1) with some hacks.

Have a fun and feel free to give me some feeback.

Re: py amazfit tool

Posted: 25 Nov 2019, 19:25
by Pinkabou
Did you have a GTS version ?

I try your soft but have a error. My .Bin file is a GTS watchFace

Re: py amazfit tool

Posted: 26 Nov 2019, 16:58
by ajs
Horatius80 wrote: 11 Nov 2019, 16:49
HI I do not know how to contact lolyinseo directly, but in his last dev-gtr the battery scale is not working...
I wrote to him about this problem, if there is any answer. I’ll let you know, or maybe he will write it himself.

Re: py amazfit tool

Posted: 27 Nov 2019, 05:39
by Horatius80
It is OK, I've already figured it out. There are syntax differences in the *.json between GTR and DEV-GTR version .. that was the problem ... here is watchface that works as I wanted

https://amazfitwatchfaces.com/gtr/view/2040

Re: py amazfit tool

Posted: 29 Nov 2019, 08:21
by H078
Any recommendations on how to keep .bin under 2Mb?

I was making digital watch and size of .bin file kept increasing eventhough all images put together are at most 500kb.

Re: py amazfit tool

Posted: 01 Dec 2019, 13:16
by hikashi
Any plans to port in hearts and linear scale i.e. segments? I tried to port in with new elements using the c# as reference but to no avail.
Im not too sure what is the equivalent of list<xy> to python.

Re: py amazfit tool

Posted: 03 Dec 2019, 15:46
by pacomar
H078 wrote: 29 Nov 2019, 08:21
Any recommendations on how to keep .bin under 2Mb?

I was making digital watch and size of .bin file kept increasing eventhough all images put together are at most 500kb.
reducing the number and size in pixels of png files.

Re: py amazfit tool

Posted: 04 Dec 2019, 17:31
by Horatius80
pacomar wrote: 03 Dec 2019, 15:46
H078 wrote: 29 Nov 2019, 08:21
Any recommendations on how to keep .bin under 2Mb?

I was making digital watch and size of .bin file kept increasing eventhough all images put together are at most 500kb.
reducing the number and size in pixels of png files.
... :idea: Or do not use antialiasing to prevent occurrence of semitransparent and partially transparent pixels, reduce the number of colors per image, color palette has to be RGB and using maximal PNG compression ... :idea:

Re: py amazfit tool

Posted: 04 Dec 2019, 18:42
by dpassaggio
Hi guys, I just tried the Gts version of this tools in python, but I find myself with the same error I had with the gtr version, or following the whole unpack guide, I get the following error

Code: Select all

Traceback (most recent call last):
  File "main.py", line 4, in <module>
    from watchFaceParser.config import Config
ImportError: No module named watchFaceParser.config
how do I fix it? :roll:

Re: py amazfit tool

Posted: 09 Dec 2019, 09:28
by DJArty
dpassaggio wrote: 04 Dec 2019, 18:42
.. same error

Code: Select all

Traceback (most recent call last):
ImportError: No module named watchFaceParser.config
+1 have same error (Ubuntu 16.04 x64)


*****************

P.S. but maybe its because default "python main.." starts python ver 2.7 so may be just need start like "python3 main ..."

P.P.S. Yes need start

Code: Select all

python3.7 main_py --gts --file watchface_bin  
and pillow 6+ for python3.7

Re: py amazfit tool

Posted: 10 Dec 2019, 00:52
by hikashi
H078 wrote: 29 Nov 2019, 08:21
Any recommendations on how to keep .bin under 2Mb?

I was making digital watch and size of .bin file kept increasing eventhough all images put together are at most 500kb.
500kb is too big
> Reuse asset i.e. same 'number' asset for different element like date, activity
> Use assets with smaller dimension
> Use 266 pixel size for the 0001 preview asset

Cheers!

Re: py amazfit tool

Posted: 18 Dec 2019, 03:51
by Luizneto100
I'm new, help me, because every time I pack, the bin comes out with a different color from the original? Ex: Green color dial; Installed: Turns Red.

Re: py amazfit tool

Posted: 18 Dec 2019, 16:25
by H078
What are acceptable transparecy levels for .png files? I tried 32bit and anything lower than that tool throws an error in a log file " invalid transparecy mask".
32bit transparecy generally increases file size in kb.

Re: py amazfit tool

Posted: 18 Dec 2019, 17:25
by schwedenpaule
hikashi wrote: 10 Dec 2019, 00:52
H078 wrote: 29 Nov 2019, 08:21
Any recommendations on how to keep .bin under 2Mb?

I was making digital watch and size of .bin file kept increasing eventhough all images put together are at most 500kb.
500kb is too big
but why is 500kb too big ? For me it seems there is something unnecessary in the bin-file.. or the images are rewritten NOT compressed (if I have 2 bigger images in, the .bin-size increases more than the filesize of the two bigger images!)..
Is there something that can be left out, like the preview gif ? I tried modifiying the python script setting the size of the gif to 1x1, sadly has no effect to the bin-size. Other ideas ?

Re: py amazfit tool

Posted: 24 Dec 2019, 12:43
by hikashi
schwedenpaule wrote: 18 Dec 2019, 17:25
hikashi wrote: 10 Dec 2019, 00:52
H078 wrote: 29 Nov 2019, 08:21
Any recommendations on how to keep .bin under 2Mb?

I was making digital watch and size of .bin file kept increasing eventhough all images put together are at most 500kb.
500kb is too big
but why is 500kb too big ? For me it seems there is something unnecessary in the bin-file.. or the images are rewritten NOT compressed (if I have 2 bigger images in, the .bin-size increases more than the filesize of the two bigger images!)..
Is there something that can be left out, like the preview gif ? I tried modifiying the python script setting the size of the gif to 1x1, sadly has no effect to the bin-size. Other ideas ?
Unfortunately we have to work around with the 2 mb limit. The biggest contributor to the bin size is the asset dimension size regardless of content or quality of compression.

Re: py amazfit tool

Posted: 28 Dec 2019, 02:25
by hikashi
Sharing some working syntax with analog dial.
"DaysProgress": {
"AnalogMonth": {
"OnlyBorder": false,
"Color": "0x00000000",
"CenterOffset": {
"X": 84,
"Y": 0
},
"Shape": {
"X": 0,
"Y": 0
},
"Sector": {
"StartAngle": 0,
"EndAngle": 33000
},
"Image": {
"X": 5,
"Y": 44,
"ImageIndex": 12
}
},
"AnalogDOW": {
"OnlyBorder": false,
"Color": "0x00000000",
"CenterOffset": {
"X": 0,
"Y": 92
},
"Shape": {
"X": 0,
"Y": 0
},
"Sector": {
"StartAngle": 0,
"EndAngle": 30858
},
"Image": {
"X": 5,
"Y": 35,
"ImageIndex": 13
}
}
},
"StepsProgress": {
"ClockHand": {
"OnlyBorder": false,
"Color": "0x00000000",
"CenterOffset": {
"X": -84,
"Y": 0
},
"Shape": {
"X": 0,
"Y": 0
},
"Sector": {
"StartAngle": -15000,
"EndAngle": 15000
},
"Image": {
"X": 5,
"Y": 44,
"ImageIndex": 13
}
}
},

Re: py amazfit tool

Posted: 31 Dec 2019, 09:43
by Louis_Cypher
schwedenpaule wrote: 18 Dec 2019, 17:25
hikashi wrote: 10 Dec 2019, 00:52
H078 wrote: 29 Nov 2019, 08:21
Any recommendations on how to keep .bin under 2Mb?

I was making digital watch and size of .bin file kept increasing eventhough all images put together are at most 500kb.
500kb is too big
but why is 500kb too big ? For me it seems there is something unnecessary in the bin-file.. or the images are rewritten NOT compressed (if I have 2 bigger images in, the .bin-size increases more than the filesize of the two bigger images!)..
Is there something that can be left out, like the preview gif ? I tried modifiying the python script setting the size of the gif to 1x1, sadly has no effect to the bin-size. Other ideas ?
Resizing 001.png (the preview image) to 266 pixels reduced my .bin from 2mb to 1,5mb. Perhaps making it even smaller can decrease .bin for less than 1mb (I didn't try yet).
It looks like the problem is with .gif created during packing. It uses 10 frames, and I think it's not compressed.

Re: py amazfit tool

Posted: 01 Jan 2020, 03:04
by hikashi
Louis_Cypher wrote: 31 Dec 2019, 09:43
schwedenpaule wrote: 18 Dec 2019, 17:25
hikashi wrote: 10 Dec 2019, 00:52

500kb is too big
but why is 500kb too big ? For me it seems there is something unnecessary in the bin-file.. or the images are rewritten NOT compressed (if I have 2 bigger images in, the .bin-size increases more than the filesize of the two bigger images!)..
Is there something that can be left out, like the preview gif ? I tried modifiying the python script setting the size of the gif to 1x1, sadly has no effect to the bin-size. Other ideas ?
Resizing 001.png (the preview image) to 266 pixels reduced my .bin from 2mb to 1,5mb. Perhaps making it even smaller can decrease .bin for less than 1mb (I didn't try yet).
It looks like the problem is with .gif created during packing. It uses 10 frames, and I think it's not compressed.
Yes. The 266 sized png is meant for 0001.
The gif created is not part of the bin file.

Re: py amazfit tool

Posted: 04 Jan 2020, 15:11
by aliense
Why sometimes when i try unpack bin i got this err:
2020-01-04 16:07:49,979 - root - DEBUG - Opening watch face 'gtr.bin'
2020-01-04 16:07:49,979 - root - DEBUG - Reading parameters...
2020-01-04 16:07:49,979 - root - INFO - Reading header...
2020-01-04 16:07:49,988 - root - INFO - Header was read:
2020-01-04 16:07:49,988 - root - INFO - Signature: b'O3\x04\x00\x00\x00\x10', Unknown: 3725067530, ParametersSize: 308940802, isValid: False
2020-01-04 16:07:49,988 - root - DEBUG - Parsing parameters...
2020-01-04 16:07:49,988 - root - CRITICAL - 'Reader' object has no attribute '_parameters'
Traceback (most recent call last):
File "C:\Users\alien\Desktop\Zegarek\py_amazfit_tools-master\program*py", line 161, in parseResources
return ParametersConverter.parse(WatchFace, reader.getParameters())
File "C:\Users\alien\Desktop\Zegarek\py_amazfit_tools-master\watchFaceParser\reader*py", line 12, in getParameters
return self._parameters
AttributeError: 'Reader' object has no attribute '_parameters'

Re: py amazfit tool

Posted: 04 Jan 2020, 15:29
by afwafwafw
aliense wrote: 04 Jan 2020, 15:11
Why sometimes when i try unpack bin i got this err:
2020-01-04 16:07:49,979 - root - DEBUG - Opening watch face 'gtr.bin'
2020-01-04 16:07:49,979 - root - DEBUG - Reading parameters...
2020-01-04 16:07:49,979 - root - INFO - Reading header...
2020-01-04 16:07:49,988 - root - INFO - Header was read:
2020-01-04 16:07:49,988 - root - INFO - Signature: b'O3\x04\x00\x00\x00\x10', Unknown: 3725067530, ParametersSize: 308940802, isValid: False
2020-01-04 16:07:49,988 - root - DEBUG - Parsing parameters...
2020-01-04 16:07:49,988 - root - CRITICAL - 'Reader' object has no attribute '_parameters'
Traceback (most recent call last):
File "C:\Users\alien\Desktop\Zegarek\py_amazfit_tools-master\program*py", line 161, in parseResources
return ParametersConverter.parse(WatchFace, reader.getParameters())
File "C:\Users\alien\Desktop\Zegarek\py_amazfit_tools-master\watchFaceParser\reader*py", line 12, in getParameters
return self._parameters
AttributeError: 'Reader' object has no attribute '_parameters'
There's a issue with negative values for spacing or positions.

I've fixed some but let me know if you still have this issue with latest codes.

Re: py amazfit tool

Posted: 06 Jan 2020, 00:02
by vadim.t
afwafwafw wrote: 04 Jan 2020, 15:29
aliense wrote: 04 Jan 2020, 15:11
Why sometimes when i try unpack bin i got this err:
2020-01-04 16:07:49,979 - root - DEBUG - Opening watch face 'gtr.bin'
2020-01-04 16:07:49,979 - root - DEBUG - Reading parameters...
2020-01-04 16:07:49,979 - root - INFO - Reading header...
2020-01-04 16:07:49,988 - root - INFO - Header was read:
2020-01-04 16:07:49,988 - root - INFO - Signature: b'O3\x04\x00\x00\x00\x10', Unknown: 3725067530, ParametersSize: 308940802, isValid: False
2020-01-04 16:07:49,988 - root - DEBUG - Parsing parameters...
2020-01-04 16:07:49,988 - root - CRITICAL - 'Reader' object has no attribute '_parameters'
Traceback (most recent call last):
File "program*py", line 161, in parseResources
return ParametersConverter.parse(WatchFace, reader.getParameters())
File "\watchFaceParser\reader*py", line 12, in getParameters
return self._parameters
AttributeError: 'Reader' object has no attribute '_parameters'
There's a issue with negative values for spacing or positions.

I've fixed some but let me know if you still have this issue with latest codes.
Hi! Thank you for this amazing tool! I would like to make few changes to the standard watch face "Orange light" provided for GTR 47, but I get the same error while unpacking a bin file (I use the latest version of your app). Can you please advise? The file is on google drive /open?id=1NE8sYuYnihxpFVJVB8-51Lv9Ud_EIDAO

Here is a fragment of my log:
2020-01-06 00:37:18,502 - root - INFO - Header was read:
2020-01-06 00:37:18,502 - root - INFO - Signature: b'O\xc8\x05\x00\x00\x00\x10', Unknown: 2735211786, ParametersSize: 305074177, isValid: False
2020-01-06 00:37:18,502 - root - DEBUG - Parsing parameters...
2020-01-06 00:37:18,503 - root - CRITICAL - 'Reader' object has no attribute '_parameters'
Traceback (most recent call last):
File "program*py", line 161, in parseResources

Re: py amazfit tool

Posted: 06 Jan 2020, 02:51
by afwafwafw
vadim.t wrote: 06 Jan 2020, 00:02
afwafwafw wrote: 04 Jan 2020, 15:29
aliense wrote: 04 Jan 2020, 15:11
Why sometimes when i try unpack bin i got this err:
There's a issue with negative values for spacing or positions.

I've fixed some but let me know if you still have this issue with latest codes.
Hi! Thank you for this amazing tool! I would like to make few changes to the standard watch face "Orange light" provided for GTR 47, but I get the same error while unpacking a bin file (I use the latest version of your app). Can you please advise? The file is on google drive /open?id=1NE8sYuYnihxpFVJVB8-51Lv9Ud_EIDAO

Here is a fragment of my log:
2020-01-06 00:37:18,502 - root - INFO - Header was read:
2020-01-06 00:37:18,502 - root - INFO - Signature: b'O\xc8\x05\x00\x00\x00\x10', Unknown: 2735211786, ParametersSize: 305074177, isValid: False
2020-01-06 00:37:18,502 - root - DEBUG - Parsing parameters...
2020-01-06 00:37:18,503 - root - CRITICAL - 'Reader' object has no attribute '_parameters'
Traceback (most recent call last):
File "program*py", line 161, in parseResources
It seems like compressed bin.

Normal bin should have 'HMDIAL' for signature field as far as I know.

Maybe SashaCX75's tool can decompress these kind of .bin. ( viewtopic.php?f=29&t=1076 )

Is there any open explanation for compression used in these format? I want to know.

Re: py amazfit tool

Posted: 06 Jan 2020, 11:51
by Horatius80
Horatius80 wrote: 06 Jan 2020, 11:49
Hi,

i downloaded original Amazfit Rainbow Watchface, but after decompression and decompilation I found that there are some new functions (new form of progress circle for calories, hearth rate, steps and battery) Is here somebody who can analyze what is the correct syntax for these kind of progress circles ? Because the accessible tools are not decompiling these commands correctly ... thank you in advance ...

Re: py amazfit tool

Posted: 07 Jan 2020, 09:17
by afwafwafw
Horatius80 wrote: 06 Jan 2020, 11:51
Horatius80 wrote: 06 Jan 2020, 11:49
Hi,

i downloaded original Amazfit Rainbow Watchface, but after decompression and decompilation I found that there are some new functions (new form of progress circle for calories, hearth rate, steps and battery) Is here somebody who can analyze what is the correct syntax for these kind of progress circles ? Because the accessible tools are not decompiling these commands correctly ... thank you in advance ...
This one also looks like compressed one.

Not normal(uncompressed) header.

Re: py amazfit tool

Posted: 07 Jan 2020, 14:25
by kampanita
I'm having trouble with this one.
Seems to be ok but does not get installed. I see no error but does not run at watch ( gtr-47 )

If i quit weather and weekday parts, it runs ok...


https://amazfitwatchfaces.com/gtr/view/2714

Re: py amazfit tool

Posted: 07 Jan 2020, 15:56
by asoo
kampanita wrote: 07 Jan 2020, 14:25
I'm having trouble with this one.
Seems to be ok but does not get installed. I see no error but does not run at watch ( gtr-47 )

If i quit weather and weekday parts, it runs ok...


https://amazfitwatchfaces.com/gtr/view/2714
After adding "weather" and "weekday"
Your .BIN file (uncompress) size over 2M or not?
If the .BIN (uncompress) size is over 2M. It may not be able to be installed.