CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4

Threaded View

  1. #1
    Join Date
    Dec 1999
    Posts
    85

    how to change a 24bit bitmap to a 32bit bitmap using GDI+

    I mean 32bit to 24bit image.

    Hi,

    I have a bitmap file temp.bmp that is a 32bit image, now I want to resave it as 24bit image but for some reason the code below is still saving it as a 32bit image (temp2.bmp) even though 24bit has been specified as the colorDepth.
    Any ideas? do I need to re-render it first? if so, how?

    Status stat;
    Image* image = new Image(_T("temp.bmp"));

    Gdiplus::EncoderParameters EncoderParameters1;
    ULONG colorDeph = 24;
    EncoderParameters1.Count = 1;
    EncoderParameters1.Parameter[0].Guid = EncoderColorDepth;
    EncoderParameters1.Parameter[0].Type = EncoderParameterValueTypeLong;
    EncoderParameters1.Parameter[0].NumberOfValues = 1;
    EncoderParameters1.Parameter[0].Value = &colorDeph;


    CLSID m_clsidGdiplusBmpEncoder;
    GetEncoderClsid( L"image/bmp", &m_clsidGdiplusBmpEncoder );
    stat = image->Save( _T("temp2.bmp"), &m_clsidGdiplusBmpEncoder, &EncoderParameters1 );



    Thanks,
    Hobnob
    Last edited by hobnob; January 16th, 2014 at 08:31 AM.

Tags for this Thread

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