Path: csiph.com!weretis.net!feeder6.news.weretis.net!panix!.POSTED.panix5.panix.com!qz!not-for-mail From: Eli the Bearded <*@eli.users.panix.com> Newsgroups: comp.misc Subject: Re: wanted: someone to reverse engineer a file format [kinda solved] Date: Sat, 28 Aug 2021 21:30:45 -0000 (UTC) Organization: Some absurd concept Message-ID: References: Injection-Date: Sat, 28 Aug 2021 21:30:45 -0000 (UTC) Injection-Info: reader1.panix.com; posting-host="panix5.panix.com:166.84.1.5"; logging-data="7325"; mail-complaints-to="abuse@panix.com" User-Agent: Vectrex rn 2.1 (beta) X-Liz: It's actually happened, the entire Internet is a massive game of Redcode X-Motto: "Erosion of rights never seems to reverse itself." -- kenny@panix X-US-Congress: Moronic Fucks. X-Attribution: EtB XFrom: is a real address Encrypted: double rot-13 Xref: csiph.com comp.misc:21417 In comp.misc, Eli the Bearded <*@eli.users.panix.com> wrote: > Pixel Studio, available for at least Android and Iphones, and possibly > other platforms, has a native save format, called PSP (Pixel Studio > Project, most likely). I'd really like a way to turn PSP files into > something else, something standard, PNG, GIF, etc, from command line. > The format is JSON based, but the images seem to be encoded as the > incremental steps to produce the output, rather than a final image. I found a solution, of sorts. I still can't convert a Pixel Studio .psp file into a PNG, GIF, etc, but I discovered that Pixel Studio has a secret automatic conversion. In order to get the preview in the file open command, the app uses a JSON encoded "Gallery.cache" file. To grab the image "evil-flower.psp" from the cache I can do this: < "$HOME/storage/shared/DCIM/Pixel Studio/Gallery.cache" \ jq -c '.[] | {(.Path|sub(".*/";"")): .Texture }' | grep '"evil-flower.psp": | jp -r '.[]' | base64 -d > evil-flower.png I have a helper script to do that here: https://qaz.wtf/netpbm/psp-preview Since the cache above is the default location (it's where I have it), the equivilent command line to the above would be: psp-preview -p evil-flower.psp > evil-flower.png Some things I learned along the way: * the base64d built into jq is kinda useless. jq is not binary safe, and expects everything to be UTF-8. PNG files are not readable as UTF-8 files. * this killed my original plan to extract all psp files from the cache within a jq script * the obvious ways to grep for a matching string within jq itself return true or false instead of the matching lines, so I gave up trying to get that to work and broke out grep Elijah ------ expecting not many people will find this useful but still