converting a flat to bmp?

Archive of the old editing forum
Forum rules
Before asking on how to use a ZDoom feature, read the ZDoom wiki first. This forum is archived - please use this set of forums to ask new questions.
Locked
Salvakiya
Posts: 5
Joined: Wed Apr 22, 2009 10:09 am

converting a flat to bmp?

Post by Salvakiya »

hey i was wondering if anyone knew how i can convert alot of flat files to windows .bmp file format.

i know this code has something to do with it but i dont know how to use it.

Notes:
------

Byte = 0 - 255
Word = 0 - 65535
DWord = 0 - 4294967295

dummy_value = Byte, those unused bytes in the file (excerpt from UDS: "..left overs from NeXT machines?..")
picture_* = Word, the maximum width for an image in doom picture format is 256 pixels
pixel_count = Byte, the number of pixels in a post
Pixel = Byte, the pixel colour
column_array = array of DWord, this holds all the post start offsets for each column

doom image = could be a file or memory stream

Algorithm:
----------

create a image with a pixel format of 8bit and the doom palette, set the background colour to a transparent colour (cyan).

read width from doom image (word)
read height from doom image (word)
read left from doom image (word)
read top from doom image (word)

create column_array with width number of elements

for loop, i = 0, break on i = width - 1
column_array = read from doom image, 4 bytes
end block

for loop, i = 0, break on i = width - 1
seek doom image to column_array from beginning of doom image

rowstart = 0

while loop, rowstart != 255
read rowstart from doom image, 1 byte

if rowstart = 255, break from this loop

read pixel_count from doom image, 1 byte

read dummy_value from doom image, 1 byte

for loop, j = 0, break on j = pixel_count - 1
read Pixel from doom image, 1 byte

write Pixel to image, j + rowstart = row, i = column
end block

read dummy_value from doom image, 1 byte
end block
end block


if you can help please do
User avatar
InsanityBringer
Posts: 3392
Joined: Thu Jul 05, 2007 4:53 pm
Location: opening the forbidden box

Re: converting a flat to bmp?

Post by InsanityBringer »

Flats aren't stored in doom's picture format but rather as 4096 byte large 8-bit RAW files. It probably wouldn't be too hard to make a converter but I have no time to do so. Some decent graphic editing software can probably do it though.
User avatar
Kappes Buur
 
 
Posts: 4201
Joined: Thu Jul 17, 2003 12:19 am
Graphics Processor: nVidia (Legacy GZDoom)
Location: British Columbia, Canada
Contact:

Re: converting a flat to bmp?

Post by Kappes Buur »

Salvakiya wrote:hey i was wondering if anyone knew how i can convert alot of flat files to windows .bmp file format.
Hey, let me guess, you want to export the flats in a wad and save them as bmp files?
The short answers is, use XWE or SlumpEd
Gez
 
 
Posts: 17946
Joined: Fri Jul 06, 2007 3:22 pm

Re: converting a flat to bmp?

Post by Gez »

Use Spidey's unwad utility. It'll convert them to PNG. If you really need BMPs instead of PNGs for whatever reason, you can then batch-convert them with IrfanView.
http://baghead.drdteam.org/index.html
User avatar
Enjay
 
 
Posts: 27345
Joined: Tue Jul 15, 2003 4:58 pm
Location: Scotland
Contact:

Re: converting a flat to bmp?

Post by Enjay »

There are a number of tools already in existence that will do the job. I just assumed from the nature of the post that he wanted to code something himself.
Locked

Return to “Editing (Archive)”