Saving Jpeg problem RRS feed

  • Question

  • Hi,

    The following code saves my Jpeg (which has 32bppArgb PixelFormat) in 24-bit color-depth. Is this a bug?

    Dim param As New EncoderParameter(Imaging.Encoder.ColorDepth, CType(32L, Int32))
    Dim encoderParams As New System.Drawing.Imaging.EncoderParameters(1)encoderParams.Param(0) = param
    my32bppJpg.Save("C:\abc.jpg", m_ImagingJpegCodecInfo, m_ImagingEncoderParams)


    Friday, January 16, 2009 2:52 PM


  • Just found the answer. Sharing here so it might help someone else.

    JPEG doesn't support alpha channel. So sending in 32L has no effect. If you're interested in saving the alpha channel, look for PNG or TIFF codec (both are built-in). File sizes will be comparatively larger (as these formats are lossless), but you'll get your alpha channel preserved.
    Wednesday, January 21, 2009 6:22 AM