溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊(cè)×
其他方式登錄
點(diǎn)擊 登錄注冊(cè) 即表示同意《億速云用戶服務(wù)條款》

如何直接從代碼中保存BPM / JPEG / TIFF / GIF

發(fā)布時(shí)間:2021-12-20 09:28:50 來源:億速云 閱讀:196 作者:柒染 欄目:大數(shù)據(jù)

本篇文章給大家分享的是有關(guān)如何直接從代碼中保存BPM / JPEG / TIFF / GIF,小編覺得挺實(shí)用的,因此分享給大家學(xué)習(xí),希望大家閱讀完這篇文章后可以有所收獲,話不多說,跟著小編一起來看看吧。

報(bào)表生成器FastReport VCL是用于在軟件中集成商務(wù)智能的現(xiàn)代解決方案。它提供了可視化模板設(shè)計(jì)器,可以訪問最受歡迎的數(shù)據(jù)源,報(bào)告引擎,預(yù)覽,將過濾器導(dǎo)出為30多種格式,并可以部署到云,Web,電子郵件和打印中。

我們先來看看有哪些光柵圖像格式。

BMP

首先,你應(yīng)該知道,由于BMP是一個(gè)老的圖像格式,它不是很流行的互聯(lián)網(wǎng)用戶,只有位圖圖像保存在這種格式不支持向量。

bmp文件的大小可能不同,這取決于圖像的質(zhì)量。盡管用戶認(rèn)為BMP格式已經(jīng)過時(shí),但它在許多領(lǐng)域都被積極地使用。例如,所有的Windows界面都基于這種格式。為什么BMP呢?因?yàn)樗欠奖闶褂脮r(shí),創(chuàng)建圖像,不失去質(zhì)量后,編輯他們。BMP是Photoshop中編輯圖片時(shí)經(jīng)常使用的格式,這種格式也很容易上傳到社交網(wǎng)絡(luò)和各種網(wǎng)站上。

當(dāng)然,最好使用現(xiàn)代的圖像格式,因?yàn)樗鼈兪嵌鄬哟蔚?,而且您可以將它們上傳到任何網(wǎng)站而不存在技術(shù)問題。同時(shí),有許多選項(xiàng)來編輯這些圖像,它們有一個(gè)較小的文件大小。

JPEG

JPEG是存儲(chǔ)圖像的常用格式。它具有良好的壓縮質(zhì)量,可以觀看圖片。這種格式有很多好處,因?yàn)橛脩艟哂性S多優(yōu)點(diǎn),例如:更改文件質(zhì)量和大小的能力,在任何瀏覽器中輕松打開圖像,在任何圖形編輯器中編輯該文件以及較小的尺寸,在計(jì)算機(jī)和其他數(shù)據(jù)存儲(chǔ)設(shè)備上不會(huì)占用太多空間。如果壓縮不多,將完全保存圖像質(zhì)量。

這種格式有幾個(gè)缺點(diǎn):與PNG不同,沒有透明度;如果壓縮(調(diào)整大?。㎎PG圖像,則其失真(或完全丟失)將非常明顯;不建議在壓縮后編輯恢復(fù)的JPG文件,因?yàn)樗赡軙?huì)降低質(zhì)量。

盡管存在這些缺點(diǎn),但該格式仍被認(rèn)為是Internet上最受歡迎的格式,并且人們經(jīng)常使用它。

TIFF

這是一種眾所周知的柵格格式,幾乎支持所有已知的色彩空間。未經(jīng)壓縮的圖像幾乎已成為印刷行業(yè)的標(biāo)準(zhǔn)。有多種壓縮算法,甚至有或沒有損失。TIFF文件可以包含以索引顏色模式以及灰度存儲(chǔ)在CMYK,RGB,Lab顏色模型中的圖像。這允許使用這種格式來存儲(chǔ)各種圖像,用于準(zhǔn)備Web圖形和版式。除圖像本身外,TIFF還包含透明通道,通過它們可以保存圖像的透明區(qū)域或在工作會(huì)話之間突出顯示對(duì)象。

TIFF格式的另一個(gè)功能是能夠?qū)⒍鄠€(gè)具有各自屬性和屬性(標(biāo)簽)的圖像保存在一個(gè)文件中。盡管TIFF沒有創(chuàng)建動(dòng)畫圖像的功能,但這使其類似于GIF。這種格式的普及使得在程序和硬件平臺(tái)之間輕松傳輸圖像成為可能。

GIF

GIF文件尺寸較小,并且支持簡單的動(dòng)畫,即在一個(gè)文件中更改幀。

GIF格式廣泛用于創(chuàng)建橫幅以及視頻內(nèi)容的圖形外殼。主要優(yōu)點(diǎn)是數(shù)據(jù)壓縮在多達(dá)256色的深度處不會(huì)明顯損失質(zhì)量。動(dòng)畫圖像包括許多靜態(tài)幀以及有關(guān)幀演示所需時(shí)間的數(shù)據(jù)。

人們?cè)谠S多領(lǐng)域中使用GIF格式。例如,在其網(wǎng)站的設(shè)計(jì)中,在社交網(wǎng)絡(luò)上以廣告標(biāo)語,用于存儲(chǔ)照片等形式在撰寫文章或書籍時(shí)進(jìn)行網(wǎng)頁設(shè)計(jì),圖形設(shè)計(jì)。使用這種格式,您可以減小圖像的大小,這會(huì)積極影響Internet網(wǎng)站頁面的加載速度。

SVG

這種格式是矢量。簡而言之,網(wǎng)站是在其幫助下進(jìn)行編譯的。SVG是帶有標(biāo)簽的XML文本文件??s放和裁剪時(shí),這種格式不會(huì)丟失圖像質(zhì)量

現(xiàn)在我們知道什么時(shí)候使用哪種格式更好。

如何從Delphi / Lazarus應(yīng)用程序?qū)С鰹檫@些格式?

首先,我們必須創(chuàng)建一個(gè)文檔。

然后,在我們創(chuàng)建了想要變成插圖的對(duì)象之后,啟動(dòng)并查看。

在預(yù)覽窗口中,我們選擇保存報(bào)告的格式。 例如,我們需要導(dǎo)出到BMP圖像。選擇并單擊。

如何直接從代碼中保存BPM / JPEG / TIFF / GIF

將出現(xiàn)導(dǎo)出設(shè)置窗口。配置并保存。

如何直接從代碼中保存BPM / JPEG / TIFF / GIF

如何直接從Delphi / C ++ Builder / Lazarus代碼中保存BPM / JPEG / TIFF / GIF?

保存為BMP

procedure TForm1.Button1Click(Sender: TObject);
begin
 {Generate a report. The report must be generated before exporting}
 frxReport1.PrepareReport();
 {Set the range of pages to export. By default, all pages of the generated report are exported}
 frxBMPExport1.PageNumbers := '2-3';
 {Set whether to export each page to a separate file.}
 {.N will be added to the file name, where N is the serial number of the page}
 frxBMPExport1.SeparateFiles := True;
 {Set whether to export to monochrome image}
 frxBMPExport1.Monochrome := False;
 {Set whether to crop empty edges (page margins)}
 frxBMPExport1.CropImages := False;
 {Set the resolution, DPI}
 frxBMPExport1.Resolution := 96;
 {Set whether to open the resulting file after export}
 frxBMPExport1.OpenAfterExport := False;
 {Set whether to display export progress (show which page is currently being exported)}
 frxBMPExport1.ShowProgress := False;
 {Set whether to display the export filter dialog box}
 frxBMPExport1.ShowDialog := False;
 {Set the name of the resulting file.}
 {Please note that if you do not set the file name and disable the export filter dialog box,}
 {the file name selection dialog will still be displayed}
 frxBMPExport1.FileName := 'C:\Output\test.bmp';
 {Export the report}
 frxReport1.Export(frxBMPExport1);
end;

保存為JPEG

procedure TForm1.Button2Click(Sender: TObject);
begin
 {Generate a report. The report must be generated before exporting}
 frxReport1.PrepareReport();
 {Set the range of pages to export. By default, all pages of the generated report are exported}
 frxJPEGExport1.PageNumbers := '2-3';
 {Set whether to export each page to a separate file.}
 {.N will be added to the file name, where N is the serial number of the page}
 frxJPEGExport1.SeparateFiles := True;
 {Set whether to export to monochrome image}
 frxJPEGExport1.Monochrome := False;
 {Set whether to crop empty edges (page margins)}
 frxJPEGExport1.CropImages := False;
 {Set the quality of JPEG}
 frxJPEGExport1.JPEGQuality := 90;
 {Set the resolution, DPI}
 frxJPEGExport1.Resolution := 96;
 {Set whether to open the resulting file after export}
 frxJPEGExport1.OpenAfterExport := False;
 {Set whether to display export progress (show which page is currently being exported)}
 frxJPEGExport1.ShowProgress := False;
 {Set whether to display the export filter dialog box}
 frxJPEGExport1.ShowDialog := False;
 {Set the name of the resulting file.}
 {Please note that if you do not set the file name and disable the export filter dialog box,}
 {the file name selection dialog will still be displayed}
 frxJPEGExport1.FileName := 'C:\Output\test.jpg';
 {Export the report}
 frxReport1.Export(frxJPEGExport1);
end;

保存為TIFF

procedure TForm1.Button3Click(Sender: TObject);
begin
 {Generate a report. The report must be generated before exporting}
 frxReport1.PrepareReport();
 {Set the range of pages to export. By default, all pages of the generated report are exported}
 frxTIFFExport1.PageNumbers := '2-3';
 {Set whether to export each page to a separate file.}
 {.N will be added to the file name, where N is the serial number of the page}
 frxTIFFExport1.SeparateFiles := True;
 {Set whether to export to monochrome image}
 frxTIFFExport1.Monochrome := False;
 {Set whether to crop empty edges (page margins)}
 frxTIFFExport1.CropImages := False;
 {Set the resolution, DPI}
 frxTIFFExport1.Resolution := 96;
 {Set whether to open the resulting file after export}
 frxTIFFExport1.OpenAfterExport := False;
 {Set whether to display export progress (show which page is currently being exported)}
 frxTIFFExport1.ShowProgress := False;
 {Set whether to display the export filter dialog box}
 frxTIFFExport1.ShowDialog := False;
 {Set the name of the resulting file.}
 {Please note that if you do not set the file name and disable the export filter dialog box,}
 {the file name selection dialog will still be displayed}
 frxTIFFExport1.FileName := 'C:\Output\test.tif';
 {Export the report}
 frxReport1.Export(frxTIFFExport1);
end;

保存為GIF

procedure TForm1.Button4Click(Sender: TObject);
begin
 {Generate a report. The report must be generated before exporting}
 frxReport1.PrepareReport();
 {Set the range of pages to export. By default, all pages of the generated report are exported}
 frxGIFExport1.PageNumbers := '2-3';
 {Set whether to export each page to a separate file.}
 {.N will be added to the file name, where N is the serial number of the page}
 frxGIFExport1.SeparateFiles := True;
 {Set whether to export to monochrome image}
 frxGIFExport1.Monochrome := False;
 {Set whether to crop empty edges (page margins)}
 frxGIFExport1.CropImages := False;
 {Set the resolution, DPI}
 frxGIFExport1.Resolution := 96;
 {Set whether to open the resulting file after export}
 frxGIFExport1.OpenAfterExport := False;
 {Set whether to display export progress (show which page is currently being exported)}
 frxGIFExport1.ShowProgress := False;
 {Set whether to display the export filter dialog box}
 frxGIFExport1.ShowDialog := False;
 {Set the name of the resulting file.}
 {Please note that if you do not set the file name and disable the export filter dialog box,}
 {the file name selection dialog will still be displayed}
 frxGIFExport1.FileName := 'C:\Output\test.gif';
 {Export the report}
 frxReport1.Export(frxGIFExport1);
end;

以上就是如何直接從代碼中保存BPM / JPEG / TIFF / GIF,小編相信有部分知識(shí)點(diǎn)可能是我們?nèi)粘9ぷ鲿?huì)見到或用到的。希望你能通過這篇文章學(xué)到更多知識(shí)。更多詳情敬請(qǐng)關(guān)注億速云行業(yè)資訊頻道。

向AI問一下細(xì)節(jié)

免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如果涉及侵權(quán)請(qǐng)聯(lián)系站長郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。

AI