Author Topic: How to extract icon as a png file from sbs  (Read 276 times)

Hi there,

sbs file is in xml fomat. I found there is a icon section in it. The icon is in png format and the data is a long string. How to convert the string data into a png file? I can use python or any other programming languages.

Many thanks


Ok, I got it.
Just put the python code here:

import base64
import zlib

# datalength 1339
# strdata in sbs
str = "AAAFO3ic5ZTPj9JAFMcHV42ixMTjnib1Kp1SJUoDrEhXIQFCWHRL4mFLGWAC/WE7pF0OZuNtz3vS7B/gwRgT/wH+AGOye/Dm0aPRRONBPThTyi5h2WTj1cl05s33ffrmzaSvu/Xaw0R8NQ4ASJRLaoPNO/y5dI6NlSc/99l02Sm1PACuXOdP7PDTsz8ArLwjTY1q1Ypi2Kaod+w2FgPTAbxl1wJHNwaYwjbuESsnCJB0csJmuipVnSLuk9LYxRvjWtMYD4xMR1jLZwOFvWxiqsPAHFqeEuSEMKbCbC4jAYYIHeSEAndArVqHRdvFMC3eThqSJMOUKIXtJuQjCntSkpSww6gJ+azb6SoN9UG0E1vlhD6ljoKQ7/uif0u03R5KZTIZJMlIlpOMSHrbFtWDpOXdiAKo2DNc4lBiW5Cv9bY9ovykUf6mcxTV8qL7YTeFAt1BLFHEwjBGKbpYp7bbtO1hfmPU9qhuGRiy4KRnYTeLFpksWtj8TNnggHSXp8M9s3y4rayz4TF2PR5akmUpi07IU7BOAjzUVGJiK1RT8t2IXfTM8a1T+TnPv52Rku4pZ+Se2Rm5rZRNvYc3SYf2p1ksinNUBVu9k1ikTjmtgT17OAoTvSNH2Lw4xVrLsNYJ7Fh4ZBGan4EL8pIrQtFnzayjYsofVyK2WAX6rNReqK9+ARATy2qhGex/OSgkALw6uVf6Zm/vPb02jr/88eH97nc6+bq6kwYD8BG8jmkrby9uJSb/sXDhs3/+92HtYI//3srrNfXN/a3nfwEPoLlK"

de_bytes = base64.b64decode(str)

k = len(de_bytes)
de_bytes = de_bytes[4:k]    # qCompress data to zlib data
print(len(de_bytes))   

img_data = zlib.decompress(de_bytes)

f = open("image.png", "wb")
f.write(img_data)
f.close()
Last Edit: May 12, 2021, 09:41:57 am