全國最多中醫師線上諮詢網站-台灣中醫網
發文 回覆 瀏覽次數:10371
推到 Plurk!
推到 Facebook!

讀取PNG圖檔的程式1

尚未結案
ss0510
一般會員


發表:6
回覆:11
積分:3
註冊:2002-06-19

發送簡訊給我
#1 引用回覆 回覆 發表時間:2003-05-19 16:07:19 IP:218.32.xxx.xxx 未訂閱
請問各位大大: 我寫了一個讀取PNG圖檔的程式,但是卻會有ERR發生! 麻煩各位大大幫我看看好嗎? 以下是程式碼!和問題點! Graphics::TBitmap *Bitmap = new Graphics::TBitmap(); Bitmap->LoadFromFile("1-TEST.PNG");←這會有問題 Image1->Picture->Assign(Bitmap); 用Image 元件秀出PNG檔 [Bitmap image is not valid] ←這就是錯誤訊息 ps;我用ACDSEE開那PNG圖檔沒問題! 或是有其他的方法可以讓我在BCB裡面秀出PNG的圖檔啊!
turboted
版主


發表:95
回覆:754
積分:452
註冊:2002-07-23

發送簡訊給我
#2 引用回覆 回覆 發表時間:2003-05-19 16:42:47 IP:61.30.xxx.xxx 未訂閱
如果記得沒錯的話TBitmap並不認識PNG檔 所以沒辦法,下面有一個元件 參考來源 http://www.vclxx.org/DELPHI/AAAT102G.HTM http://www.vclxx.org/DELPHI/D32FREE/PNGUNIT.ZIP 讀取、顯示及儲存 .PNG 格式的影像檔案,並能夠將 .PNG 轉換為 .BMP 檔案的單元 ( 1.0 版,附原始程式碼 ),作者 : Jack Goman。 發表人 - turboted 於 2003/05/19 16:43:47
ss0510
一般會員


發表:6
回覆:11
積分:3
註冊:2002-06-19

發送簡訊給我
#3 引用回覆 回覆 發表時間:2003-05-21 14:33:24 IP:218.32.xxx.xxx 未訂閱
版主大大: 救命啊! 我要如何上那元件在我的BCB5.0能使用啊! 試了好幾天了! 麻煩你啦!!
axsoft
版主


發表:681
回覆:1056
積分:969
註冊:2002-03-13

發送簡訊給我
#4 引用回覆 回覆 發表時間:2003-05-21 15:13:05 IP:61.218.xxx.xxx 未訂閱
試試 Delphi wrapper for ImageMagick library,也許幫的上忙    資料來源: http://www.simdesign.nl/Components/ImageMagick.html    Introduction
On this page you can find a Delphi component wrapper for the fabulous ImageMagick library that can be found here. ImageMagick is a very portable library that excels in the vast number of file formats it supports.    The wrapper class is named the TMagickImage class, descending from TGraphic. It supports assignment to TBitmap, so you can easily load an ImageMagick image, then assign it to a standard TBitmap for visualisation.    Some key methods of TMagickImage:    LoadFromFile(const Filename: string);
Load an image from disk into TMagickImage. TMagickImage uses the filename's extension to determine which kind of file it is. A complete list of supported formats can be found here.    SaveToFile(const Filename: string);
Save an image to disk, again the filename determines in which format the file will be saved.    AssignTo
Use this one to assign to any TBitmap. Showing a TMagickImage in a TImage component is as easy as Image1.Picture.Bitmap.Assign(MyMagic);    Download    You can download this component wrapper archive here. By downloading you must agree to the license in the source files (MPL) and to the disclaimer in the readme.txt.     March 25, 2003 Original version 1.0 
March 31, 2003 Update version 1.1
- New header files (thanks Ian Stuart!)
- New procedures "LoadFromStream" and "SaveToStream" 
April 1, 2003 Update version 1.2
- Support Assign from bitmap so you can save your bitmaps using the library;
- Support preview in Open Picture and Save Picture dialog boxes;
- Quality setting when saving compressed file.     Archive structure    It is advised to extract files from this archive using the ZIP option "use folder names".    Main Directory:
This directory holds a Borland Project Group file "testprojects.bpg". You can open this file in Delphi and select any of the 2 example applications    test01XXXX files The initial example application written by Ian Stewart 
test02XXXX files "Test Magick" application that demonstrates loading/ saving/ editing with the new wrapper component. If you want to learn how to use TMagickImage then I suggest you look at this demo application.     
Above is a screenshot of the demo program in "test02.dpr"    Classes subdirectory:    magickImage.pas Contains the wrapper component TMagickImage 
magickgeneral.pas Some general library constants, for instance the file format list     Headers subdirectory:
Contains the latest version of Delphi import files (translations of c header files). Many thanks to Ian Stuart for the initial work!    Installation    It is advised to make two additional subdirectories:    Dcu: 
This will hold all compiled .dcu files    Exe: 
This will hold the .exe files. It is advised to store the ImageMagick DLL files in here as well. This will avoid having to update your "path" variable. You must get the ImageMagick DLL files by downloading a precompiled default Windows binary distribution at the ImageMagick website. Last time I checked, this was here.    These files should be present as a minimum:
CORE_RL_bzlib_.dll
CORE_RL_lcms_.dll
CORE_RL_magick_.dll
CORE_RL_ttf_.dll
CORE_RL_zlib_.dll
X11.dll    These are recommended in order to support a large set of formats:
CORE_RL_jbig_.dll
CORE_RL_jpeg_.dll
CORE_RL_fpx_.dll
CORE_RL_libxml_.dll
CORE_RL_png_.dll
CORE_RL_tiff_.dll
CORE_RL_xlib_.dll    Note: This is not a complete list! See next point.    Deploying ImageMagick with your application    If you want to create a stand-alone application that uses the ImageMagick library, but you don't want to force your users to download and install the ImageMagick binaries, you can do this by deploying all neccesary files in your installer.    Read this webpage on how to create an installer script that can deploy the ImageMagick library with your application automatically.    ImageMagick Documentation    There comes a lot of documentation with the standard ImageMagick install. Check the "www\api" folder for information (in html format). You can also check out the website and the links there.    Participate!    Everyone can now participate in the development, as well as share ideas and ask questions. Please visit the Yahoo DelphiMagick group here:
http://groups.yahoo.com/group/delphimagick    Related Links    ImageMagick website
This is the official ImageMagick website. Check here for updates to the library or other language implementations.    
HAVE A NICE DAY
turboted
版主


發表:95
回覆:754
積分:452
註冊:2002-07-23

發送簡訊給我
#5 引用回覆 回覆 發表時間:2003-05-21 15:31:17 IP:61.30.xxx.xxx 未訂閱
我剛才試了一下 可以安裝在bcb5沒問題 (1)create a new package (2)add pnglib.pas (3)compiler is ok (4)install is ok ps.沒有圖示,你可以直接拉進hpp檔進來用 不然就是改一下,讓他可以有圖出現 我把他包裝成package了,您直接下載回去安裝吧 http://delphi.ktop.com.tw/topic.php?TOPIC_ID=30831 發表人 - turboted 於 2003/05/21 16:06:24
ss0510
一般會員


發表:6
回覆:11
積分:3
註冊:2002-06-19

發送簡訊給我
#6 引用回覆 回覆 發表時間:2003-05-21 17:21:30 IP:218.32.xxx.xxx 未訂閱
版主大大: 對不起我沒使用過安裝元件! 但是剛剛翻書看!在裝時會出現錯誤訊息! 但是圖我貼不上來! 還是我可以打電話給你,請你幫幫我好嗎?
turboted
版主


發表:95
回覆:754
積分:452
註冊:2002-07-23

發送簡訊給我
#7 引用回覆 回覆 發表時間:2003-05-21 17:34:56 IP:61.30.xxx.xxx 未訂閱
請打訊息上來吧
lcsboy
版主


發表:87
回覆:622
積分:394
註冊:2002-06-18

發送簡訊給我
#8 引用回覆 回覆 發表時間:2003-05-21 18:39:59 IP:211.23.xxx.xxx 未訂閱
BCB要使用Delphi所作的VCL, 可參考以下連結: http://delphi.ktop.com.tw/topic.php?TOPIC_ID=23797
ss0510
一般會員


發表:6
回覆:11
積分:3
註冊:2002-06-19

發送簡訊給我
#9 引用回覆 回覆 發表時間:2003-05-21 18:40:15 IP:218.32.xxx.xxx 未訂閱
版主大大:            太好了!我終於安裝完成了! 確實可以安裝!            卻像你說的一樣,沒圖示元件!所以不知如何下手!            可以請你POST一下簡易的使用語法嗎? 像是如何讀取PNG檔和在   專案中秀出PNG圖檔。               拜託!拜託啦!
HomeSound
中階會員


發表:44
回覆:178
積分:94
註冊:2002-08-31

發送簡訊給我
#10 引用回覆 回覆 發表時間:2003-05-23 01:01:54 IP:61.30.xxx.xxx 未訂閱
Delphi 可以引入PngUnit.pas  就可以用ReadBitmapFromPngFile,WriteBitmapToPngFile 很多東西都放在PngUnit.pas裏,BCB引入pnglib.hpp也沒用勒, 就算 link "pnglib",也是無法使用,這要改吧!< >< > --==多看.多學.多聽==--
------
--==多看.多學.多聽==--
ss0510
一般會員


發表:6
回覆:11
積分:3
註冊:2002-06-19

發送簡訊給我
#11 引用回覆 回覆 發表時間:2003-05-23 17:26:25 IP:218.32.xxx.xxx 未訂閱
那感謝各位! 我在想想辦法!
rodman
一般會員


發表:0
回覆:1
積分:0
註冊:2005-05-16

發送簡訊給我
#12 引用回覆 回覆 發表時間:2007-03-15 22:26:22 IP:140.129.xxx.xxx 訂閱
最近我也遇到這些問題,所以我到版大所提的網址(http://www.hicomponents.com/nindex.asp)去下載BCB6.0用的ImageEN。
如果你使用自動安裝版可能要找一下說明檔,若是手動安裝版,你可以自ManualInstallation.txt中讀取到下列的訊息:

C Builder 6
Run setup.exe (docs directory) and select ImageEn unzip directory (ex. c:\ie).
Select Component->Install packages, and press Add button. Then select DPKIECTRLc6.BPL and DPKIEDBc6.BPL (this one for dataware components).
Make sure that ImageEn files is in your "Library path".

所以安裝完必須在Component選Install packages,然後新增DPKIECTRLc6.BPL and DPKIEDBc6.BPL,這兩個檔案會在你安裝路徑下的HiComponents\CImageEn6\BCB6內找到,新增完後你就可以在你的元件列的最後看到ImageEN的元件列表,接下來選擇OpenImageEnDialog1(開啟圖片用)、ImageEn1(顯示用)與ImageEnIO1(Input與Output用)這三個元件,再將ImageEnIO1的AttachedImageEn設定為ImageEn1,然後:

if (OpenImageEnDialog1->Execute())
{
ImageEnIO1->LoadFromFile(OpenImageEnDialog1->FileName);
}

如此就可以開啟許多不同格式之影像,當然包含PNG檔在內。
系統時間:2024-05-08 9:36:37
聯絡我們 | Delphi K.Top討論版
本站聲明
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。
2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。
3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇!