wc3campaigns
WC3C Homepage - www.wc3c.netUser Control Panel (Requires Log-In)Engage in discussions with other users and join contests in the WC3C forums!Read one of our many tutorials, ranging in difficulty from beginner to advanced!Show off your artistic talents in the WC3C Gallery!Download quality models, textures, spells (vJASS/JASS), systems, and scripts!Download maps that have passed through our rigorous approval process!

Go Back   Wc3C.net > Resources > Tools
User Name
Password
Register Rules Get Hosted! Chat Pastebin FAQ and Rules Members List Calendar



Reply
 
Thread Tools Search this Thread
Old 08-29-2006, 08:53 PM   #1
PitzerMike
Alcopops
 
PitzerMike's Avatar


Tools & Tutorials Moderator
 
Join Date: Jan 2003
Posts: 2,791

Submissions (12)

PitzerMike is a splendid one to behold (643)PitzerMike is a splendid one to behold (643)PitzerMike is a splendid one to behold (643)PitzerMike is a splendid one to behold (643)

Approved Map: Pitzer's Minesweeper

Default BLPaletter 1.5

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 max

CHANGES 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.
Attached Images
File Type: gif BLPaletter.gif (829 Bytes, 3084 views)
__________________
Zoom (requires log in)

Last edited by PitzerMike : 04-20-2008 at 11:40 AM.
PitzerMike is offline   Reply With Quote
Sponsored Links - Login to hide this ad!
Old 08-30-2006, 12:27 AM   #2
Vexorian
Free Software Terrorist
 
Vexorian's Avatar


Technical Director
 
Join Date: Apr 2003
Posts: 14,905

Submissions (37)

Vexorian has a reputation beyond repute (1060)Vexorian has a reputation beyond repute (1060)Vexorian has a reputation beyond repute (1060)Vexorian has a reputation beyond repute (1060)Vexorian has a reputation beyond repute (1060)Vexorian has a reputation beyond repute (1060)Vexorian has a reputation beyond repute (1060)

Hero Contest #3 - 2nd Place

Default

And paletted blps do not use a lossy compression.
__________________
Zoom (requires log in)Wc3 map optimizer 5.0
Someone should fix .wav sound in this thing.
Zoom (requires log in)JassHelper 0.A.2.A
Turns your simple code into something that is complicated enough to work.
Faster != more useful
Vexorian is offline   Reply With Quote
Old 08-30-2006, 01:12 AM   #3
Tim.
Missing You All at Wc3c
 
Tim.'s Avatar


Site Owner
 
Join Date: Jul 2003
Posts: 4,474

Submissions (18)

Tim. is a name known to all (502)Tim. is a name known to all (502)Tim. is a name known to all (502)Tim. is a name known to all (502)Tim. is a name known to all (502)

Approved Map: PiratesSpell making session 3 winner

Default

Sexy, I love it!
__________________
"oO and if anyone called Tim. trys to make an account then kick there butts." -Mavus, moderator of the GTW forums


Avast! Seen Pirates? Get it here!
Tim. is offline   Reply With Quote
Old 08-30-2006, 10:17 AM   #4
MeanMachine
User
 
Join Date: Feb 2006
Posts: 66

MeanMachine has little to show at this moment (7)

Default

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.
MeanMachine is offline   Reply With Quote
Old 08-30-2006, 10:26 AM   #5
BertTheJasser
xyzi - our universe
 
BertTheJasser's Avatar
 
Join Date: May 2005
Posts: 742

Submissions (2)

BertTheJasser has a spectacular aura about (111)BertTheJasser has a spectacular aura about (111)BertTheJasser has a spectacular aura about (111)BertTheJasser has a spectacular aura about (111)

Default

GJ. +Rep
__________________
Note: Bye... I had a lot of fun here!
Special thanks to Vexorian who helped me learn jass, the real jass and always helped me when problems occured, I would call him somehow my mentor. Pipedream, who made amazing Grimoire and helped me acclerating my map (currently at 99% finished, no developement atm).

Vote for Linux Ports in general of Blizzard products: http://www.PetitionOnline.com/ibpfl/
BertTheJasser is offline   Reply With Quote
Old 08-30-2006, 05:32 PM   #6
Vexorian
Free Software Terrorist
 
Vexorian's Avatar


Technical Director
 
Join Date: Apr 2003
Posts: 14,905

Submissions (37)

Vexorian has a reputation beyond repute (1060)Vexorian has a reputation beyond repute (1060)Vexorian has a reputation beyond repute (1060)Vexorian has a reputation beyond repute (1060)Vexorian has a reputation beyond repute (1060)Vexorian has a reputation beyond repute (1060)Vexorian has a reputation beyond repute (1060)

Hero Contest #3 - 2nd Place

Default

Quote:
Originally Posted by MeanMachine
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)
The obvious solution is to make an interface program that calls this one. That's the linux style.
__________________
Zoom (requires log in)Wc3 map optimizer 5.0
Someone should fix .wav sound in this thing.
Zoom (requires log in)JassHelper 0.A.2.A
Turns your simple code into something that is complicated enough to work.
Faster != more useful
Vexorian is offline   Reply With Quote
Old 08-30-2006, 08:46 PM   #7
MeanMachine
User
 
Join Date: Feb 2006
Posts: 66

MeanMachine has little to show at this moment (7)

Default

Quote:
Originally Posted by Vexorian
The obvious solution is to make an interface program that calls this one. That's the linux style.
I don't get it. Why make an interface program ? What I meant to do was add it here :

And by doing this you can call the program from EVERY folder.
MeanMachine is offline   Reply With Quote
Old 08-30-2006, 08:58 PM   #8
Vexorian
Free Software Terrorist
 
Vexorian's Avatar


Technical Director
 
Join Date: Apr 2003
Posts: 14,905

Submissions (37)

Vexorian has a reputation beyond repute (1060)Vexorian has a reputation beyond repute (1060)Vexorian has a reputation beyond repute (1060)Vexorian has a reputation beyond repute (1060)Vexorian has a reputation beyond repute (1060)Vexorian has a reputation beyond repute (1060)Vexorian has a reputation beyond repute (1060)

Hero Contest #3 - 2nd Place

Default

I mean for lame users get an interface they wouldn't need to know about that
__________________
Zoom (requires log in)Wc3 map optimizer 5.0
Someone should fix .wav sound in this thing.
Zoom (requires log in)JassHelper 0.A.2.A
Turns your simple code into something that is complicated enough to work.
Faster != more useful
Vexorian is offline   Reply With Quote
Old 08-30-2006, 09:13 PM   #9
MeanMachine
User
 
Join Date: Feb 2006
Posts: 66

MeanMachine has little to show at this moment (7)

Default

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.
MeanMachine is offline   Reply With Quote
Old 08-31-2006, 07:48 AM   #10
karukef
User
 
Join Date: Jan 2004
Posts: 388

karukef has a spectacular aura about (97)karukef has a spectacular aura about (97)karukef has a spectacular aura about (97)karukef has a spectacular aura about (97)

Default

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.
karukef is offline   Reply With Quote
Old 08-31-2006, 08:52 AM   #11
PitzerMike
Alcopops
 
PitzerMike's Avatar


Tools & Tutorials Moderator
 
Join Date: Jan 2003
Posts: 2,791

Submissions (12)

PitzerMike is a splendid one to behold (643)PitzerMike is a splendid one to behold (643)PitzerMike is a splendid one to behold (643)PitzerMike is a splendid one to behold (643)

Approved Map: Pitzer's Minesweeper

Default

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.
__________________
Zoom (requires log in)
PitzerMike is offline   Reply With Quote
Old 08-31-2006, 01:37 PM   #12
PitzerMike
Alcopops
 
PitzerMike's Avatar


Tools & Tutorials Moderator
 
Join Date: Jan 2003
Posts: 2,791

Submissions (12)

PitzerMike is a splendid one to behold (643)PitzerMike is a splendid one to behold (643)PitzerMike is a splendid one to behold (643)PitzerMike is a splendid one to behold (643)

Approved Map: Pitzer's Minesweeper

Default Updated

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.
__________________
Zoom (requires log in)
PitzerMike is offline   Reply With Quote
Old 09-01-2006, 06:19 AM   #13
PipeDream
Moderator
 
PipeDream's Avatar


Code Moderator
 
Join Date: Feb 2006
Posts: 1,405

Submissions (6)

PipeDream is a glorious beacon of light (463)PipeDream is a glorious beacon of light (463)PipeDream is a glorious beacon of light (463)PipeDream is a glorious beacon of light (463)

Default

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?
__________________
PipeDream is offline   Reply With Quote
Old 09-01-2006, 01:46 PM   #14
Vexorian
Free Software Terrorist
 
Vexorian's Avatar


Technical Director
 
Join Date: Apr 2003
Posts: 14,905

Submissions (37)

Vexorian has a reputation beyond repute (1060)Vexorian has a reputation beyond repute (1060)Vexorian has a reputation beyond repute (1060)Vexorian has a reputation beyond repute (1060)Vexorian has a reputation beyond repute (1060)Vexorian has a reputation beyond repute (1060)Vexorian has a reputation beyond repute (1060)

Hero Contest #3 - 2nd Place

Default

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.
__________________
Zoom (requires log in)Wc3 map optimizer 5.0
Someone should fix .wav sound in this thing.
Zoom (requires log in)JassHelper 0.A.2.A
Turns your simple code into something that is complicated enough to work.
Faster != more useful
Vexorian is offline   Reply With Quote
Old 09-01-2006, 02:31 PM   #15
Chuckle_Brother
Oh for the sake of fudge
 
Chuckle_Brother's Avatar


Respected User
 
Join Date: Dec 2005
Posts: 782

Submissions (2)

Chuckle_Brother will become famous soon enough (53)Chuckle_Brother will become famous soon enough (53)

Send a message via ICQ to Chuckle_Brother Send a message via AIM to Chuckle_Brother Send a message via MSN to Chuckle_Brother Send a message via Yahoo to Chuckle_Brother
Default

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.
__________________
"...you play a mean banjo"
Chuckle_Brother is offline   Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off


All times are GMT. The time now is 12:57 AM.


Donate

Affiliates
The Hubb http://bylur.com - Warcraft, StarCraft, Diablo and DotA Blog & Forums The JASS Vault Clan WEnW Campaign Creations Clan CBS GamesModding Flixreel Videos

Powered by vBulletin (Copyright ©2000 - 2014, Jelsoft Enterprises Ltd).
Hosted by www.OICcam.com
IT Support and Services provided by Executive IT Services