XeNTaX Forum Index
Forum MultiEx Commander Tools Tools Home
It is currently Sun Aug 20, 2017 8:02 pm

All times are UTC + 1 hour


Forum rules


Please click here to view the forum rules



Post new topic Reply to topic  [ 4 posts ] 
Author Message
 Post subject: Battle Mages DISPLACE.BIN
PostPosted: Tue Mar 28, 2017 2:10 pm 
Offline
ultra-n00b
User avatar

Joined: Sun Jul 24, 2016 9:14 pm
Posts: 3
Has thanked: 1 time
Have thanks: 0 time














You can make the ads go away by registering

This is the only thing that stops me from beign able to put new maps in the game.
The most i could decode of it:
Image
I know, bad.
Of course, recoding back is appreciated :).


Attachments:


You do not have the required permissions to view the files attached to this post. Register to gain access.



Top
 Profile  
 
 Post subject: Re: Battle Mages DISPLACE.BIN
PostPosted: Wed Apr 05, 2017 1:22 am 
Offline
veteran

Joined: Wed Jun 02, 2010 4:53 am
Posts: 127
Has thanked: 12 times
Have thanks: 125 times
Hi, the file is not a usual image file. It's an array of 128 x 128 floating point numbers (IEEE 754).

I see 3 possibilites here for converting the .bin files into a format that you can work with.

1) Convert it to an 8-bit grayscale bitmap. Pros: you can edit it with many programs, cons: you would lose precision.
The minimum value in displace.bin is 193.0 the maximum is 759.0, for a grayscale bitmap, the values need to streteched so they fit into a [0,255] interval. This leads to a loss in precision.

2) Convert it to a 16-bit grayscale bitmap. Pros: No precision loss, cons: you need a program that can handle 16-bit images.

3) Convert it to an .OBJ file. Pros: No precision loss, cons: you need a 3D program to edit the file.

Here's the file converted to a 8-bit grayscale bmp:


Attachments:


You do not have the required permissions to view the files attached to this post. Register to gain access.



Top
 Profile  
 
 Post subject: Re: Battle Mages DISPLACE.BIN
PostPosted: Wed Apr 05, 2017 9:48 pm 
Offline
ultra-n00b
User avatar

Joined: Sun Jul 24, 2016 9:14 pm
Posts: 3
Has thanked: 1 time
Have thanks: 0 time
Thanks!
Sorry for noobish question, but how you did that?


Top
 Profile  
 
 Post subject: Re: Battle Mages DISPLACE.BIN
PostPosted: Thu Apr 06, 2017 12:25 am 
Offline
veteran

Joined: Wed Jun 02, 2010 4:53 am
Posts: 127
Has thanked: 12 times
Have thanks: 125 times
I used MATLAB to convert the binary file into an image.
Don't know if that's the best method, but here's the code I used:
Code:
% open file
file = fopen('displace.bin');

% read content of file into a 128x128 float matrix
A = fread(file, [128,128], 'float');

% transpose matrix
A = A';

% close file
fclose(file);

% get minimum and maximum value
amin = min(min(A));
amax = max(max(A));

% convert matrix to grayscale image
I = mat2gray(A, [amin amax]);

% convert image to 16-bit, without the conversion the output image would only be 8-bit
I =  uint16(I * 65535);

% show image in Matlab
imshow(I);

% write image to file
imwrite(I, 'displace.png');


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group