예제 #1
0
        /// <summary>
        /// write image
        /// </summary>
        /// <param name="img">image</param>
        /// <param name="width">pixel width</param>
        /// <param name="height">pixel height</param>
        /// <param name="ImageData">image binary data</param>
        public void WriteImage(System.Drawing.Image img, int width, int height, byte[] ImageData)
        {
            if (this.bolCollectionInfo)
            {
                return;
            }
            else
            {
                if (ImageData == null)
                {
                    return;
                }

                System.IO.MemoryStream ms = new System.IO.MemoryStream();
                img.Save(ms, System.Drawing.Imaging.ImageFormat.Jpeg);
                ms.Close();
                byte[] bs = ms.ToArray();
                myWriter.WriteStartGroup();

                myWriter.WriteKeyword("pict");
                myWriter.WriteKeyword("jpegblip");
                myWriter.WriteKeyword("picscalex" + Convert.ToInt32(width * 100.0 / img.Size.Width));
                myWriter.WriteKeyword("picscaley" + Convert.ToInt32(height * 100.0 / img.Size.Height));
                myWriter.WriteKeyword("picwgoal" + Convert.ToString(img.Size.Width * 15));
                myWriter.WriteKeyword("pichgoal" + Convert.ToString(img.Size.Height * 15));
                myWriter.WriteBytes(bs);
                myWriter.WriteEndGroup();
            }
        }