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
Printable View
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
[ Moved thread ]
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