BitMiracle.LibJpeg.Classic.Internal.jpeg_marker_writer.write_file_header C# (CSharp) Method

write_file_header() public method

Write datastream header. This consists of an SOI and optional APPn markers. We recommend use of the JFIF marker, but not the Adobe marker, when using YCbCr or grayscale data. The JFIF marker is also used for other standard JPEG colorspaces. The Adobe marker is helpful to distinguish RGB, CMYK, and YCCK colorspaces. Note that an application can write additional header markers after jpeg_start_compress returns.
public write_file_header ( ) : void
return void
        public void write_file_header()
        {
            emit_marker(JPEG_MARKER.SOI);  /* first the SOI */

            /* SOI is defined to reset restart interval to 0 */
            m_last_restart_interval = 0;

            if (m_cinfo.m_write_JFIF_header)   /* next an optional JFIF APP0 */
                emit_jfif_app0();
            if (m_cinfo.m_write_Adobe_marker) /* next an optional Adobe APP14 */
                emit_adobe_app14();
        }

Usage Example

        /// <summary>
        /// Master selection of compression modules for transcoding.
        /// </summary>
        private void transencode_master_selection(jvirt_array<JBLOCK>[] coef_arrays)
        {
            /* Although we don't actually use input_components for transcoding, 
             * jcmaster.c's initial_setup will complain if input_components is 0.
             */
            m_input_components = 1;

            /* Initialize master control (includes parameter checking/processing) */
            jinit_c_master_control(true /* transcode only */);

            /* Entropy encoding: only Huffman coding supported. */
            if (m_progressive_mode)
                m_entropy = new phuff_entropy_encoder(this);
            else
                m_entropy = new huff_entropy_encoder(this);

            /* We need a special coefficient buffer controller. */
            m_coef = new my_trans_c_coef_controller(this, coef_arrays);
            m_marker = new jpeg_marker_writer(this);

            /* Write the datastream header (SOI, JFIF) immediately.
            * Frame and scan headers are postponed till later.
            * This lets application insert special markers after the SOI.
            */
            m_marker.write_file_header();
        }
All Usage Examples Of BitMiracle.LibJpeg.Classic.Internal.jpeg_marker_writer::write_file_header