Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to add a picture frame and insert the text in the image?

This is what I need: Program for quicker making fun posters for facebook page. Posters have text, picture and frame (white line and black background). In this case, I want to insert logo on poster (png image).

Depending on picture size, dimensions of frame (who in this case consits of two shapes) must automaticly be resized for picture.

enter image description here

How to save poster from that image from link (2 shape components, 2 image components, 2 labels) as picture?

How to accomplish this? What to use, where to begin?

I hope that this question will not be removed.

like image 794
Canis Lupus Avatar asked Nov 05 '12 18:11

Canis Lupus


People also ask

How do you insert a frame in Word?

Go to Design > Page Borders. In the Borders and Shading box, design your border: Under Setting on the left, choose the border style you want. If you want to remove a border, select None.

How do I insert a picture into a text box and wrap the text around it in Word?

Position a picture in the upper-left corner of a document You can add a picture in the top left corner of a document and have the text flow around it. Select a picture. Go to Picture Format or Format > Position, and under Format with Text Wrapping, select Top Left.


1 Answers

If you put all the frames, shapes and pictures inside a new TPanel (named MainPanel in my sample), then you could use:

procedure savePanelAsImage(fpPanel: tPanel; fpFileName: string);
var
   img: TBitmap;
begin
   img := TBitmap.Create;
   try
     img.Width := fpPanel.Width;
     img.Height := fpPanel.Height;
     fpPanel.PaintTo(img.Canvas, 0, 0);
     img.SaveToFile(fpFileName);
   finally
     img.Free;
   end
end;

Usage:

savePanelAsImage(MainPanel, 'd:\someFolder\image001.bmp');

Notes:

  • This is VCL based sample;
  • To save the image in other format (rather in BMP) use: TPngImage (Vcl.Imaging.pngImage) or TJPEGImage (Vcl.Imaging.jpeg);
  • If you use FireMonkey (>= Delphi XE2) you can take advantage of someParentComponent.MakeScreenShot();
  • The resulting image will have the same size as the tPanel.

For better results / flexibility I would suggest using Graphics32 library for Delphi (it supports layers, image re-sizing etc.).

Example form

Resulting image

like image 89
iPath ツ Avatar answered Sep 20 '22 20:09

iPath ツ