当前位置: 首页>>代码示例>>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;未经允许,请勿转载。