jpg图片添加文字???

jinzihan_005 2005-08-08 10:13:18
我的程序在image中已经加载了一幅jpg图片,现在我想在它的上面添加文字,并且保存下来,形成一张jpg图片(就是图片上必须有添加的文字),应该怎么做???
...全文
613 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
xaocao 2005-08-11
  • 打赏
  • 举报
回复
pengxuan(网虫先生) 所言是也!
pengxuan 2005-08-08
  • 打赏
  • 举报
回复
unit Unit1;

interface

uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, jpeg, ExtCtrls;

type
TForm1 = class(TForm)
Button1: TButton;
Image1: TImage;
Image2: TImage;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;

var
Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.Button1Click(Sender: TObject);
var
jpg :TJpegImage;
bmp :TBitMap;
begin
jpg := TJpegImage.Create;
bmp := TBitMap.Create;
jpg.Assign(image1.Picture);
bmp.Assign(jpg);
bmp.Canvas.Brush.Style := bsClear;
bmp.Canvas.Font.Color := clRed;
bmp.Canvas.Font.Size := 20;
bmp.Canvas.Font.Name:='宋体';
bmp.Canvas.Font.Size:=9;
bmp.Canvas.TextOut((bmp.Width div 2 - 30),(bmp.Height - 60),'测试写字');
image2.Picture.Bitmap.Assign(bmp);
jpg.Assign(bmp);
jpg.SaveToFile('e:\aa.jpg');
jpg.Free;
bmp.Free;
end;

end.
ly_liuyang 2005-08-08
  • 打赏
  • 举报
回复
转换到BMP,然后Canvas的TextOut输出,最后再保存为JPG的

_____________________
http://lysoft.7u7.net
2312 2005-08-08
  • 打赏
  • 举报
回复
把JPG文件转成bmp格式的加载到image中,添加完文字后保存为jpg的文件,这样可以不?

1,183

社区成员

发帖
与我相关
我的任务
社区描述
Delphi GAME,图形处理/多媒体
社区管理员
  • GAME,图形处理/多媒体社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧