[Request] Looking for someone with info on an image format.

Discussion in '3DS - Homebrew Development and Emulators' started by PF2M, Sep 27, 2016.

  1. PF2M
    OP

    PF2M Ex-Miiverse Hacker

    Member
    544
    768
    Sep 8, 2015
    United States
    Ohio
    So the Wii U game Pixel Paint, an early-MS-Paint-style game, recently got a 3DS port. As the creator of Miiverse Custom Image Tool, I have a lot of Miiverse friends who want to post custom images, but can't downgrade because they're on the latest firmware (and sometimes don't want to downgrade because they're complete noobs to hacking). I decided to download this app, and after making some images with the app and looking into the game's ExtData with a hex editor, this is the information I've gathered on the save file's formatting.

    Screen Shot 2016-09-26 at 7.02.33 PM.png
    • The game stores the files as the name you typed in in-game, with no file extension, in the root of the ExtData.
    • All files start with "PXI." in ASCII characters.
    • The next 4 characters are the image's sizing, in hexadecimal format and reversed byte order. In this example, I used 320x240, which translates to 140 to F0, as seen above.
    • Everything after this is all color codes, as in "#FF0000". The file I used in this screenshot starts with "000000" "FFFFFF" "000000", which translates to black, white, and black pixels respectively.
    Screen Shot 2016-09-27 at 9.30.38 AM.png
    • The file always seems to end with eight zeroes. (The other zeroes in this image are from my drawing, as I ended it with two black pixels)
    This is everything I can determine from this file. You can also download this file here, so you can see for yourself.

    The reason I'm making this post is because I'd like to see if we can find a way to convert another image format (like PNG, JPG, or BMP) into this format, so we could import hacked images into here and my friends who want latest-firmware Miiverse hacks could be satisfied. It sounds like a pretty stupid reason, I know, but this probably won't be too hard to do, and I don't know enough about programming to get something like this running, so I figured I'd ask you guys for help. I did my detective work, now I'd like to see what you guys come up with. :P
     
  2. Wolfvak

    Wolfvak *yawn*

    Member
    808
    1,062
    Oct 25, 2015
    Uruguay
    According to the size check I performed the data appears to be RAW RGB/BGR888 - if you do 320 * 240 * 3 (the bpp of RGB888) you get the exact size of your file, except for the header/footer which appears to be 12 bytes long.

    I'd suggest using ffmpeg for this.
    Extract the header until you get exactly 230400 bytes, run
    Code:
    ffmpeg -vcodec rawvideo -f rawvideo -pix_fmt rgb24 -s 320x240 -i in.raw -f image2 -vcodec png out.png
    Warning: Spoilers inside!
    with in.raw being your file and out.png the output file. If you want to do automatic conversion within the 3DS itself, check out smea's screenshot tool, it does something very similar (converts from RAW to PNG).

    I hope I was right, and good luck!
     
    Last edited by Wolfvak, Sep 27, 2016
    ihaveamac and PF2M like this.
  3. ihaveamac

    ihaveamac GBAtemp Guru

    Member
    5,513
    6,109
    Apr 20, 2015
    United States
    Tigard, OR
    looks like it's RGB something. looks better if I don't rotate it.

    I'm still figuring this out... :P
     
    Wolfvak and PF2M like this.
  4. ihaveamac

    ihaveamac GBAtemp Guru

    Member
    5,513
    6,109
    Apr 20, 2015
    United States
    Tigard, OR
    this was almost too easy, you know.
    [​IMG]

    I converted the image to rgb with imagemagick:
    Code:
    $ convert bottomlogo.png rgb:DN.raw
    
    this is a 320x240 image. in hex that is 0x140 and 0xF0. they are in the file header in little endian. add four null bytes (00) to the end of image data (don't know if this is necessary)
    Code:
    0x0 - "PXI" magic with a null byte
    0x4 - width
    0x6 - height
    0x8 - image data
    
    Code:
    00000000: 5058 4900 4001 f000 0000 0000 0000 0000  PXI.@...........
    
     
    I pwned U! and Wolfvak like this.
  5. PF2M
    OP

    PF2M Ex-Miiverse Hacker

    Member
    544
    768
    Sep 8, 2015
    United States
    Ohio
    Got the file converted into Photoshop by removing the first 8 bytes and last 4 bytes, then renaming it into a .raw file. Screen Shot 2016-09-27 at 10.20.38 AM.png
    This is what I did to get it. I'm sure we can do it the other way around too. I might have gotten this before if I had thought of RAW files, but I was thinking more about BMPs, so thank you for the help!
     
  6. ihaveamac

    ihaveamac GBAtemp Guru

    Member
    5,513
    6,109
    Apr 20, 2015
    United States
    Tigard, OR
    I don't think it's really a "raw" file, I just added raw to the end of it. "raw" images are generally from cameras as far as I know.

    I could also not know what I'm talking about...
     
    Last edited by ihaveamac, Sep 27, 2016