• wanted: someone to reverse engineer a file format

    From Eli the Bearded@21:1/5 to All on Sun Aug 8 04:58:46 2021
    While this is a serious request, in the sense I seriously want this,
    it's more of old man shouts at cloud than an expectation that I'll
    get a response.

    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.

    The author of Pixel Studio has created an importer for Unity, but Unity
    is a fancy GUI game development tool, not a command line thing. And
    the importer is closed source, so I can't reuse the code. I put a
    request in for a command line tool but it was turned down.

    Anyway, if you know some kid who wants to reverse engineer a image
    file format, I'll by willing to throw a few bucks in the tip jar.

    Elijah
    ------
    Pixel Studio is a tool well suited for hand drawing GIFs

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Theo@21:1/5 to Eli the Bearded on Sun Aug 8 16:10:33 2021
    Eli the Bearded <*@eli.users.panix.com> wrote:
    While this is a serious request, in the sense I seriously want this,
    it's more of old man shouts at cloud than an expectation that I'll
    get a response.

    Why not put some sample images on the web somewhere so people can take a
    look? Perhaps with a corresponding screenshot or whatever so they know what
    to expect? A collection of simple images would help understand how the
    forward works.

    It might be the format looks similar to something else - eg if they reused
    some library to generate them.

    Theo

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Eli the Bearded@21:1/5 to theom+news@chiark.greenend.org.uk on Sun Aug 8 21:07:53 2021
    In comp.misc, Theo <theom+news@chiark.greenend.org.uk> wrote:
    Eli the Bearded <*@eli.users.panix.com> wrote:
    While this is a serious request, in the sense I seriously want this,
    it's more of old man shouts at cloud than an expectation that I'll
    get a response.

    Why not put some sample images on the web somewhere so people can take a look? Perhaps with a corresponding screenshot or whatever so they know what to expect? A collection of simple images would help understand how the forward works.

    Sure, but it looks particular to that tool to me. Five examples, three
    files created by me, two from others. The first one, a 4x4 image was one
    I made to try to first understand the file format. It disabused me of
    the idea that the _snapshot array would be an easy shortcut to getting
    the image from the JSON.

    https://qaz.wtf/tmp/pixelstudio/

    It looks like it would be easy if it were all "Tool":0, but as the other examples show, it's not. Tool 0 seems to correspond to drawing single
    pixels. These examples have Tool 0, Tool 3 (circle maker?), and some
    others I don't know:

    $ grep -ho "Tool[^,]*" *psp |sort |uniq -c | sort -nr
    68 Tool\":3
    31 Tool\":0
    22 Tool\":10
    9 Tool\":1
    6 Tool\":20
    5 Tool\":14
    2 Tool\":6
    2 Tool\":2
    2 Tool\":16

    (The history is json embeded in json, so backslashes galore.)

    https://qaz.wtf/tmp/pixelstudio/

    Elijah
    ------
    Dr Monocle is a long running character of mine, based on a Lego minifig

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Eli the Bearded@21:1/5 to *@eli.users.panix.com on Sat Aug 28 21:30:45 2021
    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

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)