|
-
December 4th, 2004, 05:33 AM
#1
open and read JPEG and BMP file
Can anyone help me in the program which can open and read jpeg and bmp file..this should be coded in VC++ ...i am having problems in coding....
Thanks in advance
-
December 4th, 2004, 05:38 AM
#2
Re: open and read JPEG and BMP file
Complex: HowTo
Easy: CImage
Last edited by Andreas Masur; December 4th, 2004 at 08:29 AM.
-
December 4th, 2004, 08:27 AM
#3
Re: open and read JPEG and BMP file
Last edited by Andreas Masur; December 4th, 2004 at 08:30 AM.
-
December 4th, 2004, 10:33 PM
#4
Re: open and read JPEG and BMP file
Use this code....I have used CXIMAGE,which can be downloaded at http://www.xdp.it/, and more info for this can be found in the same website or even in codeproject.com. Do all the details given in codeproject.com at http://www.codeproject.com/bitmap/cximage.asp which is really a big help. add #include "ximage.h" and #include "xfile.h". then add this code at the Onopen()
CFileDialog FileDlg(TRUE,"jpeg;jpg;bmp;tif;png", "*.jpeg;*.jpg;*.bmp;*.tif;*.png", OFN_OVERWRITEPROMPT,"Image Files (*.jpeg,*.jpg,*.bmp,*.tif,*.png)", NULL);
if (FileDlg.DoModal()==IDOK)
{
Inside=FileDlg.GetPathName();
// AfxMessageBox (Inside);
First=FileDlg.GetFileExt();
// AfxMessageBox (First);
CString Ash=FileDlg.GetFileTitle();
SetWindowText(Ash);
Second=FileDlg.GetPathName();
}
else
{
}
if ((First=="jpg") || (First=="jpeg") || (First=="JPG") || (First=="JPEG"))
ImageType=CXIMAGE_FORMAT_JPG;
if ((First=="tif") || (First=="TIF"))
ImageType=CXIMAGE_FORMAT_TIF;
if ((First=="png") || (First=="PNG"))
ImageType=CXIMAGE_FORMAT_PNG;
else
ImageType=CXIMAGE_FORMAT_BMP;
ImageIn.Load(Inside,ImageType);
ImageOut.Load(Inside,ImageType);
NewImage.Load(Inside,ImageType);
}
ImageIn, ImageOut, NewImage are of CxImage type and first,second are of CString type, (type this is the class view - filenamedlg)
hope this works....good luck
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|