高分求助图像处理的1个问题,高手请进,来者有分!急,急,急!在线等待!

kaolaxiong 2003-07-18 08:54:10
我对图像编程不懂,想实现以下功能:

有1个BMP或JPG文件,我需要改变图片的尺寸(放大或缩小),要保证图片质量,可以拉伸。最后要把放大或缩小的图片保存

请问各位大虾,怎么做

分不是问题,可以增加
...全文
152 15 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
15 条回复
切换为时间正序
请发表友善的回复…
发表回复
baguli 2003-07-23
  • 打赏
  • 举报
回复
不知道你收到没有?
kaolaxiong 2003-07-23
  • 打赏
  • 举报
回复
我在开1贴,欢迎来讨论
kaolaxiong 2003-07-21
  • 打赏
  • 举报
回复
楼上,发到我的邮箱吧: a9b8c7d6@163.net
先谢了
baguli 2003-07-21
  • 打赏
  • 举报
回复
我从网上下载了一些图形处理的组件,别说平滑缩放,就是Alpha等都能实现,需要的话可以Q我或Mail To Me.
kaolaxiong 2003-07-21
  • 打赏
  • 举报
回复
其实分辨率(dpi)就是
象素数/实际的英寸数,象素数可以得到,就是weight或height,
可是实际的英寸数怎么得到呢
photoshop中可以任意指定图片的宽度、高度(象素数),
并且可以任意指定分辨率,不知道怎么实现的,只是保存后的文件大小会受到影响
cnssk 2003-07-21
  • 打赏
  • 举报
回复
这个我也不太清楚!!
kaolaxiong 2003-07-21
  • 打赏
  • 举报
回复
to cnssk(小柯) :
image中的图片保存后分辨率还是72dpi
真晕

kaolaxiong 2003-07-21
  • 打赏
  • 举报
回复
用这个函数大小是可以变化,可缩小后很模糊
不知道有没有设置图片分辨率的办法
firetoucher 2003-07-21
  • 打赏
  • 举报
回复
用api函数StretchBlt 也可以
The StretchBlt function copies a bitmap from a source rectangle into a destination rectangle, stretching or compressing the bitmap to fit the dimensions of the destination rectangle, if necessary. The system stretches or compresses the bitmap according to the stretching mode currently set in the destination device context.

BOOL StretchBlt(
HDC hdcDest, // handle to destination DC
int nXOriginDest, // x-coord of destination upper-left corner
int nYOriginDest, // y-coord of destination upper-left corner
int nWidthDest, // width of destination rectangle
int nHeightDest, // height of destination rectangle
HDC hdcSrc, // handle to source DC
int nXOriginSrc, // x-coord of source upper-left corner
int nYOriginSrc, // y-coord of source upper-left corner
int nWidthSrc, // width of source rectangle
int nHeightSrc, // height of source rectangle
DWORD dwRop // raster operation code
);
cnssk 2003-07-21
  • 打赏
  • 举报
回复
Image中的图片才是你缩小后的图片你为什么要保存mybmp呢
kaolaxiong 2003-07-21
  • 打赏
  • 举报
回复
Image1.Canvas.StretchDraw(Rect(0,0,300,200),MyBmp
错了,是
Image1.Canvas.StretchDraw(Rect(0,0,800,600),MyBmp
kaolaxiong 2003-07-21
  • 打赏
  • 举报
回复
不知道为什么我只要改变了图片的大小,图片的分辨率由150象素/英寸了
就变为72象素/英寸了
不知道那错了
我的代码:

Try
MyBmp:=TBitmap.Create;
MyBmp.PixelFormat:=pf24Bit;
Mybmp.loadfromfile('c:\1.bmp');
Image1.Canvas.StretchDraw(Rect(0,0,300,200),MyBmp);
Mybmp.width := 800;
MyBmp.Height := 600;
MyBmp.Savetofile('d:\2.bmp');
Finally
MyBmp.Free;
End;
kaolaxiong 2003-07-21
  • 打赏
  • 举报
回复
BT的用户,要让用厘米表示图片的宽度和高度,真TMD晕
cnssk 2003-07-18
  • 打赏
  • 举报
回复
要定义变量
Var
Mybmp:Tbitmap;
cnssk 2003-07-18
  • 打赏
  • 举报
回复
Try
MyBmp:=TBitmap.Create;
MyBmp.PixelFormat:=pf24Bit;
Mybmp.loadfromfile('c:\1.bmp');
Image1.Canvas.StretchDraw(Rect(0,0,300,200),MyBmp);
Finally
MyBmp.Free;
End;
300,200自己随便定

1,185

社区成员

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

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