ST3VO
asked on
Save 2 TImages as 1 Image.
Hi all,
I've got 2 TImages.
Image1 loads an image on a Frame
Image2 load a Picture.
They are already positioned.
What I need to do need is the Save this 2 TImages as 1 Image.
How could I do this please?
THanks
ST3VO
I've got 2 TImages.
Image1 loads an image on a Frame
Image2 load a Picture.
They are already positioned.
What I need to do need is the Save this 2 TImages as 1 Image.
How could I do this please?
THanks
ST3VO
ASKER
TImage is a Delphi component to handle images.
I am using 2.
The frame is a PNG and the center images are JPG.
I am using 2.
The frame is a PNG and the center images are JPG.
You can do it like this
procedure TForm1.Button1Click(Sender : TObject);
var
bmp: TBitmap;
jpg: TJPegImage;
begin
bmp := TBitmap.Create;
jpg := TJPegImage.Create;
bmp.Assign(Image1.Picture. Graphic);
bmp.Canvas.Draw(10,10,Imag e2.Picture .Graphic);
bmp.SaveToFile('d:\test.bm p'); // save as bitmap
jpg.Assign(bmp);
jpg.SaveToFile('d:\test.jp g'); // save as jpg
jpg.Free;
bmp.Free;
end;
procedure TForm1.Button1Click(Sender
var
bmp: TBitmap;
jpg: TJPegImage;
begin
bmp := TBitmap.Create;
jpg := TJPegImage.Create;
bmp.Assign(Image1.Picture.
bmp.Canvas.Draw(10,10,Imag
bmp.SaveToFile('d:\test.bm
jpg.Assign(bmp);
jpg.SaveToFile('d:\test.jp
jpg.Free;
bmp.Free;
end;
ASKER
Hi mokule,
I'm looking at your code and it saves 2 files.
I have 2 TImages which I need to save as just 1 Image.
The 2 Images are already loaded into the TImages. I just need to Merge both and save them as Jpg.
Hope this helps!
Cheers :o)
ST3VO
I'm looking at your code and it saves 2 files.
I have 2 TImages which I need to save as just 1 Image.
The 2 Images are already loaded into the TImages. I just need to Merge both and save them as Jpg.
Hope this helps!
Cheers :o)
ST3VO
Read comments in program please.
It saves merged image but in to formats.
It saves merged image but in to formats.
you need to "compose" the images, the frame on top of the actual picture, right ?
ASKER
You're right mokule!
Sorry about that!
I just have a small problem with it.
Image1 - Contains the Frame and it's 256 Height x 512 Width.
Image2 - Contains the Picture which is a image the frame bit on top of Image1.
As they did'nt save in place with Canvas 10, 10, I changed it to the Height and Width of the Frame image and I can only see the framed image now and not both.
Any ideas why please?
Sorry about that!
I just have a small problem with it.
Image1 - Contains the Frame and it's 256 Height x 512 Width.
Image2 - Contains the Picture which is a image the frame bit on top of Image1.
As they did'nt save in place with Canvas 10, 10, I changed it to the Height and Width of the Frame image and I can only see the framed image now and not both.
Any ideas why please?
In my example the smaller image must be on top of bigger.
I've assumed a frame is rectangular and without transparency
ASKER
Update:
OK I changed the Canvas to 0,0 and it's now in position BUT the Frame image is been saved to it's original size and not the stretched size :o/
OK I changed the Canvas to 0,0 and it's now in position BUT the Frame image is been saved to it's original size and not the stretched size :o/
ASKER
Ref: I've assumed a frame is rectangular and without transparency
Yes It's rectangular but the Frame has transparency although I'm not too bothered about that. I just the the images to look as they do on the form before saving.
Yes It's rectangular but the Frame has transparency although I'm not too bothered about that. I just the the images to look as they do on the form before saving.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Perfect!!! Thanks a million :o)
Sorry if I'm being ignorant I've done a photo/picture editing and never herd of a Timage