|
|
#1 |
|
Alcopops
Tools & Tutorials Moderator
|
BLPaletter converts BMP, TGA and JPG images to paletted BLP images.
These often compress better than usual JPG compressed BLPs. For example it compresses a 256x256 texture to 33kb in a map of mine. Note that paletted blps work better with MPQ archive compression than ordinary jpg blps, so that you can only accurately compare file size after importing them into a map. Since version 1.3 it can also create JPG compressed BLPs. Fixed Mipmapping issues in version 1.4. Fixed an alpha channel issue in version 1.5b. Get the latest versoin (1.5c) here The C++ source code is also available here Botanic made a GUI for it, you can get it here An older GUI made by Acaykath is also available, but I think it doesn't support the latest features that I've added. It's available here USAGE Code:
BLPaletter <input.tga|input.bmp|input.jpg> [<output.blp>] [<number of colors / quality>] [-j | -p] [-mipN] Replace the N of the -mip parameter with a number between 1 and 16. This will limit the number of generated mipmaps to a max of N. For icons and interface textures always use -mip1 because they do not use mipmapping . Or -mip2 if you support people with really old computers who have the texture quality setting at low. For model textures simply leave out the -mip parameter. EXAMPLES Code:
BLPaletter D:\icons\BTNSomeIcon.tga -mip1
-> Will create D:\icons\BTNSomeIcon.blp with 256 colors and 1 mipmap
BLPaletter D:\icons\BTNBlah.bmp 128
-> Will create D:\icons\BTNBlah.blp with 128 colors
BLPaletter D:\icons\a.tga D:\icons\b.blp 64
-> Will create D:\icons\b.blp with 64 colors
BLPaletter "C:\Program Files\Something\SomeTexture.tga" Target.blp
-> Will create Target.blp with 256 colors in the current directory (watch out: you need " when a path contains a space)
BLPaletter C:\x.bmp C:\y.blp 85 -j
-> Will create C:\y.blp with JPG compression and a quality of 85%
BLPaletter ..\Textures\MountainKing.bmp -p -mip8
-> Will create ..\Textures\MountainKing.blp with 256 colors (paletted) and 8 mipmaps at maxCHANGES IN 1.5 Fixed a bug that corrupted the alpha channel on images smaller than 128 x 128 CHANGES IN 1.4 Now auto-generates mipmaps so it works properly with textures when looking from far away Added -mipN parameter (replace N with the number of mipmaps you wanna have, eg. -mip1 for icons) Fixed a visual problem related to wrong mipmap offsets Cleaned up the source code CHANGES IN 1.3.2 It can now read jpg files too. CHANGES IN 1.3 Added option to use jpg compression (-j vs. -p switch, -p is assumed by default) With the -j switch on, the number of color parameter controls the quality of the output blp (values between 1 and 99 please) CHANGES IN 1.2 Removed the 'Press any button to continue' message. CHANGES IN 1.1 Added optional parameter to specify the number of colors (16 - 256). Added Floyd-Steinberg-Dithering for much better looking results. Thanks to TheProphet for a few utility functions, BlackDick and Magos for their blp format specifications, PipeDream, the IJG for their free Jpeg Library, Litany for providing test files. Last edited by PitzerMike : 04-20-2008 at 11:40 AM. |
|
|
|
| Sponsored Links - Login to hide this ad! |
|
|
|
|
#2 |
|
Free Software Terrorist
Technical Director
|
And paletted blps do not use a lossy compression.
__________________ |
|
|
|
|
|
#3 |
|
Missing You All at Wc3c
Site Owner
|
Sexy, I love it!
__________________ |
|
|
|
|
|
#4 |
|
User
Join Date: Feb 2006
Posts: 66
|
Consider adding a tutorial on how to put this in the Path environment variable, so people can call it from any folder.(believe me, most people don't even know what Environment Varibles is)
Last edited by MeanMachine : 08-30-2006 at 10:18 AM. |
|
|
|
|
|
#5 |
|
xyzi - our universe
Join Date: May 2005
Posts: 742
![]() ![]() ![]()
|
GJ. +Rep
__________________ |
|
|
|
|
|
#6 | |
|
Free Software Terrorist
Technical Director
|
Quote:
|
|
|
|
|
|
|
#7 |
|
User
Join Date: Feb 2006
Posts: 66
|
|
|
|
|
|
|
#8 |
|
Free Software Terrorist
Technical Director
|
I mean for lame users get an interface they wouldn't need to know about that
__________________ |
|
|
|
|
|
#9 |
|
User
Join Date: Feb 2006
Posts: 66
|
Ah, the forotten days of DOS. Nowadays most windows users don't even know what it is because of the lame-friendly (did i say lame-friendly? i meant user-friendly) programs. Anyway, a simple interface won't hurt. Some people need 10 minutes to navigate to the correct folder in the command promt anyway.
|
|
|
|
|
|
#10 |
|
User
Join Date: Jan 2004
Posts: 387
![]() ![]() ![]()
|
This is so AWESOME!
__________________There are some images that get a better quality to size ratio with jpg (such as large lifelike textures), then there are some images that are perfect for palette, such as icons and textures with a low range of colors. To achieve the BEST possible compression ratio, there are some tricks though. By pre-quantisizing the images to use even smaller palettes than 256, the compressor can achieve even smaller filesizes. An icon for example, that 4200 bytes after being BLPaletted would compress to 2031 bytes after I pre-reduced the number of unique colors to 32. That's over 48% of the size of the original paletted version, and 29% of the size of the original jpg/blp (at low quality setting), and it looks almost perfect! To do this, simply open an image up in i.e Photoshop, convert it to "Indexed Color", reduce the number of colors to the smallest value you can achieve without compromising image quality (be sure to try the different dithering options) and click OK. Then, change it back to RGB mode (because that's what the BLPaletter can read) and make a paletted BLP out of it. You'll see that it compresses much better. EDIT: Oh, and Mike, I initially considered modifying the source to allow specifying the number of colors, but then I realized you know much better how the program works and whether it would fit in. If it adds a dithering quantisizer (or does it have that?), it would probably do all this work by itself, although I'm not saying it's worth your time to implement that :) Last edited by karukef : 08-31-2006 at 07:57 AM. |
|
|
|
|
|
#11 |
|
Alcopops
Tools & Tutorials Moderator
|
Yeah, the quantizer class I have, already lets you specify the number of colors in the constructor. So all i need to add is an additional parameter for the number of colors and pass it to the constructor.
__________________ |
|
|
|
|
|
#12 |
|
Alcopops
Tools & Tutorials Moderator
|
You can now specify the number of colors to be used and a dithering algorithm is applied to the blps so they'll look much better now.
__________________ |
|
|
|
|
|
#13 |
|
Moderator
Code Moderator
Join Date: Feb 2006
Posts: 1,405
![]() ![]() ![]()
|
What would it take to write a tool that automatically goes through a map, finds references to appropriate images and replaces them automatically? Where would one need to search? With list file, could the images be replaced directly by giving them the former extension?
__________________ |
|
|
|
|
|
#14 |
|
Free Software Terrorist
Technical Director
|
This is better for an individual manual process cause the results are not always the best, some pics would have a better ratio or quality as jpeg blps.
__________________ |
|
|
|
|
|
#15 |
|
Oh for the sake of fudge
Respected User
|
Yeah I noticed that, some images seem to bloat under this tool(namely images that are only a tga after being converted from BLP format for some reason).
__________________At any rate, do paletted BLPs work for icons? I seem to remeber someone saying that it won't accept paletted TGAs for icons, so I hope thats not the case in this instance. |
|
|
|
![]() |
| Thread Tools | Search this Thread |
|
|
|
Donate |