當前位置: 首頁>>代碼示例>>C#>>正文


C# Image.RemovePropertyItem方法代碼示例

本文整理匯總了C#中System.Drawing.Image.RemovePropertyItem方法的典型用法代碼示例。如果您正苦於以下問題:C# Image.RemovePropertyItem方法的具體用法?C# Image.RemovePropertyItem怎麽用?C# Image.RemovePropertyItem使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在System.Drawing.Image的用法示例。


在下文中一共展示了Image.RemovePropertyItem方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: SetPropertyItems

        public static void SetPropertyItems(Image image, PropertyItem[] items)
        {
            PropertyItem[] pis = image.PropertyItems;

            foreach (PropertyItem pi in pis)
            {
                image.RemovePropertyItem(pi.Id);
            }

            foreach (PropertyItem pi in items)
            {
                image.SetPropertyItem(pi);
            }
        }
開發者ID:metadeta96,項目名稱:openpdn,代碼行數:14,代碼來源:PdnGraphics.cs

示例2: ResizeImage

        internal static Image ResizeImage(Image image, ref int width, ref int height)
        {
            if (image.Width <= width && image.Height <= height) {
            foreach (var p in image.PropertyIdList.Clone() as int[]) {
              image.RemovePropertyItem(p);
            }
            return image;
              }
              var nw = (float)image.Width;
              var nh = (float)image.Height;
              var factor = 1.0f;
              if (nw > nh) {
            factor = width / nw;
              }
              else {
            factor = height / nh;
              }
              nw = nw * factor;
              nh = nh * factor;

              var result = new Bitmap((int)nw, (int)nh);
              try {
            try {
              result.SetResolution(image.HorizontalResolution, image.VerticalResolution);
            }
            catch (Exception ex) {
              LogManager.GetLogger(typeof(ThumbnailMaker)).Debug("Failed to set resolution", ex);
            }
            using (Graphics graphics = Graphics.FromImage(result)) {
              if (result.Width > image.Width && result.Height > image.Height) {
            graphics.CompositingQuality = System.Drawing.Drawing2D.CompositingQuality.HighQuality;
            graphics.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.High;
              }
              else {
            graphics.CompositingQuality = System.Drawing.Drawing2D.CompositingQuality.HighSpeed;
            graphics.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.Bicubic;
              }
              graphics.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighSpeed;
              graphics.DrawImage(image, 0, 0, result.Width, result.Height);
              width = result.Width;
              height = result.Height;
            }
            return result;
              }
              catch (Exception) {
            result.Dispose();
            throw;
              }
        }
開發者ID:rodionovstepan,項目名稱:simpleDLNA,代碼行數:49,代碼來源:ThumbnailMaker.cs

示例3: ClearExif

 /// <summary>
 /// Clears any EXIF metadata from the image
 /// </summary>
 /// <param name="image">The current image.</param>
 private void ClearExif(Image image)
 {
     if (image.PropertyItems.Any())
     {
         foreach (KeyValuePair<int, PropertyItem> item in this.ExifPropertyItems)
         {
             image.RemovePropertyItem(item.Key);
         }
     }
 }
開發者ID:xeronith,項目名稱:ImageProcessor,代碼行數:14,代碼來源:ImageFactory.cs

示例4: ClearExif

 /// <summary>
 /// Clears any EXIF metadata from the image
 /// </summary>
 /// <param name="image">The current image.</param>
 private void ClearExif(Image image)
 {
     if (image.PropertyItems.Any())
     {
         foreach (KeyValuePair<int, PropertyItem> item in this.ExifPropertyItems)
         {
             // The Gif decoder specifically requires these properties so we must not delete them.
             if (item.Key != (int)ExifPropertyTag.LoopCount && item.Key != (int)ExifPropertyTag.FrameDelay)
             {
                 image.RemovePropertyItem(item.Key);
             }
         }
     }
 }
開發者ID:christopherbauer,項目名稱:ImageProcessor,代碼行數:18,代碼來源:ImageFactory.cs

示例5: RotateImage

        public Image RotateImage(Image bmp)
        {
            if (Array.IndexOf(bmp.PropertyIdList, 274) > -1)
            {
                var orientation = (int)bmp.GetPropertyItem(274).Value[0];
                switch (orientation)
                {
                    case 1:
                        // No rotation required.
                        break;
                    case 2:
                        bmp.RotateFlip(RotateFlipType.RotateNoneFlipX);
                        break;
                    case 3:
                        bmp.RotateFlip(RotateFlipType.Rotate180FlipNone);
                        break;
                    case 4:
                        bmp.RotateFlip(RotateFlipType.Rotate180FlipX);
                        break;
                    case 5:
                        bmp.RotateFlip(RotateFlipType.Rotate90FlipX);
                        break;
                    case 6:
                        bmp.RotateFlip(RotateFlipType.Rotate90FlipNone);
                        break;
                    case 7:
                        bmp.RotateFlip(RotateFlipType.Rotate270FlipX);
                        break;
                    case 8:
                        bmp.RotateFlip(RotateFlipType.Rotate270FlipNone);
                        break;
                }
                // This EXIF data is now invalid and should be removed.
                bmp.RemovePropertyItem(274);
            }

            return bmp;
        }
開發者ID:cberio,項目名稱:thisistracer,代碼行數:38,代碼來源:PhotoMapRepository.cs

示例6: ClearExif

 /// <summary>
 /// Clears any EXIF metadata from the image
 /// </summary>
 /// <param name="image">The current image.</param>
 private void ClearExif(Image image)
 {
     if (image.PropertyItems.Any())
     {
         foreach (KeyValuePair<int, PropertyItem> item in this.ExifPropertyItems)
         {
             // Ensure that we do not try to remove any stripped out properties
             // e.g gif comments.
             if (image.PropertyIdList.Contains(item.Key))
             {
                 // The Gif decoder specifically requires these properties so we must not delete them.
                 if (item.Key != (int)ExifPropertyTag.LoopCount && item.Key != (int)ExifPropertyTag.FrameDelay)
                 {
                     image.RemovePropertyItem(item.Key);
                 }
             }
         }
     }
 }
開發者ID:JimBobSquarePants,項目名稱:ImageProcessor,代碼行數:23,代碼來源:ImageFactory.cs


注:本文中的System.Drawing.Image.RemovePropertyItem方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。