Beta PCX tile resizer

Terrain / Theater editing

Moderators: Lone Wolf, Snake Man

dave77459
Recruit
Posts: 18
Joined: 2002-10-01 22:01:01
Location: Houston, TX

Beta PCX tile resizer

Post by dave77459 » 2002-10-13 19:38:00

Disclaimer: I don't know what I am doing, so this may not be useful. Caveat utilitor.

That said, I have created a tool as specified by Panther. I sent it to him, but he hasn't replied yet. I think it might work, but I can't tell. :-)

Here's what it does. You create a large PCX tile (H*.PCX). This program takes that tile and creates smaller ones at the resolution you want and puts it in the folder you want, saving the palette. It changes the H to a T, L, M, or whatever, and copies in the H tile too. In this way, it is like the runtiles script, but it runs under Windows. Also, it creates previews for you, before you press the SAVE button.

I don't know how to do good resampling, so I am doing the crappiest resampling I could think of. Seriously, to create smaller resolutions, I am dividing the tile in half by throwing away odd number pixels and lines. To make it 1/4 as large, I am doing it twice. To my undiscerning eyes, it looks OK. Proper resampling would blend color tones, etc, but I don't know how to do that on a palette-based graphic.

You can use 512, 256, or 128 pixel H tiles, and it will create 512, 256, 128, 64, 32, or 16 pixel L, M, and T tiles as long as they are the same size or smaller than the H tile.

What I am doing is keeping the palette intact. I may not be displaying it correctly in the preview (graphics programming isn't my gig), but I am reading the 256 colour palette and writing out that same data in the output files.

I would appreciate feedback. I haven't got more than a few days of work into the thing, but before I spend another hour, I'd like to know it is worth your time.

Questions and comments should be sent to me at my email (I hardly every come here): davehathaway@yahoo.com .

And, here is the file:

http://www.new-foundations.org/Retile.zip

I hope you like it, but as always using beta software, back up what you will hate losing before you run the program. :)

Dave

diomedea
Recruit
Posts: 47
Joined: 2002-06-05 22:01:01
Location: Rome, Italy

Re: Beta PCX tile resizer

Post by diomedea » 2002-10-14 12:49:00

Hi Dave
every effort done to the benefit of the community deserves full appreciation. Good idea.
IMO, a better algorithm to decrease resolution requires interpolation. Serious graphical software I know of does that. In our case, doing interpolation is quite simple because we just need to divide resolution by two: that means not having to do with fractions of colors from odd pixels. Dividing by two, both on the horizontal and vertical axis, we're going to substitute a single pixel where previously we had four (2x2). We have to get each color channel (Red, Green, Blue) separately for each pixel, and interpolate them (e.g. red with red) to have the mean value for each channel. The triple of values (RGB) obtained gives the best approximation for the single pixel. However we have to use only colors found in the palette, so the final step is to find the closest representation of the triple in the palette in use.
That's in general the way used. As you already showed to know how to handle graphics, I'm sure you can use that algorithm if you like.

Diomedea out.
diomedea out.

ccc
Chief of Staff
Posts: 4857
Joined: 2000-08-06 22:01:01

Re: Beta PCX tile resizer

Post by ccc » 2002-10-14 13:42:00

cool, i like this tool!!

the only problem is creating the first H tile :p

dave77459
Recruit
Posts: 18
Joined: 2002-10-01 22:01:01
Location: Houston, TX

Re: Beta PCX tile resizer

Post by dave77459 » 2002-10-14 18:30:00

quote:Originally posted by diomedea:
Hi Dave
every effort done to the benefit of the community deserves full appreciation. Good idea.
IMO, a better algorithm to decrease resolution requires interpolation. Serious graphical software I know of does that. In our case, doing interpolation is quite simple because we just need to divide resolution by two: that means not having to do with fractions of colors from odd pixels. Dividing by two, both on the horizontal and vertical axis, we're going to substitute a single pixel where previously we had four (2x2). We have to get each color channel (Red, Green, Blue) separately for each pixel, and interpolate them (e.g. red with red) to have the mean value for each channel. The triple of values (RGB) obtained gives the best approximation for the single pixel. However we have to use only colors found in the palette, so the final step is to find the closest representation of the triple in the palette in use.
That's in general the way used. As you already showed to know how to handle graphics, I'm sure you can use that algorithm if you like.

Diomedea out.
Diomedea,

I completely agree with your suggestion for interpolating colours, and I would do just that. However, I don't know how. I can imagine that there are three closest matches: one each for red, green, and blue. There may be another that is not as close to any single color, but is the closest overall.

Can you find an algorithm for me?

Dave

dave77459
Recruit
Posts: 18
Joined: 2002-10-01 22:01:01
Location: Houston, TX

Re: Beta PCX tile resizer

Post by dave77459 » 2002-10-14 18:32:00

quote:Originally posted by ccc:
cool, i like this tool!!

the only problem is creating the first H tile :p
Actually, Panther has found another problem; the image is shifted one pixel to the right compared to other resizing programs. I'm sure finding the problem is not a big deal, but I'm hoping for more feedback now. Do y'all like the User Interface, for instance?

Dave

PS: Thanks for the encouragement. I very much appreciate it.

Widowmaker
Lt. General
Posts: 1002
Joined: 2000-10-30 23:01:01
Gaming Interests: Falcon 4.0
Editing Interests: Terrains
Location: The Netherlands

Re: Beta PCX tile resizer

Post by Widowmaker » 2002-10-15 10:25:00

haven't tested it yet due to limitation in time.

question, how are Ttiles treated by this proggie?

Ttiles donot have the same paletta as the Htiles
so they cannot be simply resized.
They need to have the paletta stored in the fartiles.pal (we use a xfartiles.pcx image for that in Runtiles) so all the Ttiles get the paletta of that particular image and not of the orig Htile

thnx for this proggie.

/widmak
Widmak

diomedea
Recruit
Posts: 47
Joined: 2002-06-05 22:01:01
Location: Rome, Italy

Re: Beta PCX tile resizer

Post by diomedea » 2002-10-15 15:19:00

Widmak
very useful advice.
So, to work correctly this utility should, for each pixel:
- take the code for the entry in the Htile palette
- take the triple RGB for the corresponding palette code
- do the shrinking routine
- use the triple RGB of each resulting pixel to find the corresponding code in the fartiles.pal palette.

Dave
IMO on the net you can find even too much about graphics functions. I just tried Google with "Interpolation Graphics GPL" to find more than 2000 citations. Which ones would be useful if for you to decide, you know how your utility works.

Diomedea out.
diomedea out.

dave77459
Recruit
Posts: 18
Joined: 2002-10-01 22:01:01
Location: Houston, TX

Re: Beta PCX tile resizer

Post by dave77459 » 2002-10-15 18:08:00

quote:Originally posted by Widowmaker:
haven't tested it yet due to limitation in time.

question, how are Ttiles treated by this proggie?

Ttiles donot have the same paletta as the Htiles
so they cannot be simply resized.
They need to have the paletta stored in the fartiles.pal (we use a xfartiles.pcx image for that in Runtiles) so all the Ttiles get the paletta of that particular image and not of the orig Htile

thnx for this proggie.

/widmak
Hmmm, thanks for the info of which I was unaware. Is the fartiles.pal file "standard", meaning every terrain is the same? Thus, is fartiles.pcx standard? If so, I can just extract the palette and hardcode it into the file. Else, if I knew the format of fartiles.pal, I would read that and insert it into the PCX file. Or, if you pointed me to fartiles.pcx, I could read that palette and insert it into the T file.

Regarding the shifted pixel I mentioned, I think it is a difference of interpolation. I used LViewPro, and it also "shifted" the pixel.

diomedea: thanks for looking around for me. To my eye, the difference between "my" interpolation and LViewPro's was not substantial. However, the difference between that and a finished one is. For example, here is an image of 3 versions of the LMORI203.PCX found in the afghan terrain:

:) My feelings won't be hurt.

Dave

Snowman
Recruit
Posts: 36
Joined: 2001-12-27 23:01:01

Re: Beta PCX tile resizer

Post by Snowman » 2002-10-15 20:21:00

quote:Originally posted by dave77459:
I completely agree with your suggestion for interpolating colours, and I would do just that. However, I don't know how. I can imagine that there are three closest matches: one each for red, green, and blue. There may be another that is not as close to any single color, but is the closest overall.
Think of the colors as being points in 3D space (RGB) -> (xyz).

Find your desired color by the RGB method described bt Diomedea

Then calculate the distance between that "point" and the corresponding "point" for each of the colors in the palette.

The closest "point" is the closest color.

BTW distance between two points (R1,G1,B1) & (R2,G2,B2) is:
SQRT((R1-R2)^2+(G1-G2)^2+(B1-B2)^2)

This might help to soften the grainy-ness.
Good luck!

dave77459
Recruit
Posts: 18
Joined: 2002-10-01 22:01:01
Location: Houston, TX

Re: Beta PCX tile resizer

Post by dave77459 » 2002-10-16 03:44:00

quote:Originally posted by Snowman:
Think of the colors as being points in 3D space (RGB) -> (xyz).

Find your desired color by the RGB method described bt Diomedea

Then calculate the distance between that "point" and the corresponding "point" for each of the colors in the palette.

The closest "point" is the closest color.

BTW distance between two points (R1,G1,B1) & (R2,G2,B2) is:
SQRT((R1-R2)^2+(G1-G2)^2+(B1-B2)^2)

This might help to soften the grainy-ness.
Good luck!
Genuinely useful! Thanks bunches.

I think what I might try is averaging the colors for a quartet of pixels. E.g.:

1 2 3
4 5 6
7 8 9

What I have been doing is keeping 1, 3, 7, and 9. Now I might average 1, 2, 4, and 5, then looking for the color in the palette closest to it. <shrug>

I wonder if anyone likes the graininess? Certainly, it seems closest to the original.

Dave

diomedea
Recruit
Posts: 47
Joined: 2002-06-05 22:01:01
Location: Rome, Italy

Re: Beta PCX tile resizer

Post by diomedea » 2002-10-16 07:22:00

Dave
I actually like the "graininess". It carries more information to the eye, gives more feeling of discontinuities in the terrain, so IMO is closer to reality. And your utility already shows great doing so.
From the three images in your post, the original (left) shows less discontinuities, so IMO is more like haze had blurried the terrain seen from above.

On such images, having every feature several pixels wide, you don't see much difference between interpolation or deletion of pixels. But if we have to apply a shrinking routine to tiles with one-pixel wide features, we would get a very different result between the two algorithms (I believe some such tile exist or are under development).

Diomedea out.
diomedea out.

dave77459
Recruit
Posts: 18
Joined: 2002-10-01 22:01:01
Location: Houston, TX

Re: Beta PCX tile resizer

Post by dave77459 » 2002-10-16 10:30:00

Well, for the sake of discussion, here are a couple screen shots of the program in action:

This is after the LOAD button is pressed. Note that the size is automatically selected for the H tile, and suggestions are made for the others.
:)

Dave

diomedea
Recruit
Posts: 47
Joined: 2002-06-05 22:01:01
Location: Rome, Italy

Re: Beta PCX tile resizer

Post by diomedea » 2002-10-16 12:46:00

Nice, nice. I already tried your utility and was very pleased of its functionality.
About the UI, you're on spot. I would prefer to have the algorithm selectable, would be good to preview both ways at the same time, so to choose for the best effect.
About xfartiles.pcx, would be even better to have the utility find and suggest using one such file in the Htile same folder, but give the user control to accept or change that folder.
To make one further suggestion, I would like if the M,L,T tiles generated appeared all in front on the desktop (no windows overlapping, I hate having to move them every time).
Very good work til' now. :D

Diomedea out.
diomedea out.

dave77459
Recruit
Posts: 18
Joined: 2002-10-01 22:01:01
Location: Houston, TX

Re: Beta PCX tile resizer

Post by dave77459 » 2002-10-16 13:09:00

[quote]quote:Originally posted by diomedea:
Nice, nice. I already tried your utility and was very pleased of its functionality.
About the UI, you're on spot. I would prefer to have the algorithm selectable, would be good to preview both ways at the same time, so to choose for the best effect.
About xfartiles.pcx, would be even better to have the utility find and suggest using one such file in the Htile same folder, but give the user control to accept or change that folder.
To make one further suggestion, I would like if the M,L,T tiles generated appeared all in front on the desktop (no windows overlapping, I hate having to move them every time).
Very good work til' now. :(

I don't see it mentioned here, so I must have told Panther. The preview windows don't seem to be showing the right colors... perhaps a little too red. However, I am copying the palette over verbatim, so the program will preserve your palette. I found a pile of links to graphics subroutines in C++Builder (which I use), and many relate to forcing Windows to use the specified palette, so this seems a common problem. If I can fix the preview, I will.

Dave
davehathaway@yahoo.com

Snake Man
Commander-In-Chief
Posts: 9354
Joined: 2000-07-31 22:01:01
Gaming Interests: ArmA, ArmA 2, Falcon 4.0 and OFP.
Editing Interests: All, I (try) to edit everything.
Location: PMC

Re: Beta PCX tile resizer

Post by Snake Man » 2002-10-16 15:06:00

xfartile.pcx is my work, there is no such file for original Falcon 4. Here is short explanation of how do I make xfartile.pcx file.

I'll open PaintShopPro (usually) new image of large size, like 1024x768 etc with 16million colors, then I copy paste generally one tile from every tile-set (all tiles in one tile-set or group has the same palette) into the large image. HOWEVER its not needed to get EVERY tile-set included, only the radically different colors from the whole texture.bin contains. When all images are there, I reduce the color depth to 256 colors. Also this time I usually resize the large image to 16x16 resolution (we only care about the COLOR PALETTE here after all). Voila, we have xfartile.pcx file.

Okay so what would be a real cool feature in your util?

Well the util would read texture.bin (I bet Codec can provide you enough information of the format), take one tile from every tile set and append them to a new 16m color image (xfartile.pcx), reduce the color size to 256 then using this xfartile.pcx for the T tiles palette and creating the fartile.pal file Falcon uses directly.

Also it would be cool if the util would ZIP up the H, M, L and T tiles into "texture.zip" and place it automatically to the falcons\terrdata\<MYTHEATER>\texture\ directory along with the fartiles.pal file.

This way theater guys would only need to make H tiles and texture.bin - run your utility and thats it.

PMC TFW
Snake Man
PMC Tactical Forum New User Registration please read new info here.

PMC since 1984

Editing knowledge, visit PMC Editing Wiki
The leading, most detailed and comprehensive modification made for the Vietnam War - Vietnam: The Experience homepage
View our videos in PMC Youtube channel

PMC Tactical forum Advanced Search is power.

"ALPHA BLACK TO PAPA BEAR. ALL RUSSIANS ARE TOAST. OVER."

Widowmaker
Lt. General
Posts: 1002
Joined: 2000-10-30 23:01:01
Gaming Interests: Falcon 4.0
Editing Interests: Terrains
Location: The Netherlands

Re: Beta PCX tile resizer

Post by Widowmaker » 2002-10-16 18:03:00

for a test you can for Korea just use one of its T-tiles and rename it xfartiles.pcx
so you can read to paletta from it and test in in your proggie

basically making a xfartiles.pcx is only needed when adding new tilesets with new/different paletta's into the texture.bin


/widmak
Widmak

Widowmaker
Lt. General
Posts: 1002
Joined: 2000-10-30 23:01:01
Gaming Interests: Falcon 4.0
Editing Interests: Terrains
Location: The Netherlands

Re: Beta PCX tile resizer

Post by Widowmaker » 2002-10-16 18:09:00

quote:Originally posted by Snake Man:

Okay so what would be a real cool feature in your util?

Well the util would read texture.bin (I bet Codec can provide you enough information of the format), take one tile from every tile set and append them to a new 16m color image (xfartile.pcx), reduce the color size to 256 then using this xfartile.pcx for the T tiles palette and creating the fartile.pal file Falcon uses directly.

PMC TFW
Snake Man
I don't make my xfartiles.pcx that way completly I also consider usage in the terrain (wich would need an L2 check)
for instance blue is used alot when using random paletta as described above it might turn up a bit odd

something else is true for snow, since not many tilesets use alot of white the white in fartiles won't be as white as one would like.
so the snow turns up odd at far (to yellow or to .. depending on what the tilesets consists off)

the more different palletta's used the more the above method doesn't work well enough
howver it would ease up alot already if it would do what Snakeman suggests

I learned this when doing Isreal Texture.bin/fartiles.pal.
wich contains Korea/Balknas/and ME textures

/widmak
Widmak

Snake Man
Commander-In-Chief
Posts: 9354
Joined: 2000-07-31 22:01:01
Gaming Interests: ArmA, ArmA 2, Falcon 4.0 and OFP.
Editing Interests: All, I (try) to edit everything.
Location: PMC

Re: Beta PCX tile resizer

Post by Snake Man » 2002-10-16 20:28:00

Ok, I don't know.

I do know that they need my help on the Nogova island, so better to grab my gear and hop into the waiting UH-60 Black Hawk on the airstrip.

Hooyah!

PMC TFW
Snake Man
PMC Tactical Forum New User Registration please read new info here.

PMC since 1984

Editing knowledge, visit PMC Editing Wiki
The leading, most detailed and comprehensive modification made for the Vietnam War - Vietnam: The Experience homepage
View our videos in PMC Youtube channel

PMC Tactical forum Advanced Search is power.

"ALPHA BLACK TO PAPA BEAR. ALL RUSSIANS ARE TOAST. OVER."

dave77459
Recruit
Posts: 18
Joined: 2002-10-01 22:01:01
Location: Houston, TX

Re: Beta PCX tile resizer

Post by dave77459 » 2002-10-19 18:33:00

OK y'all, I have made several changes. First of all, I am reading xfartiles.pcx and using that in the T tile. Unfortunately, I am very unable to figure out how to show the right palette. This is QUITE frustrational. Look at the image below, and see that the T tile looks like the original, even though the palette is different.

:)

Thirdly, by special request, if the total heights of the preview windows are less than the program height, I am stacking the previews instead of tiling them. You can see this in the above example.

Still to-do is the "resize all" feature, where all H tiles in the source folder are resized en-bulk. I'm kinda waiting to see if anyone will actually use the program before I do that.

I could look into automatically ZIPPING the files, but that makes the possibility of hosing your texture file much bigger. In Win XP, which I use, replacing files into a ZIP is as easy as drag and drop, so such a feature isn't that useful (to me). Besides, I'd want to be able to review the created tiles, anyways.

The last thing I did was upgrade to C++Builder 6, so the program may not run for you. I think it will, but it may need a DLL or BPI or something.

Oh yes, the zip file is here:

http://www.new-foundations.org/Retile.zip

Any comments?

Dave

dave77459
Recruit
Posts: 18
Joined: 2002-10-01 22:01:01
Location: Houston, TX

Re: Beta PCX tile resizer

Post by dave77459 » 2002-10-19 18:37:00

PS, if some of you graphical types want to create an icon file (.ICO) for me or 2 BMPs (32x32 and 16x16), I'll replace the cheesy one I am now using and not liking.

Dave

dave77459
Recruit
Posts: 18
Joined: 2002-10-01 22:01:01
Location: Houston, TX

Re: Beta PCX tile resizer

Post by dave77459 » 2002-10-20 21:06:00

OK, I think I have all the palette display kinks worked out. PLUS, I have added "color averaging." In this option mode, the pixel that represents several in the bigger image is the average of those pixels. In informal testing, the effect is good sometimes and not so good sometimes.

Here are two examples. The first used color averaging, and the second doesn't. Notice the check box that gives you the option.

:)

Anyways, the zip file is in the same place if you want to try this new version.

Dave

Widowmaker
Lt. General
Posts: 1002
Joined: 2000-10-30 23:01:01
Gaming Interests: Falcon 4.0
Editing Interests: Terrains
Location: The Netherlands

Re: Beta PCX tile resizer

Post by Widowmaker » 2002-10-22 09:14:00

very cool
I hope to be able to test it soon


how did ya avarage the paletta's?

/widmak
Widmak

Widowmaker
Lt. General
Posts: 1002
Joined: 2000-10-30 23:01:01
Gaming Interests: Falcon 4.0
Editing Interests: Terrains
Location: The Netherlands

Re: Beta PCX tile resizer

Post by Widowmaker » 2002-10-22 09:38:00

hmm tested your lates link

my tiles previewlook purple in your proggy and come out all with odd paletes when saved?

something is going wrong :)

/widmak
Widmak

Widowmaker
Lt. General
Posts: 1002
Joined: 2000-10-30 23:01:01
Gaming Interests: Falcon 4.0
Editing Interests: Terrains
Location: The Netherlands

Re: Beta PCX tile resizer

Post by Widowmaker » 2002-10-22 09:46:00

now I tested in XP (prevous post was from win98SE)

now the Htile paletta is off wich is very wierd since it should basically be just a copy

also avaraging palatea should only be on Ttiles.


/widmak
Widmak

dave77459
Recruit
Posts: 18
Joined: 2002-10-01 22:01:01
Location: Houston, TX

Re: Beta PCX tile resizer

Post by dave77459 » 2002-10-23 13:07:00

quote:Originally posted by Widowmaker:
now I tested in XP (prevous post was from win98SE)

now the Htile paletta is off wich is very wierd since it should basically be just a copy

also avaraging palatea should only be on Ttiles.


/widmak
I had heard that 98SE gave a purply tone, which I can't test since my computers use Win2K or XP. But, the palette should be right.

Re the palette on the Htile, you are right, it should be just an exact copy. I maybe made a typo or something.

Re averaging, if you really want to control averaging or not by tile size, I will make that a check box next to each tile size.

I very much appreciate your testing. I at least know that the program runs for someone else, and that I didn't forget some DLL or something. :)

Dave

dave77459
Recruit
Posts: 18
Joined: 2002-10-01 22:01:01
Location: Houston, TX

Re: Beta PCX tile resizer

Post by dave77459 » 2002-10-23 19:22:00

I added color averaging as a function per tile. Some folk might like averaging for all tiles, or just L and T, etc. It is also now a sticky function, like the source and destination folders. the xfartiles.pcx source is sticky as well. Here is a screen cap:

Image

I also removed a "fix" that set the palette depth for tiles when I create the preview windows. That seems to have solved one problem, but created a more serious problem with the H tiles.

And, hmmm, seems like I never put up the version that allows you from the File menu option to convert all the H tiles. That has been added.

You can get the program here:

http://www.new-foundations.org/Retile.zip

Dave

Widowmaker
Lt. General
Posts: 1002
Joined: 2000-10-30 23:01:01
Gaming Interests: Falcon 4.0
Editing Interests: Terrains
Location: The Netherlands

Re: Beta PCX tile resizer

Post by Widowmaker » 2002-10-25 19:43:00

k thnx will test it out tommorrow.

/widmak
Widmak

krfrge
1st Lt
Posts: 123
Joined: 2001-01-09 23:01:01
Location: La. US

Re: Beta PCX tile resizer

Post by krfrge » 2002-10-26 00:26:00

Dave,

Really nice util. Thanks for all the hard work.

Widowmaker
Lt. General
Posts: 1002
Joined: 2000-10-30 23:01:01
Gaming Interests: Falcon 4.0
Editing Interests: Terrains
Location: The Netherlands

Re: Beta PCX tile resizer

Post by Widowmaker » 2002-10-26 21:39:00

haven't come to testing it yet.
However 1 request comes to mind.

Could you unlock the H tiles
I mean I do my editing nowadays in 512res
however I fly my Htiles at 256res.


/widmak
Widmak

dave77459
Recruit
Posts: 18
Joined: 2002-10-01 22:01:01
Location: Houston, TX

Re: Beta PCX tile resizer

Post by dave77459 » 2002-10-27 17:18:00

quote:Originally posted by krfrge:
Dave,

Really nice util. Thanks for all the hard work.
You are welcome. Hopefully you find it useful.

Dave

dave77459
Recruit
Posts: 18
Joined: 2002-10-01 22:01:01
Location: Houston, TX

Re: Beta PCX tile resizer

Post by dave77459 » 2002-10-27 17:22:00

quote:Originally posted by Widowmaker:
haven't come to testing it yet.
However 1 request comes to mind.

Could you unlock the H tiles
I mean I do my editing nowadays in 512res
however I fly my Htiles at 256res.


/widmak
Hmmm, so you want the output H tile to be different than the input? I hadn't thunk about that. Surely I could do that, but there are UI implications I'll have to think through. For example, the original and output H tiles will have to be displayed. I'll mull it over and come back with a new version.

Dave

Widowmaker
Lt. General
Posts: 1002
Joined: 2000-10-30 23:01:01
Gaming Interests: Falcon 4.0
Editing Interests: Terrains
Location: The Netherlands

Re: Beta PCX tile resizer

Post by Widowmaker » 2002-10-29 10:14:00

[/QUOTE]Hmmm, so you want the output H tile to be different than the input? I hadn't thunk about that. Surely I could do that, but there are UI implications I'll have to think through. For example, the original and output H tiles will have to be displayed. I'll mull it over and come back with a new version.

Dave[/B][/QUOTE]

indeed thats what I mean

ideally would be

1 dir with Htiles (any resolution (2048-128)
second dir where the output files go.
H M L and Ttiles.

this way I can keep my templates 512 and don't have to do a resize run before I trow em into your resize proggy.

----
Another step would be to be able just to throw them in as 16bit, this swould save me reducing color to 256 and equalising paletta's.
If your interested into doing that I
will write up the finer details
---

/widmak
Widmak

dave77459
Recruit
Posts: 18
Joined: 2002-10-01 22:01:01
Location: Houston, TX

Re: Beta PCX tile resizer

Post by dave77459 » 2002-10-29 14:21:00

quote:Originally posted by Widowmaker:
----
Another step would be to be able just to throw them in as 16bit, this swould save me reducing color to 256 and equalising paletta's.
If your interested into doing that I
will write up the finer details
---

/widmak
I'd be interested, but I have seen nothing on handling 16 bit PCX files. Is it possible to use a 16 bit BMP instead? Maybe I ought to do some reseach before you spend a lot of time writing up what you want. :)

Dave

Widowmaker
Lt. General
Posts: 1002
Joined: 2000-10-30 23:01:01
Gaming Interests: Falcon 4.0
Editing Interests: Terrains
Location: The Netherlands

Re: Beta PCX tile resizer

Post by Widowmaker » 2002-10-29 14:34:00

nope Falcon doesn't support 16 bit
but all the editing is done in 16 bit
(I asume most tilemakers do this)

so to be able to have your util go from there elimintas 1 step and that is what these proggies are all about, eliminating boring steps.

Here is as how I work
I first make a group of tiles wich should all be having the same paletta as soon as the hit the texture.zip.

so I got for instance 10 16bit textures

your proggy should create the H M L tiles (whatever you select) reduce there size and reduce colorpaleta to 8 bit
using the palleta of the first tiles on all H M L tiles of that group

now I got 30 tiles (H M L toiles) with same paletta

I would do this with all groups

after that comes making the Ttiles (Ttiles is the last thing done as it needs an avarage paletta of all the paletta's used on the H M L tiles)

hope to be clear enough
ask anything you don't understand

/widmak
Widmak

dave77459
Recruit
Posts: 18
Joined: 2002-10-01 22:01:01
Location: Houston, TX

Re: Beta PCX tile resizer

Post by dave77459 » 2002-11-13 21:41:00

Just to let you all know, the web site I was piggy-backing my data on has gone away. I created a web site for my adult Sunday School class, and they just decided they didn't want to have one any more. Fair enough, their decision.

I took the host I was paying for and created a new site. I find I didn't save my retile.zip on this machine, and my staffer has my laptop at a conference. Friday the 15th or so, this link will be good:
http://www.bunkonet.com/downloads/retile.zip

Sorry for the inconvenience. Oh, and if you want to learn about the most popular dice game I know about, Bunko, stop by the site and say hello in the forums. :)

Dave

Closter
Captain
Posts: 154
Joined: 2007-01-07 00:13:42

Post by Closter » 2007-04-12 11:53:35

Bumping up... It could be interesting...
Image

Zaggy
Colonel
Posts: 380
Joined: 2001-07-09 22:01:01
Location: AU

Post by Zaggy » 2007-04-13 18:27:57

Ummm, OK, its late where i am, but i noticed this... I can instantly see two ways to do this, both using in built libraries...

The first is PHP? It has some very handy functions and libraries for manipulation of images... This is a fairly simple extract of some code from a gallery uploader, that resizes images... ( I was playing with this code the other day so it jumped to mind instantly)...

Code: Select all

// Let's get the original image size
                                
$size = GetImageSize( $images_dir."/".$filename );

// First Create Thumbnail!
// Thumbnail Settings
        $Config_tbwidth_wide = 150; // width of wide image
        $Config_tbheight_wide = 125; // height of wide image

        $Config_tbwidth_tall = 125; // width of tall image
        $Config_tbheight_tall = 150; // height of tall image

// The Code
        if($size[0] > $size[1]){
            $thumbnail_width = $Config_tbwidth_wide;
            $thumbnail_height = (int)($Config_tbwidth_wide * $size[1] / $size[0]);

            if($thumbnail_height > $Config_tbheight_wide){
                $thumbnail_height = $Config_tbheight_wide;
                $thumbnail_width = (int)($Config_tbheight_wide * $size[0] / $size[1]);
            }
        }else{
            $thumbnail_width = (int)($Config_tbheight_tall * $size[0] / $size[1]);
            $thumbnail_height = $Config_tbheight_tall;

            if($thumbnail_width > $Config_tbwidth_tall){
                $thumbnail_width = $Config_tbwidth_tall;
                $thumbnail_height = (int)($Config_tbwidth_tall * $size[1] / $size[0]);
            }
        }

// Build Thumbnail with GD 2.x.x, you can use the other described methods too
$function_suffix = $gd_function_suffix[$filetype];
$function_to_read = "ImageCreateFrom".$function_suffix;
$function_to_write = "Image".$function_suffix;

// Read the source file
$source_handle = $function_to_read ( $images_dir."/".$filename );

if($source_handle){
// Let's create a blank image for the thumbnail
$destination_handle = ImageCreateTrueColor ( $thumbnail_width, $thumbnail_height );

// Now we resize it
ImageCopyResampled( $destination_handle, $source_handle, 0, 0, 0, 0, $thumbnail_width, $thumbnail_height, $size[0], $size[1] );
}

// Let's save the thumbnail
$function_to_write( $destination_handle, $images_dir."/tb_".$filename, 100 );
ImageDestroy($destination_handle );
As you can see, the above code is for rectangular images, in portrait or landscape... Simplifying the code for SQUARE would be fairly easy... Then all you need to do is write an interface for it... You'd of course need a webserver and php installed on your local machine...

Now the other method, and probably BETTER is to use C# (or C# Express Edition if you want the FREE version ;) ), and go read this article --> http://www.codeproject.com/csharp/imageresize.asp

You need to know NOTHING more than what is in that article really. And now that I've scanned through the article, i think the C# version is the way to go. The code is more flexible and the options more powerful...

Go write some C# mate!
Daniel "Zaggy" Bell
Old-School, Grumpy and Anti-Social
Also to be found lurking round FighterOps

Return to “Terrain / Theater”

Who is online

Users browsing this forum: ClaudeBot [Bot] and 1 guest