TPNGImage 1.5

时间:2012-10-08 04:44:51
【文件属性】:

文件名称:TPNGImage 1.5

文件大小:284KB

文件格式:ZIP

更新时间:2012-10-08 04:44:51

delphi

procedure BitmapFileToPNG(const Source, Dest: String); var Bitmap: TBitmap; PNG: TPNGObject; begin Bitmap := TBitmap.Create; PNG := TPNGObject.Create; {In case something goes wrong, free booth Bitmap and PNG} try Bitmap.LoadFromFile(Source); PNG.Assign(Bitmap); //Convert data into png PNG.SaveToFile(Dest); finally Bitmap.Free; PNG.Free; end end; Converting from PNG file to Windows bitmap file The above inverse. Loads a png and saves into a bitmap procedure PNGFileToBitmap(const Source, Dest: String); var Bitmap: TBitmap; PNG: TPNGObject; begin PNG := TPNGObject.Create; Bitmap := TBitmap.Create; {In case something goes wrong, free booth PNG and Bitmap} try PNG.LoadFromFile(Source); Bitmap.Assign(PNG); //Convert data into bitmap Bitmap.SaveToFile(Dest); finally PNG.Free; Bitmap.Free; end end; Converting from TImage to PNG file This method converts from TImage to PNG. It has full exception handling and allows converting from file formats other than TBitmap (since they allow assigning to a TBitmap) procedure TImageToPNG(Source: TImage; const Dest: String); var PNG: TPNGObject; BMP: TBitmap; begin PNG := TPNGObject.Create; {In case something goes wrong, free PNG} try //If the TImage contains a TBitmap, just assign from it if Source.Picture.Graphic is TBitmap then PNG.Assign(TBitmap(Source.Picture.Graphic)) //Convert bitmap data into png else begin //Otherwise try to assign first to a TBimap BMP := TBitmap.Create; try BMP.Assign(Source.Picture.Graphic); PNG.Assign(BMP); finally BMP.Free; end; end; //Save to PNG format PNG.SaveToFile(Dest); finally PNG.Free; end end;


【文件预览】:
obj
----infutil.obj(1KB)
----infblock.obj(5KB)
----infcodes.obj(4KB)
----adler32.obj(602B)
----inflate.obj(3KB)
----inffast.obj(2KB)
----trees.obj(11KB)
----deflate.obj(7KB)
----inftrees.obj(8KB)
pnglang.pas
pngimage15.gif
pngextra.pas
pngimage.pas
pngzlib.pas
pngimage.chm
2ccc.com.nfo

网友评论

  • 很不错的一个控件,用起来还不错。
  • 不错,挺好用的,作者功底不错
  • 打印PNG透明图像时是黑色的
  • 不错,可以用!谢谢
  • 用了快一年了,不错的控件!