I try to convert indexed TIM2 to full Color bitmap image with alpha channel.
I 1st create a full color table array(RGBA) by looking at the end of the color table. Then get the index and write to full color pixel eg: colorArray[index].
But the result are not correct? What did I doing wrong?
Important information: this site is currently scheduled to go offline indefinitely by end of the year.
How to convert Indexed TIM2 to Full Color
I'm glad to see someone trying to correct the mistakes that I had with that program. I really would like to see some apps come out for the game and graphics format. This information should tell you all that you need to know about the tim2 file format. Look in the tim2.h for the header specs.
You do not have the required permissions to view the files attached to this post.
I think that bmp has no standart support for 32bits bitmaps, only if you make your own version of bmp supporting it. I suposse that u know that converting 8bit image indexed with 32bit RGBA palette to 32bit RGBA image without palette, size will become four times greater, lossing the advantatge that image only use 256 colors.
If you only want visualice it well interlaced you can use XnView, Game Grafics Studio or Optix Image Studio for example, and export to the format you want to edit. Also there are batch converters for tim2.
But if you want to draw the texture in your own aplicattion you have to interlace the palette before calculate colorArray[index], this way:
divide the palette in blocks of 8 RGBA colors, and for every 4 blocks swap it
1 3
2 4
or what is the same, for every 32 RGBA colors swap
0, 1, 2, 3, 4, 5, 6, 7, 16, 17, 18, 19, 20, 21, 22, 23,
8, 9, 10, 11, 12, 13, 14, 15, 24, 25, 26, 27, 28, 29, 30, 31
If you only want visualice it well interlaced you can use XnView, Game Grafics Studio or Optix Image Studio for example, and export to the format you want to edit. Also there are batch converters for tim2.
But if you want to draw the texture in your own aplicattion you have to interlace the palette before calculate colorArray[index], this way:
divide the palette in blocks of 8 RGBA colors, and for every 4 blocks swap it
1 3
2 4
or what is the same, for every 32 RGBA colors swap
0, 1, 2, 3, 4, 5, 6, 7, 16, 17, 18, 19, 20, 21, 22, 23,
8, 9, 10, 11, 12, 13, 14, 15, 24, 25, 26, 27, 28, 29, 30, 31
-
- mega-veteran
- Posts: 315
- Joined: Wed Aug 02, 2006 10:07 pm
- Has thanked: 10 times
- Been thanked: 94 times
PmData, the files are 8bits RGBA indexed with only have 1 palette, the correct images above are from photoshop, it works for standard TIM2 but can't export!
And for the interlace stuff, I am really confused!
Is it like this:
for 8bits RGBA of 256 color palette, 256/8=32, so each block have 32 RGBA color?
for the palette samples here (start at 10040).
block[0,0]=color 01 01 01 80, block[0,1]=color 17 05 02 80
block[1,0]=color 05 08 0E 80, block[1,1]=color 1A 04 01 80
block[0,2]=color 04 0C 17 80, block[0,3]=color 29 00 10 80
block[1,2]=color 22 03 01 80, block[1,3]=color 10 10 11 80
block[0,4]=color 3B 04 04 80, block[0,5]=color 10 17 21 80
block[1,4]=color 10 16 1E 80, block[1,5]=color 3C 04 0E 80
..
now lookup:
colorAry[4] = block[0,4] = color 3B 04 04 80
colorAry[33] = block[1,2] = color 22 03 01 80
Am I correct?
And for the interlace stuff, I am really confused!
Is it like this:
for 8bits RGBA of 256 color palette, 256/8=32, so each block have 32 RGBA color?
for the palette samples here (start at 10040).
block[0,0]=color 01 01 01 80, block[0,1]=color 17 05 02 80
block[1,0]=color 05 08 0E 80, block[1,1]=color 1A 04 01 80
block[0,2]=color 04 0C 17 80, block[0,3]=color 29 00 10 80
block[1,2]=color 22 03 01 80, block[1,3]=color 10 10 11 80
block[0,4]=color 3B 04 04 80, block[0,5]=color 10 17 21 80
block[1,4]=color 10 16 1E 80, block[1,5]=color 3C 04 0E 80
..
now lookup:
colorAry[4] = block[0,4] = color 3B 04 04 80
colorAry[33] = block[1,2] = color 22 03 01 80
Am I correct?
You do not have the required permissions to view the files attached to this post.
Excuse my bad english xD
each block has 8 RGBA colors, then you have 32 blocks for the 256 color palette. Swap block 2 with 3, 6 with 7, and so..
then apply colorArray[index], and thats all. I think it will help you ; )
each block has 8 RGBA colors, then you have 32 blocks for the 256 color palette. Swap block 2 with 3, 6 with 7, and so..
then apply colorArray[index], and thats all. I think it will help you ; )
You do not have the required permissions to view the files attached to this post.
- Evin
- ultra-veteran
- Posts: 348
- Joined: Sat Aug 05, 2006 2:04 pm
- Location: Hungary
- Has thanked: 2 times
- Been thanked: 160 times
- Contact:
Tim2 - Jasmine's plugin, cant' correct handle the alpha channel(if i modify the tim2 image, that is modify the alpha channel)fatduck wrote:I don't think there is a ready-made tool out yets! That's what I start my own! It's not hard to convert indexed color to full color(I finally managed), but the other way round is difficult for a beginner like me!
And what's the different between tim2 and tim2x plugin!
tim2x - this can not handle the alpha channel, but i can choose many settings by saving (mipmap, 4-32bit format, swizzle and more coding format) I think this is an official plugin, because in the setting window, i see a "Sony" text. But this plugin is created in 2001.
You do not have the required permissions to view the files attached to this post.
-
- advanced
- Posts: 59
- Joined: Tue Aug 10, 2010 2:09 pm
- Been thanked: 1 time
Re: How to convert Indexed TIM2 to Full Color
can anyone help me? i used this swapping trick but i still get errors like so:
You do not have the required permissions to view the files attached to this post.
-
- veteran
- Posts: 153
- Joined: Sat Feb 21, 2009 2:29 pm
- Has thanked: 19 times
- Been thanked: 43 times
Re: How to convert Indexed TIM2 to Full Color
this may be a premultiplied rgb+a texture , first you need to extract the alpha chanel and rebuild the rgb colors then get the alpha mash to get a valid one...
_-=<(¯`·._.·[ CodeMan ]·._.·´¯)>=-_
-
- advanced
- Posts: 59
- Joined: Tue Aug 10, 2010 2:09 pm
- Been thanked: 1 time