czy ktoś mógłby mi pomóc w napisaniu modułu za pomocą którego można byłoby dokonywać konwersji plików graficznych z rozszerzeniem *.frm z Fallouta do bmp i odwrotnie?
Poniżej podaję specyfikację plików *.frm:

FRM File Format
Base Description:
FRM files are unpaletted 256-color image files containing either one or several images in one file. The palette used for FRM files come in the form of external palette files.
All values within the FRM file are stored in Big-Endian (Motorola) format as opposed to Little-Endian (Intel) format. For those who don't know what the difference is, Big-Endian stores the most-significant (largest digit place) digits closest to the number's starting address, whereas Little-Endian stores values with the least-significant digits closest to the starting address. Ex:
With hex number 3F
Big-Endian: 3F:2B
Little-Endian: 2B:3F

FRM Header:
Before the image data comes the header holding necessary information about the file:
Offset Length Description
0x00 4 Bytes ID
0x04 2 Bytes Number of Frame pointers
0x06 4 Bytes Number of Frames (from now known as "F")
0x0A 2 Bytes for each frame Unknown
0x0A + (2*F) 4 bytes for each frame Array of 4-byte (32-bit) pointers each frames

Total Size: 0x0A + (2F) + (4F)

FRM Data:
After the header comes the frame data in the following format:
Offset Length Description
0x00 2 Bytes Size X (Width)
0x02 2 Bytes Size Y (Height)
0x04 4 Bytes Multiplied picture size (essentially XY)
0x08 2 Bytes X offset from previous frame
0x0A 2 Bytes Y offset from previous frame
0x0C X
Y Bytes Frame data

Total Size: 0x0C + (X*Y)
Frame data comes in the form of byte color indexes to a 256-color palette. Hence a byte with the number 137 would correspond to color 137 in the palette.
Palette Information:
PAL palette files are simply an array of 256 BGR (not RGB) structures. For those who don't know, the BGR color triplet represents the Blue, Green, and Red component of a color. Each component uses a single byte and ranges from 0 to 255 in brightness. This allows for over a 24-bit color scale, over 16 million colors, enough to cover a 4000x4000 monitor with a different color each pixel and not use them all.
There appears to be more than one palette per PAL file probably representing different lighting levels. Which is which is unknown. The first palette in color.pal is a standard palette but needs to be gamma corrected by a factor of four (multiply brightness by four).

Inny opis tego formatu graficznego:

The FRM File Format is used to store the images used in both Fallout and Fallout 2. It stores all the images and animations, with the exception of those used on the splash screen and the movies. Each FRM file contains one or more frames of image data.

The FRM file uses an index colour model to store the image data. This means that each pixel is represented by an offset into a palette of colours. A colour index of 0, means that the pixel is transparent.

The palette file to use is generally color.pal, but certain FRM files have their own palette files. These specific palette files have the same name as the FRM file, but with the extension .pal. For example: the palette file of helpscrn.frm is helpscrn.pal.

A FRM file may contain image data for one or all of the 6 orientations used in Fallout. If a FRM file has the extension .fr[0-5] instead of the usual .frm, then that file contains image data for the orientation given by the last digit in the extension. Otherwise, the FRM file contains image data for either orientation 0, or all 6 orientations.

The FRM file contains info to correctly align (or centre) the image data. For example: Image data should be aligned so that each critter's feet should be on the same level.

Each frame contained within the FRM file has an offset from the previous frame which must be applied before rendering. This offset ensures that in an animation sequence each frame is correctly aligned.

The centre of the image data is the centre of the bottom edge of the frame. To find the position of the top left corner of the frame (needed for rendering):

left = centre_x - (frame_width / 2)
top = centre_y - frame_height

Offset Size Data Type Description
0x0000 4 unsigned = 4 Version number of the FRM file format.
0x0004 2 unsigned Unknown.
Fallout 2 load this field into memory, but don't use them.

0x0006 2 unsigned Unknown.
Fallout 2 load this field into memory, but don't use them.

0x0008 2 unsigned Number of frames per direction in this FRM file.
This gives the number of frames for a particular orientation. For a static image, this number will be 1. For an animation of say 10 frames, this value will be 10, even though it is likely that there will be a total of 60 frames stored (10 for each of the 6 orientations).

0x000A 2 signed Required shift in the X direction, of frames with orientation 0.
This is the shift required so that the frames with orientation 0 are centred correctly. This shift is needed to correctly align objects when rendering, as the logical centre of the frame will not necessarily be the absolute centre of the frame (width/2, height/2). For example, the centre of a critter will be the position of its feet, while the centre of a tree will be its base. A positive value means shift the frame to the right of the screen when rendering.

0x000C 2 signed Required shift in the X direction, of frames with orientation 1.
0x000E 2 * (6 - 2) signed Required shift in the X direction, of frames with orientations [2-5].
0x0016 2 * 6 signed Required shift in the Y direction, of frames with orientations [0-5].
A positive value means shift the frame to the bottom of the screen when rendering.

0x0022 4 unsigned Offset of first frame for direction 0 from begining of frame area.
Frame area start from offset 0x3E

0x0026 4 unsigned Offset of first frame for direction 1 from begining of frame area.
0x002A 4 unsigned Offset of first frame for direction 2 from begining of frame area.
0x002E 4 unsigned Offset of first frame for direction 3 from begining of frame area.
0x0032 4 unsigned Offset of first frame for direction 4 from begining of frame area.
0x0036 4 unsigned Offset of first frame for direction 5 from begining of frame area.
0x003A 4 unsigned Size of frame area.
It could be used to allocating memory for frames.

0x003E 2 unsigned FRAME-0-WIDTH : Width of frame 0.
The width (in pixels) of the 0th frame in the orientation 0.

0x0040 2 unsigned FRAME-0-HEIGHT : Height of frame 0.
The height (in pixels) of the 0th frame in the orientation 0.

0x0042 4 unsigned = FRAME-0-WIDTH * FRAME-0-HEIGHT FRAME-0-SIZE : Number of pixels for frame 0.
The total area, and hence number of bytes taken up by the 0th frame.

0x0046 2 signed Offset in X direction of frame 0.
The offset of this frame from the previous frame.

0x0048 2 signed Offset in Y direction of frame 0.
0x004A FRAME-0-SIZE unsigned Pixel data for frame 0.
Contains the pixel data for the 0th frame. Each pixel in the glyph is represented by one byte, which is the index into the colour palette. Pixel data starts at the top left corner of the frame and increases left to right, then top to bottom.

0x004A + (FRAME-0-SIZE) ... Frame data for all the following frames.
Frames are stored for all the rest of the frames of orientation 0, then moves on to orientation 1 up to 5 (if these orientations are stored in the file).


Note: All integers are in big endian format.