線上訂房服務-台灣趴趴狗聯合訂房中心
發文 回覆 瀏覽次數:6310
推到 Plurk!
推到 Facebook!

抓取jpg Exif資訊

尚未結案
liming
一般會員


發表:10
回覆:6
積分:3
註冊:2002-08-20

發送簡訊給我
#1 引用回覆 回覆 發表時間:2003-05-10 22:55:21 IP:211.76.xxx.xxx 未訂閱
請問一下BCB該怎抓取jpg的Exif資訊~~~ 3Q~~
axsoft
版主


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

發送簡訊給我
#2 引用回覆 回覆 發表時間:2003-05-11 00:09:44 IP:218.173.xxx.xxx 未訂閱
引言: 請問一下BCB該怎抓取jpg的Exif資訊~~~ 3Q~~
liming您好:
    Exif規格
http://www.exif.org/specifications.html
方法一:
EXIF Tag Parsing Library Source 範例
http://sourceforge.net/project/showfiles.php?group_id=12272&release_id=132198    方法二:    試試這個範例吧!
資料來源:http://www.smalleranimals.com/isource/isourcesample_v2_2.htm
Get EXIF data from a JPG 
EXIF data is stored in the JPGs created by most digital cameras. It contains information about the camera, the environment when the image was taken, the date, time, etc..     UINT32 w,h,d;    // get the dimensions - we'll we really don't care about the dims. 
// we just want to force a JPG marker read and this is the quickest way
// to do it.
HISSRC hSrc = ISOpenFileSource( pFilename );
ISGetJPGDims( hSrc, &w, &h, &d, NULL);
ISCloseSource( hSrc );    // loop over all JPEG_APPx markers
int ct=ISGetJPGInputMarkerCount();
                               
for (int i=0; i < ct; i++)
{
    // get a JPG marker from ImgSoruce
    HGLOBAL hData = NULL;
    UINT32 len, type;
    ISGetJPGInputMarker(i, &hData, &len, &type);        // only interested in JPEG_APP1 (#225)
    if (type!=225)
    {
        GlobalFree(hData);
        continue;
    }
    else
    {
        // start the EXIF parser
        HGLOBAL hEXIF = ISEXIFInit((BYTE *)hData, len);            if (hEXIF!=NULL)
        {
            // get string with tag ID #271 (camera model)
            // look in all subsections (1 | 2 | 4 | 8 = 15)
            HGLOBAL hStr = NULL;
            UINT32 uStrLen;
            ISEXIFGetString(hEXIF, 272, 15, &hStr, &uStrLen);
            if (hStr!=NULL)
            {
                // got it!
                TRACE("model = %s\n", (char *)hStr);
                GlobalFree(hStr);
            }                                                                  //  try the thumbnail
            HGLOBAL hThumbnail = NULL;
            UINT32 uTNLen = 0;
            if (ISEXIFGetThumbnail(hEXIF, &hThumbnail, &uTNLen)==IS_ERR_OK)
            {
                // there is a thumbnail.                    // what format is it?
                int iFmt = 0;
                HGLOBAL hStr = NULL;
                UINT32 uStrLen;
                ISEXIFGetString(hEXIF, 259, 8, &hStr, &uStrLen);
                if (hStr!=NULL)
                {
                    // got it!
                    TRACE("fmt = %s\n", (char *)hStr);
                    iFmt = atoi((char *)hStr);
                    GlobalFree(hStr);
                }                                                                      if (iFmt==6) // 6 = JPG. 1 = TIFF, 0 = RGB, but most are JPG
                {
                    // convet that to RGB
                    HISSRC hSrc = ISOpenMemorySource((BYTE *)hThumbnail, uTNLen);
                    HGLOBAL hImg = ISReadJPG(hSrc, &w, &h, 24);
                    ISCloseSource(hSrc);                        if (hImg)
                    {
                        // draw it
                        CDC *pDC = GetDC();
                        ISDrawRGB( pDC->m_hDC, (BYTE *)hImg, w, h, 0, 0, w, h, NULL );
                        ReleaseDC(pDC);                            GlobalFree(hImg);
                    }
                }                    // clean up
                GlobalFree(hThumbnail);
            }                // clean up
            ISEXIFDestroy(hEXIF);
        }   
    }        GlobalFree(hData);
}    
Delphi.Ktop風紀小隊---[ 發問前請先找找舊文章 ]---
taishyang
站務副站長


發表:377
回覆:5490
積分:4563
註冊:2002-10-08

發送簡訊給我
#3 引用回覆 回覆 發表時間:2003-05-11 00:24:26 IP:61.231.xxx.xxx 未訂閱
哇!!! axsoft大哥實在是太厲害了... 當我還在找資料的時候,答案就已經出現了... 實在是太可怕了~~< >< > ~我也是在學習的階段,所以請您多多見諒與指教~ 發表人 - taishyang 於 2003/05/11 00:25:36
GGL
資深會員


發表:104
回覆:600
積分:335
註冊:2006-11-05

發送簡訊給我
#4 引用回覆 回覆 發表時間:2003-05-11 00:26:39 IP:211.76.xxx.xxx 未訂閱
請問一下第2種方法還要另外include什麼東西嗎?
axsoft
版主


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

發送簡訊給我
#5 引用回覆 回覆 發表時間:2003-05-11 01:38:28 IP:218.173.xxx.xxx 未訂閱
引言: 請問一下第2種方法還要另外include什麼東西嗎?
GGL您好: 到這了解一下吧! src="http://delphi.ktop.com.tw/loadfile.php?TOPICID=9258866&CC=207074"> Delphi.Ktop風紀小隊---[ 發問前請先找找舊文章 ]---
axsoft
版主


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

發送簡訊給我
#6 引用回覆 回覆 發表時間:2003-05-12 10:38:06 IP:61.218.xxx.xxx 未訂閱
a small class to read EXIF data from JPEG images      By Davide Pizzolato  資料來源:http://www.codeproject.com/useritems/cexif.asp Download source files - 8.13 Kb Download demo project - 26.7 Kb
Introduction
Cexif is a small class to read the exif data stored in JPEG images, normally generated by digital cameras.     The code is based on Jhead, written by Matthias Wandel. Jhead offers a lot of switches to parse an image with EXIF tags, but it's plain C.
I simply rearranged the functions and the global variables into a simple class.     Another useful article on this topic is here ,  >.     >>>        < src="http://delphi.ktop.com.tw/loadfile.php?TOPICID=9258866&CC=207074">
Delphi.Ktop風紀小隊---[ 發問前請先找找舊文章 ]---
        
axsoft
版主


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

發送簡訊給我
#7 引用回覆 回覆 發表時間:2003-05-12 10:47:46 IP:61.218.xxx.xxx 未訂閱
How to read EXIF tags. 資料來源:http://www.kuren.org/exif/    EXIFread Do you have a digital camera? Do you want to read all the extra data on the jpeg or jpg image? I do. I wrote this C++ command line program to read the exif tags on JPEGs. It will tell you important info like flash, shutter speed, focal length, and much much more. I am still writing the code, but I wanted to post this program before I go on vacation for anyone out there who is also looking for help on this topic. Download EXIFread and source code. (49K) Or... download this great Windows GUI based program inspired by some of my EXIF reading code. http://oneilsoftware.hypermart.net/Exif/Exif.html EXIFren Another program I wrote will rename your files to the date the picture was taken. I call it EXIFren. This program is also a simple command line program for which I am still working on, but it is almost bug free as it is. Download EXIFren and source code.(30K) JPEGget JPEGget will extract the thumbnail JPEG hidden in your digital camera JPEG. This program is very simple in how it works. It looks through a JPEG file for a second SOI (start of image) marker. If it finds one, it copies that to a new file until it reaches an EOI marker. Download JPEGget and source code. (28K) Drop me a line if you found this usefull. email kuren@kuren.org. Delphi.Ktop風紀小隊---[ 發問前請先找找舊文章 ]--- 發表人 - axsoft 於 2003/05/13 09:23:23
系統時間:2024-04-18 13:59:28
聯絡我們 | Delphi K.Top討論版
本站聲明
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。
2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。
3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇!