Map Database  •  FAQ  •  RSS  •  Register  •  Login

Export team color images

<<

paapie

Serf

Posts: 7

Joined: 02 Sep 2014, 13:21

KaM Skill Level: Average

Post 02 Sep 2014, 13:25

Export team color images

Hi people!

I'm new to the Knight and Merchants forum. I have a little question about exporting images.
How can I change the images with another color as red. So I want for example to export units in yellow or blue.
Some can help? I want to make some simple animations :lol:

Greetings Frank
<<

Krom

User avatar

Knights Province Developer

Posts: 3237

Joined: 09 May 2006, 22:00

Location: Russia

KaM Skill Level: Fair

Post 02 Sep 2014, 13:31

Re: Export team color images

Are you exporting from original KaM or from KaM Remake ? Do you know about programming in Pascal/Delphi?
Knights Province at: http://www.knightsprovince.com
KaM Remake at: http://www.kamremake.com
Original MBWR/WR2/AFC/FVR tools at: http://krom.reveur.de
<<

paapie

Serf

Posts: 7

Joined: 02 Sep 2014, 13:21

KaM Skill Level: Average

Post 02 Sep 2014, 13:45

Re: Export team color images

I can program in Pascal :D but how can I export the images than? The orginal KaM...
<<

Krom

User avatar

Knights Province Developer

Posts: 3237

Joined: 09 May 2006, 22:00

Location: Russia

KaM Skill Level: Fair

Post 02 Sep 2014, 15:12

Re: Export team color images

You can export graphics from original KaM and write a small Pascal tool to replace Reds with other colors, there are just 7 of them ;)
Knights Province at: http://www.knightsprovince.com
KaM Remake at: http://www.kamremake.com
Original MBWR/WR2/AFC/FVR tools at: http://krom.reveur.de
<<

paapie

Serf

Posts: 7

Joined: 02 Sep 2014, 13:21

KaM Skill Level: Average

Post 03 Sep 2014, 09:21

Re: Export team color images

Hmm do you have an example source code I know a little bit of Pascal ( know the basics).

Greetz
<<

Krom

User avatar

Knights Province Developer

Posts: 3237

Joined: 09 May 2006, 22:00

Location: Russia

KaM Skill Level: Fair

Post 03 Sep 2014, 10:53

Re: Export team color images

You need to load the BMP and work with its pixels, detecting certain reds and replacing them with other colors.

Your code will go along the lines of:

  Code:
bmp := TBitmap.Create
bmp.LoadFromFile
for width for height do
begin
  if bmp.Canvas[x,y] = red_dark then
    bmp.Canvas[x,y] := blue_dark;
  ..
  if bmp.Canvas[x,y] = red_light then
    bmp.Canvas[x,y] := blue_light;
end;
bmp.SaveToFile
Knights Province at: http://www.knightsprovince.com
KaM Remake at: http://www.kamremake.com
Original MBWR/WR2/AFC/FVR tools at: http://krom.reveur.de
<<

paapie

Serf

Posts: 7

Joined: 02 Sep 2014, 13:21

KaM Skill Level: Average

Post 03 Sep 2014, 11:07

Re: Export team color images

Thanks krom!

But red_darker and blue_darker has to be in RGB colors?
<<

Krom

User avatar

Knights Province Developer

Posts: 3237

Joined: 09 May 2006, 22:00

Location: Russia

KaM Skill Level: Fair

Post 03 Sep 2014, 11:12

Re: Export team color images

Yes, alike $122178 - dark red

this will compare only RGB portion of it: if (bmp.Canvas[x,y] and $FFFFFF = $212298) then

You will have to lookup exact values.
Knights Province at: http://www.knightsprovince.com
KaM Remake at: http://www.kamremake.com
Original MBWR/WR2/AFC/FVR tools at: http://krom.reveur.de
<<

paapie

Serf

Posts: 7

Joined: 02 Sep 2014, 13:21

KaM Skill Level: Average

Post 03 Sep 2014, 11:26

Re: Export team color images

Thanks for the quick reply krom.

This is my code now:
  Code:
var
  bmp: TBitmap;
begin
  bmp := TBitmap.Create;
  try
    bmp.LoadFromFile(file/to/path);
 
    for width for height do
   begin
      //DARK
      if (bmp.Canvas[x,y] and $FFFFFF = $212298) then
         bmp.Canvas[x,y] := $122178;
      ..
      //LIGHT
      if (bmp.Canvas[x,y] and $FFFFFF = $8788A3)then
         bmp.Canvas[x,y] := $000;
   end;
   
    bmp.SaveToFile(file/to/path);
  finally
    bmp.Free;
  end;
end;
<<

Krom

User avatar

Knights Province Developer

Posts: 3237

Joined: 09 May 2006, 22:00

Location: Russia

KaM Skill Level: Fair

Post 03 Sep 2014, 11:39

Re: Export team color images

  Code:
for width for height do


will be

  Code:
for y := 0 to bmp.Height - 1 do
for x := 0 to bmp.Width - 1 do
Knights Province at: http://www.knightsprovince.com
KaM Remake at: http://www.kamremake.com
Original MBWR/WR2/AFC/FVR tools at: http://krom.reveur.de
<<

paapie

Serf

Posts: 7

Joined: 02 Sep 2014, 13:21

KaM Skill Level: Average

Post 03 Sep 2014, 11:45

Re: Export team color images

Ok I will change the code, did you received my private message? What do you think about it?
<<

Krom

User avatar

Knights Province Developer

Posts: 3237

Joined: 09 May 2006, 22:00

Location: Russia

KaM Skill Level: Fair

Post 03 Sep 2014, 11:53

Re: Export team color images

No, I haven't received anything. You can use email
Knights Province at: http://www.knightsprovince.com
KaM Remake at: http://www.kamremake.com
Original MBWR/WR2/AFC/FVR tools at: http://krom.reveur.de
<<

paapie

Serf

Posts: 7

Joined: 02 Sep 2014, 13:21

KaM Skill Level: Average

Post 03 Sep 2014, 12:11

Re: Export team color images

Ok, I have sent you an email what do you think about it?

Return to Other Creations

Who is online

Users browsing this forum: No registered users and 2 guests