Elvas Tower: ace2bmp - Elvas Tower

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

ace2bmp An ace to bitmap converter program. Rate Topic: -----

#1 User is offline   David Webb 

  • Apprentice
  • Group: Posts: Active Member
  • Posts: 36
  • Joined: 05-January 20
  • Gender:Male
  • Simulator:OpenRails, ZR
  • Country:

Posted 29 March 2023 - 09:17 AM

There has been some discussion in topic "Route Riter source code" about a command line 'ace to bitmap' file converter

I enclose, as a zip file, a converter program which works with the 0x10, 0x11, 0x12 and 0x0e ace file surface formats to generate an uncompressed bitmap file. It is written in C and has been compiled and tested on for a linux system.

However I appreciate most people viewing this topic are windows users. Windows does provide a basic linux package with windows 10, which could be used. But it would be better if a windows expert could get involved, to make it more windows friendly.

That is why I have started a new topic, so that any feedback does not clutter up the original.

Attached File  ace2bmp.zip (16.55K)
Number of downloads: 18

#2 User is offline   scottb613 

  • Executive Vice President
  • Group: Status: First Class
  • Posts: 3,186
  • Joined: 06-July 09
  • Gender:Male
  • Location:Downeast Maine (soon)
  • Simulator:ORTS
  • Country:

Posted 29 March 2023 - 02:17 PM

Hi David,

Thanks again.

I see there is no executable included, so it needs to be compiled on a PC. It's been many years since I've worked with "C" and I was a novice back then. I'm hoping someone on a Windows box has a Compiler environment loaded and sees this.
;)

Regards,
Scott

#3 User is offline   pwillard 

  • Foreman Of Engines
  • Group: Posts: Contributing Member
  • Posts: 881
  • Joined: 03-March 08
  • Gender:Male
  • Location:Cumming, Ga
  • Simulator:OpenRails
  • Country:

Posted 29 March 2023 - 04:35 PM

I can try... first hurdle... "FInd Zlib"

OK, added ZLIB... and then the errors generated quickly had me leaving my comfort zone.

For the curious, I attempted to use Embarcadero DEVC++ which uses MINGW (aka GCC) as a compiler.

#4 User is offline   David Webb 

  • Apprentice
  • Group: Posts: Active Member
  • Posts: 36
  • Joined: 05-January 20
  • Gender:Male
  • Simulator:OpenRails, ZR
  • Country:

Posted 31 March 2023 - 05:46 AM

View Postpwillard, on 29 March 2023 - 04:35 PM, said:

I can try... first hurdle... "FInd Zlib"

OK, added ZLIB... and then the errors generated quickly had me leaving my comfort zone.

For the curious, I attempted to use Embarcadero DEVC++ which uses MINGW (aka GCC) as a compiler.


In the past I've given up on using Visual Basic, the full environment was too much to learn. However I found some more recent articles which showed that I can compile C programs from the command line. The result is the file ace2bmp.exe which works under DOS. I attach it as a zip file - I hope that this is allowed. The command is:

ace2bmp file.ace file.bmp

The program presently complains if it receives less than two arguments. Also after reading compressed ace files it leaves behind temporary file 'unzlib.tmp'. Let me know of any other problems.

I'll leave it a couple of weeks, see what comments there are and then hopefully produce a final version. D.

Attached File(s)



#5 User is offline   scottb613 

  • Executive Vice President
  • Group: Status: First Class
  • Posts: 3,186
  • Joined: 06-July 09
  • Gender:Male
  • Location:Downeast Maine (soon)
  • Simulator:ORTS
  • Country:

Posted 01 April 2023 - 09:30 AM

View PostDavid Webb, on 31 March 2023 - 05:46 AM, said:

In the past I've given up on using Visual Basic, the full environment was too much to learn. However I found some more recent articles which showed that I can compile C programs from the command line. The result is the file ace2bmp.exe which works under DOS. I attach it as a zip file - I hope that this is allowed. The command is:

ace2bmp file.ace file.bmp

The program presently complains if it receives less than two arguments. Also after reading compressed ace files it leaves behind temporary file 'unzlib.tmp'. Let me know of any other problems.

I'll leave it a couple of weeks, see what comments there are and then hopefully produce a final version. D.


Hi David,

Oh - great - let me see if this works...
;)

Thank you.

Regards,
Scott

#6 User is offline   scottb613 

  • Executive Vice President
  • Group: Status: First Class
  • Posts: 3,186
  • Joined: 06-July 09
  • Gender:Male
  • Location:Downeast Maine (soon)
  • Simulator:ORTS
  • Country:

Posted 04 April 2023 - 12:38 PM

View PostDavid Webb, on 31 March 2023 - 05:46 AM, said:

In the past I've given up on using Visual Basic, the full environment was too much to learn. However I found some more recent articles which showed that I can compile C programs from the command line. The result is the file ace2bmp.exe which works under DOS. I attach it as a zip file - I hope that this is allowed. The command is:

ace2bmp file.ace file.bmp

The program presently complains if it receives less than two arguments. Also after reading compressed ace files it leaves behind temporary file 'unzlib.tmp'. Let me know of any other problems.

I'll leave it a couple of weeks, see what comments there are and then hopefully produce a final version. D.



Hi David,

Just one final BIG thank you for your efforts.

Works like a champ - no longer need to use Route Riter to - - - manually - - - make the conversions.

"ace2bmp.exe" now has a permanent home in my MSTS/ORTS toolbox.

Processing over 500 Terrtex files - as I write this - by merely launching a script.

	###########################

        ACE2BMP="/cygdrive/y/MSTS Tools/ace2bmp/ace2bmp.exe"

	cd ./SCOtmp
	for ACE in `ls | grep '^-' | grep '\.ace$'`
	do
		FILENAME=`echo ${ACE} | cut -d "." -f1`
		"${ACE2BMP}" ${ACE} ${FILENAME}.bmp
		echo "Processing  ACE-2-BMP ${ACE}"
	done

	##########################


Much better.
:)

For feedback - suggest if only one arg given - keeps the name the same and converts - need second arg only if desire name change.

Regards,
Scott

#7 User is offline   David Webb 

  • Apprentice
  • Group: Posts: Active Member
  • Posts: 36
  • Joined: 05-January 20
  • Gender:Male
  • Simulator:OpenRails, ZR
  • Country:

Posted 27 April 2023 - 09:42 AM

I enclosed a revised version of the 'ace2bmp' program as a zip file. It differs from the original in that it can be run, in a Microsoft 'Command Prompt' window, with or without the output file:

ace2bmp file_in.ace file_out.bmp
ace2bmp file_in.ace

In the second case, the output file name, provided by the program, is the same as the input file name but with ".ace" replaced by ".bmp".

If users want to convert the bitmap file to another image file format, then ImageMagick (https://imagemagick.org/) is an excellent free conversion utility. For windows the download page is (https://imagemagick....pt/download.php). In a "Command Prompt" window, the command:

magick AU_kang.bmp AU_kang.dds

generates a DDS file with a full set of mipmaps using (lossy) compression scheme DXT5 (also known as BC3). As disk space is cheap, I would recommend using no compression:

magick AU_kang.bmp -define dds:compression=none AU_kang.dds

and dealing with any compression issues later.

I'll eventually put a copy of the ace2bmp code on Github (https://github.com/djw-zr/).

Attached File(s)



#8 User is offline   scottb613 

  • Executive Vice President
  • Group: Status: First Class
  • Posts: 3,186
  • Joined: 06-July 09
  • Gender:Male
  • Location:Downeast Maine (soon)
  • Simulator:ORTS
  • Country:

Posted 27 April 2023 - 02:47 PM

View PostDavid Webb, on 27 April 2023 - 09:42 AM, said:

I enclosed a revised version of the 'ace2bmp' program as a zip file. It differs from the original in that it can be run, in a Microsoft 'Command Prompt' window, with or without the output file:

ace2bmp file_in.ace file_out.bmp
ace2bmp file_in.ace

In the second case, the output file name, provided by the program, is the same as the input file name but with ".ace" replaced by ".bmp".

If users want to convert the bitmap file to another image file format, then ImageMagick (https://imagemagick.org/) is an excellent free conversion utility. For windows the download page is (https://imagemagick....pt/download.php). In a "Command Prompt" window, the command:

magick AU_kang.bmp AU_kang.dds

generates a DDS file with a full set of mipmaps using (lossy) compression scheme DXT5 (also known as BC3). As disk space is cheap, I would recommend using no compression:

magick AU_kang.bmp -define dds:compression=none AU_kang.dds

and dealing with any compression issues later.

I'll eventually put a copy of the ace2bmp code on Github (https://github.com/djw-zr/).


Hi David,

I'm sorry - honestly - I just forgot to try this program over the weekend. I'll test it when I get back to my home machine this weekend and post results.

Thank you again for all your hard work.
:)

Regards,
Scott

#9 User is offline   David Webb 

  • Apprentice
  • Group: Posts: Active Member
  • Posts: 36
  • Joined: 05-January 20
  • Gender:Male
  • Simulator:OpenRails, ZR
  • Country:

Posted 27 April 2023 - 11:40 PM

View Postscottb613, on 27 April 2023 - 02:47 PM, said:

I'm sorry - honestly - I just forgot to try this program over the weekend. I'll test it when I get back to my home machine this weekend and post results.


Scott,

No worries. Occasionally I have access to a 'clean' windows machine without the MinGW libraries. The program worked correctly there, so I published it

Best regards,

David.

#10 User is offline   scottb613 

  • Executive Vice President
  • Group: Status: First Class
  • Posts: 3,186
  • Joined: 06-July 09
  • Gender:Male
  • Location:Downeast Maine (soon)
  • Simulator:ORTS
  • Country:

Posted 28 April 2023 - 03:23 AM

Hi David,

:thumbup3:

Regards,
Scott

#11 User is offline   pwillard 

  • Foreman Of Engines
  • Group: Posts: Contributing Member
  • Posts: 881
  • Joined: 03-March 08
  • Gender:Male
  • Location:Cumming, Ga
  • Simulator:OpenRails
  • Country:

Posted 17 May 2023 - 10:01 AM

I'm finding that it fails to process a number of default files from MSTS...

For *grins*, I mean testing, I decided to batch process the texture folder under routes for USA2.

I ran this script:


$AceProg = 'ace2bmp.exe'

Write-host "If the ACE file has an Alpha Channel, The BMP file generated will not have one."
Write-host "You have been warned"

# Get the current folder path
$currentFolder = Get-Location

# Get all *.s files in the current folder
$fileList = Get-ChildItem -Path $currentFolder -Filter *.ace

# Loop through each file in the list
foreach ($file in $fileList) {
    # Run the ace2bmp.exe executable with the file as input
    $arg1 = $file.fullname
    write-host "Processing: "
    write-host $aceprog $arg1
    & $aceprog $arg1
    Write-host "==============="
}



And here a few files that it *stopped working* on...

chimney.ace
facade6.ace
flatcar.ace
freeway.ace
freight.ace
jp1Car2.ace
jp1Van2.ace


and had near heart failure when processing JP2concwarehse.ace


These are just some examples as I just stopped at this point.

Pete

#12 User is offline   David Webb 

  • Apprentice
  • Group: Posts: Active Member
  • Posts: 36
  • Joined: 05-January 20
  • Gender:Male
  • Simulator:OpenRails, ZR
  • Country:

Posted 29 June 2023 - 11:56 PM

With the help of Pete Willard, who tested various changes, the latest version of ace2bmp includes the following improvements:
1. Texture files containing only one image, i.e. missing a set of mipmaps, are now read correctly.
2. If the output bitmap file contains an alpha channel, the file header now contains the extra fields needed to describe the alpha format.
3. A unique temporary filename is used when uncompressing images, reducing the chance of problems during parallel processing.

The program also requires that the input filename contains no spaces, the requirement being a possible indicator of machine intelligence. Non-ascii filename characters may work but are best avoided because of possible conflicts between the UTF8 and UTF16LE character formats.

Information on how to use the program is given in my post of the 27 April.

For anyone who wants to develop the program further, the source code is now on Github (https://github.com/djw-zr/ace2bmp). I'll respond in the case of any major errors, but otherwise chaps and gals, that it.

David.

Attached File(s)



#13 User is offline   pwillard 

  • Foreman Of Engines
  • Group: Posts: Contributing Member
  • Posts: 881
  • Joined: 03-March 08
  • Gender:Male
  • Location:Cumming, Ga
  • Simulator:OpenRails
  • Country:

Posted 30 June 2023 - 05:23 AM

I would like to point out that some TEXTURE files from the original MSTS distribution disks *do* have spaces in their name... not many... and these files will need to be handled as special cases.

Pete


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users