L Li zhaoyang Unregistered / Unconfirmed GUEST, unregistred user! 1999-11-08 #1 我在开发程序时,想使用Jpeg图片代替Bmp图,如何使用,请各位大侠赐教.
C cytown Unregistered / Unconfirmed GUEST, unregistred user! 1999-11-08 #2 呵呵, 首先要uses jpeg; 然后要增加变量tjpegimage和tbitmap, 然后用tbitmap.picuture.assign(jpegimage1) 来把jpeg转换成bitmap, 就可以正常显示了. 不过注意, 如果jpeg没有大量应用的话, 还是用bitmap吧, 因为uses jpeg就要增加 程序尺寸2xK呢, 得不偿失
呵呵, 首先要uses jpeg; 然后要增加变量tjpegimage和tbitmap, 然后用tbitmap.picuture.assign(jpegimage1) 来把jpeg转换成bitmap, 就可以正常显示了. 不过注意, 如果jpeg没有大量应用的话, 还是用bitmap吧, 因为uses jpeg就要增加 程序尺寸2xK呢, 得不偿失
L Liu JZX Unregistered / Unconfirmed GUEST, unregistred user! 1999-11-08 #5 var Jpeg1: TJpegImage; Stream: TMemoryStream; begin bitmap := Tbitmap.Create (self); try bitmap.loadformfile('lll.bmp'); Jpeg1 := TJpegImage.Create; try Jpeg1.CompressionQuality := 50; Jpeg1.Assign(bitmap); Stream := TMemoryStream.Create; try Jpeg1.SaveToStream (Stream); Stream.Position := 0; Response.ContentStream := Stream; Response.ContentType := 'image/jpeg'; Response.SendResponse; finally Stream.Free; end; finally Jpeg1.Free; end; finally Image.Free; end; end;
var Jpeg1: TJpegImage; Stream: TMemoryStream; begin bitmap := Tbitmap.Create (self); try bitmap.loadformfile('lll.bmp'); Jpeg1 := TJpegImage.Create; try Jpeg1.CompressionQuality := 50; Jpeg1.Assign(bitmap); Stream := TMemoryStream.Create; try Jpeg1.SaveToStream (Stream); Stream.Position := 0; Response.ContentStream := Stream; Response.ContentType := 'image/jpeg'; Response.SendResponse; finally Stream.Free; end; finally Jpeg1.Free; end; finally Image.Free; end; end;
C cAkk Unregistered / Unconfirmed GUEST, unregistred user! 1999-11-08 #6 Schiesser说的对,你不是要在splash中使用吗? 直接用TImage就可以了.
L Liu JZX Unregistered / Unconfirmed GUEST, unregistred user! 1999-11-08 #8 使用下面的方法 var Jpeg1: TJpegImage; begin Jpeg1 := TJpegImage.Create; Jpeg1.CompressionQuality := 50; jpeg1.LoadFromFile('d:/graphci/jpg/3v801.jpg'); image1.Picture.Graphic:=jpeg1; end;
使用下面的方法 var Jpeg1: TJpegImage; begin Jpeg1 := TJpegImage.Create; Jpeg1.CompressionQuality := 50; jpeg1.LoadFromFile('d:/graphci/jpg/3v801.jpg'); image1.Picture.Graphic:=jpeg1; end;
C cytown Unregistered / Unconfirmed GUEST, unregistred user! 1999-11-08 #11 呵呵, 如果是background使用的话, 当然不能用timage了. 而且程序更大了:-(