Presentation is loading. Please wait.

Presentation is loading. Please wait.

Ku-Yaw Chang Assistant Professor, Department of Computer Science and Information Engineering Da-Yeh University.

Similar presentations


Presentation on theme: "Ku-Yaw Chang Assistant Professor, Department of Computer Science and Information Engineering Da-Yeh University."— Presentation transcript:

1 Ku-Yaw Chang canseco@mail.dyu.edu.tw Assistant Professor, Department of Computer Science and Information Engineering Da-Yeh University

2 22004/03/29FreeImage Outline Introduction Add to Your Project Load a JPEG file Image Preparation

3 32004/03/29FreeImage Introduction FreeImage an Open Source library project an Open Source library project support popular graphics image formats support popular graphics image formats PNG, BMP, JPEG, TIFF and others two versions are available two versions are available a binary distribution a source distribution Website http://freeimage.sourceforge.net/ http://freeimage.sourceforge.net/

4 42004/03/29FreeImage Introduction Features Ease of use. Ease of use. The library has been designed to be extremely simple in use. Our motto is: make difficult things simple instead of simple things difficult. Supports many formats Supports many formats BMP, JPEG, TIFF, PNG Etc… Etc…

5 52004/03/29FreeImage Introduction Latest version May 7th 2005 : FreeImage 3.7.0 released May 7th 2005 : FreeImage 3.7.0 released

6 62004/03/29FreeImage Adding to Your Project FreeImage FreeImage.h FreeImage.h Add to your project FreeImage.lib FreeImage.lib Add to your project FreeImage.dll FreeImage.dll Under the same directory with your executable file Under the system directory C:\Windows\System32 C:\Windows\System32

7 72004/03/29FreeImage Load a JPEG file C***Doc #include “FreeImage.h” #include “FreeImage.h” Override BOOL C***Doc::OnOpenDocument (LPCTSTR lpszPathName) Override BOOL C***Doc::OnOpenDocument (LPCTSTR lpszPathName)

8 82004/03/29FreeImage Load a JPEG file Load and UnLoad FIBITMAP * dib = FreeImage_Load(FIF_JPEG, lpszPathName, JPEG_ACCURATE); FIBITMAP * dib = FreeImage_Load(FIF_JPEG, lpszPathName, JPEG_ACCURATE); FreeImage_Unload(dib); FreeImage_Unload(dib);

9 92004/03/29FreeImage Load a JPEG file Get Image Information Width WidthFreeImage_GetWidth(dib); Height HeightFreeImage_GetHeight(dib); Size of one pixel in bits Size of one pixel in bitsFreeImage_GetBPP(dib);

10 102004/03/29FreeImage Load a JPEG file Access pixels unsigned char * pScanLine = FreeImage_GetScanLine(dib, nLine); unsigned char * pScanLine = FreeImage_GetScanLine(dib, nLine);

11 112004/03/29FreeImage Load a JPEG file for (int iLoop=0; iLoop<m_nHeight; iLoop++){ unsigned char * pScanLine = FreeImage_GetScanLine(dib, (m_nHeight-1) - iLoop); for (int jLoop=0; jLoop<m_nWidth; jLoop++){ *(m_pBImage+iLoop*m_nWidth+jLoop) = *(pScanLine+jLoop*3); *(m_pGImage+iLoop*m_nWidth+jLoop) = *(pScanLine+jLoop*3+1); *(m_pRImage+iLoop*m_nWidth+jLoop) = *(pScanLine+jLoop*3+2); }}

12 122004/03/29FreeImage Preparation Image Format: JPG Format: JPG Size: 600*300 Size: 600*300 Content: Plate Content: Plate


Download ppt "Ku-Yaw Chang Assistant Professor, Department of Computer Science and Information Engineering Da-Yeh University."

Similar presentations


Ads by Google