SPR - Sprite File

December 19th, 2005

Sprite File Format, this file contains every cell of an image for every object.

* Field Size Type Description
0 Header 2 bytes char SP
2 Major version 1 bytes Byte See Below
3 Minor Version 1 byte Byte See Below
4 Images Count 1 byte Integer Nº of images contained
6 Unknown 2 byte Integer
{ Image (Header offset +14)
10 Size X 2 bytes Integer Size of field
12 Size Y 2 bytes Integer Size of field
14 Frame Len 2 bytes Integer Length of field data
16 Frame Data Frame Len bytes Byte Image Data compresed in RLE version
}
- Palette 1024 bytes RGB 256 color palette

Frame Data
Image pixels indexed with 256 color palette, first palette color is background. Only background pixels are compresed in RLE, compresion can go beyond rows.

Version :

  • 1 - ??
  • 2 - ??
  • 3 - ??
  • 4 - ??
  • 5 - ??

Info :
- - Designs a block type
{ } Designs a loop block
Credits :
deufeufeu / ender (previous research)
BadPacket / ViteFalcon (update info)


4 Responses to “SPR - Sprite File”

  1. BadPacket on May 24, 2006 2:05 am

    Ximosoft, the image information is incorrect and should look more like this:

    { Image (Header offset +14)
    10 - Size X - 2 bytes Integer - Size of field (LB HB format)
    12 - Size Y - 2 bytes Integer - Size of field (LB HB format)
    14 - Len Data - 2 bytes Integer – Length of field data (LB HB format)
    16-(16+Len Data) - Frame data*
    }
    *Frame data are actual image pixels with values referencing the indexed colors in the palette except when they have a value of “00” (the background color index). When background pixels are encountered the next pixel will either be another background pixel if “00” or the count of the number of time to repeat the display of the background pixel if not “00”. This is done to achieve some level of compression. Example:

    A0 00 05 B0 = A0 00 00 00 00 00 B0 (00 x 5)
    A0 00 00 B0 = A0 00 00 B0

    Compression runs left to right and can span more than 1 row, so do not be surprised to see background pixels drawn at the end of one row extending beyond the end of the row and wrapping to the next. Only background pixels can be compressed.

    Also, the first color in the palette is always the transparency color in case you did not know that. I was going to post this on the eAthena forums, but I figure it makes more sense here since you are the file format repository.

  2. ViteFalcon on February 5, 2009 11:19 pm

    The header is not AC it’s SP… plus the offset seems to have changed. It’s like

    0 Header 2 bytes char AC
    2 Major version 1 bytes Byte
    3 Minor Version 1 byte Byte
    4 Images Count 2 bytes Integer Nº of images contained
    6 Unknown int 2 bytes Integer
    {
    Size X 2 bytes Integer Size of field
    Size Y 2 bytes Integer Size of field
    Frame Len 2 bytes Integer Length of field data
    Frame Data Frame Len bytes Byte Image Data compresed in RLE version
    }
    - Palette 1024 bytes RGB 256 color palette

    Atleast that’s what I’ve found when I was trying to make a parser for SPR file.

  3. DrDaxxy on April 24, 2009 9:53 pm

    What’s the fourth byte per color in the palette for? Is it transparency? I don’t need to implement it in my program because it’s just for character sprites, but I’d still like to know.

  4. Tsurai on May 25, 2009 4:00 pm

    The fourth Byte is the Alpha value of the RGBA color table. It tells how much transparency will be used

Trackback URI | Comments RSS

Leave a Reply

Name (required)

Email (required)

Website

Speak your mind

    About this blog
    Here i post all Ragnarök Online related Tools