Home » MODDING HQ 1.13 » v1.13 Coding Talk » Doubling image size
Doubling image size[message #247198] Wed, 17 March 2010 05:36 Go to previous message
Nephut is currently offline Nephut
Messages:4
Registered:March 2010
I am coding a Java-program that doubles (x and y) the image sizes of JA2 tiles, characters and objects. It should work for 8-bit non-animated files (single image) and 8-bit animated files (multiple images). It will not work for 16-bit files.

The program does the following:
1. read every sti-file in one folder and process images one by one
2. uncompress an image into an internal datastructure
3. double the size (2*2)
4. filter the image
5. compress the image
6. save them to sti-files

The filtering far from perfect and it is probably not a very text-book approach. I have been coding it in an ad-hoc -style, trying something and seeing if it works. I have concentrated on these aspects:
- keep unchanged as many pixels as possible (most filtering is only done on every other line)
- remove blockiness due to 2*2 doubling
- make lines straight; especially 45 degrees and those parallel to tile edges
- keep line thicknesses unchanged

In addition the program processes edges of characters. It corrects color-types (hair, shirt, ...) of some dark pixels in the edge and draws a thin line around characters.

Check out these images before and after double-sizing (click for higher resolution):

http://img689.imageshack.us/img689/4053/ja2hq3.jpg

I extracted the following sti-files out of slf-files ANIMS.SLF and TILESETS.SLF:
Data/Anims/F_MERC/*
Data/Anims/M_MERC/*
Data/Anims/S_MERC/*
tilesets/0/* (excluding subdirectories)

and processed them (about 450 sti-files) with the program. The program ran about 15 minutes (2.4 GHz Core 2 Duo). This is how it looks in-game:

http://img219.imageshack.us/img219/7702/ja2hq4.jpg

Here double-sized are: characters, rooftops, fence , square (below hand), footsteps, bushes, part of road, debris, ...

I haven't tested almost anything in-game, but here are some observations. Scrolling seems to work ok. While walking the mercs tread somewhat, because real distances have not doubled. They can for instance crouch or hop over the fence. The tab above active merc leaves artifacts when walking left. Moving cursor over the artifacts wipes them. The cursor needs to be placed slightly down and right to select a merc.

Report message to a moderator

Civilian
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Code for tanks
Next Topic: Learning how the tactical AI works
Goto Forum:
  


Current Time: Tue Feb 11 12:19:34 GMT+2 2025

Total time taken to generate the page: 0.01019 seconds