彩票走势图

【更新】可将Photoshop功能嵌入您应用程序的强大控件Aspose.Imaging V3.7.0版发布

原创|产品更新|编辑:龚雪|2016-07-04 11:51:51.000|阅读 366 次

概述:可将Photoshop功能嵌入您应用程序的强大控件Aspose.Imaging年中大更新,全面优化了对PSD、CAD、SVG和EMF等格式文件的支持!

# 慧都年终大促·界面/图表报表/文档/IDE等千款热门软控件火热促销中 >>

Aspose.Imaging for .NET 3.7.0更新


特色与改进

核心概述类别
IMAGINGNET-1605支持为CAD和Emf格式设置字体新特性
IMAGINGNET-1602为emf文件进行裁剪新特性
IMAGINGNET-1568实现了对可缩放矢量图形(SVG)1.1格式的支持新特性
IMAGINGNET-1523能够将图像添加或输出为PSD图层新特性
IMAGINGNET-1628实现了Dicom载入程序优化
IMAGINGNET-1595Aspose.Imaging可以将水平或垂直分辨率值进行舍入运算优化
IMAGINGNET-1507Aspose.Imaging图像引擎的逐步引入优化


IMAGINGNET-1605 支持为CAD和Emf格式设置字体

测试字体

 EmfRasterizationOptions emfRasterizationOptions = new EmfRasterizationOptions();
emfRasterizationOptions.BackgroundColor = Color.WhiteSmoke;

PngOptions pngOptions = new PngOptions();
pngOptions.VectorRasterizationOptions = emfRasterizationOptions;

string filePath = @"alphabet.emf";
using (EmfImage image = (EmfImage)Image.Load(filePath))
{
  Assert.IsTrue(image.Header.EmfHeader.Valid);
  image.CacheData();

  pngOptions.VectorRasterizationOptions.PageWidth = 300;
  pngOptions.VectorRasterizationOptions.PageHeight = 350;

  FontSettings.Reset();
  image.Save(filePath + "_default_fonts.png", pngOptions);

  string fontPath = @".\Fonts";
  Listfonts = new List(FontSettings.GetDefaultFontsFolders());
  fonts.Add(fontPath);
  FontSettings.SetFontsFolders(fonts.ToArray(), true);
  image.Save(filePath + "_with_my_fonts.png", pngOptions);
}


IMAGINGNET-1602 为emf文件进行裁剪

使用移位码修剪图像

 EmfRasterizationOptions emfRasterizationOptions = new EmfRasterizationOptions();
emfRasterizationOptions.BackgroundColor = Color.WhiteSmoke;

PdfOptions pdfOptions = new PdfOptions();
pdfOptions.VectorRasterizationOptions = emfRasterizationOptions;

string filePath = @"TestEmfBezier.emf";
string outPath = filePath + ".pdf";
using (EmfImage image = (EmfImage)Image.Load(filePath))
using (FileStream outputStream = new FileStream(outPath, FileMode.Create))
{
  Assert.IsTrue(image.Header.EmfHeader.Valid);

  image.Crop(30, 40, 50, 60);

  pdfOptions.VectorRasterizationOptions.PageWidth = image.Width;
  pdfOptions.VectorRasterizationOptions.PageHeight = image.Height;

  image.Save(outputStream, pdfOptions);
}

使用矩形修剪图像

 EmfRasterizationOptions emfRasterizationOptions = new EmfRasterizationOptions();
emfRasterizationOptions.BackgroundColor = Color.WhiteSmoke;

PdfOptions pdfOptions = new PdfOptions();
pdfOptions.VectorRasterizationOptions = emfRasterizationOptions;

string filePath = @"TestEmfExtPen.emf";
string outPath = filePath + ".pdf";
using (EmfImage image = (EmfImage)Image.Load(filePath))
using (FileStream outputStream = new FileStream(outPath, FileMode.Create))
{
  Assert.IsTrue(image.Header.EmfHeader.Valid);

  image.Crop(new Rectangle(30, 50, 100, 150));

  pdfOptions.VectorRasterizationOptions.PageWidth = image.Width;
  pdfOptions.VectorRasterizationOptions.PageHeight = image.Height;

  image.Save(outputStream, pdfOptions);
}


IMAGINGNET-1523 能够将图像添加或输出为PSD图层

 string sourceFileName = "source.psd";
string outputFileName = "result.psd";
using (PsdImage image = (PsdImage)Image.Load(sourceFileName))
{
  Layer layer = image.Layers[1];
  layer = image.Layers[1];
  string normalImagePath = "png_normal.png";
  using (RasterImage drawImage = (RasterImage)Image.Load(normalImagePath))
  {
    layer.DrawImage(new Point(10, 10), drawImage);
  }

  image.Save(outputFileName, new PsdOptions());
}


IMAGINGNET-1628 实现了Dicom载入程序

 string inputFile = "1dicomEtalon.dicom";
using (DicomImage image = (DicomImage)Image.Load(inputFile))
{
   image.AdjustBrightness(50);
   image.Save("1dicomEtalon.png",new PngOptions());
}


IMAGINGNET-1595 Aspose.Imaging可以将水平或垂直分辨率值进行舍入运算

 using (Image img = Image.Load("Sildar_Hallwinter_150.png"))
{
   RasterImage rasterImg = (RasterImage)img;

   Console.WriteLine(string.Format("Horizontal resoltuion = {0}", rasterImg.HorizontalResolution));
   Console.WriteLine(string.Format("Vertical resoltuion = {0}", rasterImg.VerticalResolution));
}


IMAGINGNET-1507 Aspose.Imaging图像引擎的逐步引入

 public void DoSomeDrawing(Aspose.Imaging.Image image)
{
  Aspose.Imaging.Graphics.UseOwnDrawingEngine = true;

  Aspose.Imaging.Graphics graphics = new Aspose.Imaging.Graphics(image);

  // Do some drawing with 'graphics' here...
}
 public void DoSomeDrawing(Aspose.Imaging.Image image)
{
  Aspose.Imaging.Graphics.UseOwnDrawingEngine = false;

  Aspose.Imaging.Graphics graphics = new Aspose.Imaging.Graphics(image);

  // Draw with old drawing engine
}


IMAGINGNET-1568 实现了对可缩放矢量图形(SVG)1.1格式的支持

输出的SVG文档

 public void SvgImageExportExample()
{
  string sourceFilesDirectory = @"Path_to_source_folder\Source";
  string destFolderPath = @"Path_to_results_folder\Results";
  string[] srcFilePaths = Directory.GetFiles(sourceFilesDirectory);

  BmpOptions bmpOptions = new BmpOptions() { BitsPerPixel = 32 };
  JpegOptions jpegOptions = new JpegOptions();
  PngOptions pngOptions = new PngOptions();
  PsdOptions psdOptions = new PsdOptions() { CompressionMethod = Imaging.FileFormats.Psd.CompressionMethod.RLE };
  TiffOptions tiffOptions = new TiffOptions(TiffExpectedFormat.Default)
  {
    Compression = Aspose.Imaging.FileFormats.Tiff.Enums.TiffCompressions.None,
    BitsPerSample = new ushort[] { 8, 8, 8 },
    PlanarConfiguration = Aspose.Imaging.FileFormats.Tiff.Enums.TiffPlanarConfigs.Contiguous,
    Photometric = Aspose.Imaging.FileFormats.Tiff.Enums.TiffPhotometrics.Rgb
  };

  ImageOptionsBase[] saveOptions = { bmpOptions, jpegOptions, pngOptions, tiffOptions, psdOptions };

  foreach (string srcFilePath in srcFilePaths)
  {
    using (SvgImage image = (SvgImage)Image.Load(srcFilePath))
    {
      foreach (ImageOptionsBase options in saveOptions)
      {
        string destFileName = this.GetOutputFileName(srcFilePath, options);
        string destFilePath = Path.Combine(destFolderPath, destFileName);
        image.Save(destFilePath, options);
      }
    }
  }
}

private string GetOutputFileName(string srcFilePath, ImageOptionsBase options)
{
  string extension;

  if (options is BmpOptions)
  {
    extension = "bmp";
  }
  else if (options is JpegOptions)
  {
    extension = "jpg";
  }
  else if (options is TiffOptions)
  {
    extension = "tif";
  }
  else if (options is PngOptions)
  {
    extension = "png";
  }
  else if (options is PsdOptions)
  {
    extension = "psd";
  }
  else
  {
    throw new Exception("Invalid image options");
  }

  return string.Format("{0}.{1}", Path.GetFileNameWithoutExtension(srcFilePath), extension);
}




Aspose.Imaging for Java 3.6.0更新


核心概述类别
IMAGING-35315转换成JPG图像时,支持合并PSD图层特色
IMAGING-35301支持将Emf/Emf+文件输出为光栅模式特色
IMAGING-35078在.NET中支持图元文件(EMF)特色
IMAGING-35317将PSD转换为TIFF时出现错误优化
IMAGING-35302渲染emf/emf+时提升内存使用优化
IMAGING-35198Aspose.Imaging图像引擎逐步引入,使我们自己的图像引擎可以使用优化
IMAGING-34796验证所有光栅图像的操作,这样水印就不会重复了优化


用法示例

IMAGING-35301支持将Emf/Emf+文件转换为光栅图像

 public void Run()
{
    String filePath = "TestEmfBezier.emf";

    EmfRasterizationOptions emfRasterizationOptions = new EmfRasterizationOptions();
    emfRasterizationOptions.setBackgroundColor(Color.getPapayaWhip());
    emfRasterizationOptions.setPageWidth(300);
    emfRasterizationOptions.setPageHeight(300);

    ExportImage(filePath,new BmpOptions(),emfRasterizationOptions);
      
    ExportImage(filePath,new GifOptions(),emfRasterizationOptions);
      
    ExportImage(filePath,new JpegOptions(),emfRasterizationOptions);
      
    ExportImage(filePath,new Jpeg2000Options(),emfRasterizationOptions);
      
    ExportImage(filePath,new PngOptions(),emfRasterizationOptions);
      
    ExportImage(filePath,new PsdOptions(),emfRasterizationOptions);
      
    TiffOptions tiffOptions= new TiffOptions(TiffExpectedFormat.TiffLzwRgb);
    tiffOptions.setVectorRasterizationOptions(emfRasterizationOptions);
    ExportImage(filePath,tiffOptions,emfRasterizationOptions);
            
    ExportImage(filePath,new WebPOptions(),emfRasterizationOptions);
}
  
private void ExportImage(String srcFileName,ImageOptionsBase toOptions,EmfRasterizationOptions emfRasterizationOptions)
{
    EmfImage image = EmfImage.load(srcFileName);
    try
    {
     if (!image.getHeader().getEmfHeader().getValid())
     {
      throw new ImageLoadException("The file " + srcFileName +" is not valid");
     }
     toOptions.setVectorRasterizationOptions(emfRasterizationOptions); 
     String ext = toOptions.getClass().getName().replace("Options", "");
     image.save(srcFileName + "."+ext, toOptions);
    }
    finally
    {
     image.dispose();  
    }
}


IMAGING-35078在.NET中支持图元文件(EMF)

 string filePath = "TestEmfBezier.emf";

EmfRasterizationOptions emfRasterizationOptions = new EmfRasterizationOptions();
emfRasterizationOptions.BackgroundColor = Color.PapayaWhip;
emfRasterizationOptions.PageWidth = 300;
emfRasterizationOptions.PageHeight = 300;

using (var image = (EmfImage)Image.Load(filePath))
{
  if (!image.Header.EmfHeader.Valid)
  {
    throw new ImageLoadException(string.Format("The file {0} is not valid", filePath));
  }

  image.Save(filePath + ".png", new PngOptions() { VectorRasterizationOptions = emfRasterizationOptions });
}


IMAGING-34796验证所有光栅图像的操作,这样水印就不会重复

 string outputPath = "result.jpg";
using (RasterImage image = (RasterImage)Image.Load("im-resolution-150.jpg"))
{
  image.AdjustBrightness(200);
  image.RotateFlip(RotateFlipType.Rotate180FlipX);

  image.Save(outputPath);
}
 string outputPath = "result.jpg";
using (RasterImage image = (RasterImage)Image.Load("im-resolution-150.jpg"))
{
  image.AdjustGamma(5);
  image.RotateFlip(RotateFlipType.Rotate180FlipX);

  image.Save(outputPath);
}


IMAGING-35198图像引擎逐步引入,使我们自己的图像引擎可以使用

 public void DoSomeDrawing(Aspose.Imaging.Image image)
{
  Aspose.Imaging.Graphics.UseOwnDrawingEngine = true;

  Aspose.Imaging.Graphics graphics = new Aspose.Imaging.Graphics(image);

  // Do some drawing with 'graphics' here...
}
 public void DoSomeDrawing(Aspose.Imaging.Image image)
{
  Aspose.Imaging.Graphics.UseOwnDrawingEngine = false;

  Aspose.Imaging.Graphics graphics = new Aspose.Imaging.Graphics(image);

  // Draw with old drawing engine
}



标签:

本站文章除注明转载外,均为本站原创或翻译。欢迎任何形式的转载,但请务必注明出处、不得修改原文相关链接,如果存在内容上的异议请邮件反馈至chenjj@pclwef.cn

文章转载自:慧都控件网

为你推荐

  • 推荐视频
  • 推荐活动
  • 推荐产品
  • 推荐文章
  • 慧都慧问
扫码咨询


添加微信 立即咨询

电话咨询

客服热线
023-68661681

TOP