CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4
  1. #1
    Join Date
    Oct 2004
    Posts
    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

  2. #2
    Join Date
    Mar 2003
    Location
    India {Mumbai};
    Posts
    3,871

    Re: open and read JPEG and BMP file

    Complex: HowTo
    Easy: CImage
    Last edited by Andreas Masur; December 4th, 2004 at 08:29 AM.
    My latest article: Explicating the new C++ standard (C++0x)

    Do rate the posts you find useful.

  3. #3
    Join Date
    May 2000
    Location
    KY, USA
    Posts
    18,652

    Re: open and read JPEG and BMP file

    [ Moved thread ]
    Last edited by Andreas Masur; December 4th, 2004 at 08:30 AM.

  4. #4
    Join Date
    Nov 2004
    Posts
    6

    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
  •  





Click Here to Expand Forum to Full Width

Featured