handling CMYK jpeg files in Delphi 7

前端 未结 5 1496
北恋
北恋 2021-01-24 01:29

I am trying to access files that are stored as Jpeg files, is there an easy way to display these image files without performance loss ?

5条回答
  •  一个人的身影
    2021-01-24 02:17

    You can load the JPeg file using an instance of TJPEGImage and then assign it to a TBitmap to display. You find TJPEGImage in unit jpeg.

    jpeg := TJPEGImage.Create;
    jpeg.LoadFromFile('filename.jpg');
    bitm := TBitmap.Create;
    bitm.Assign(jpeg); 
    
    Image1.Height := bitm.Height;
    Image1.Width := bitm.Width;
    Image1.Canvas.Draw(0, 0, bitm);
    

    Alternatively, this should also work:

    bitm := TBitmap.Create;
    bitm.Assign('filename.jpg'); 
    
    Image1.Height := bitm.Height;
    Image1.Width := bitm.Width;
    Image1.Canvas.Draw(0, 0, bitm);
    

提交回复
热议问题