原創(chuàng)|產(chǎn)品更新|編輯:李顯亮|2020-02-27 10:39:40.057|閱讀 168 次
概述:在Aspose.Imaging for .NET v20.2中,支持TIFF格式的不同柵格數(shù)據(jù)類型,優(yōu)化Tiff和Gif格式的速度或內(nèi)存,添加矢量和多頁圖像的新類,修復(fù)多項格式轉(zhuǎn)換時發(fā)生的異常,接下來我們用示例演示新增的功能。
# 界面/圖表報表/文檔/IDE等千款熱門軟控件火熱銷售中 >>
Aspose.Imaging for .NET一種高級圖像處理控件,允許開發(fā)人員創(chuàng)建,編輯,繪制或轉(zhuǎn)換圖像。圖像導(dǎo)出和轉(zhuǎn)換是API核心功能之一,它允許在不安裝Photoshop應(yīng)用程序或任何其他圖像編輯器的情況下保存為AdobePhotoshop®本機格式。
在Aspose.Imaging for .NET v20.2中,支持TIFF格式的不同柵格數(shù)據(jù)類型,優(yōu)化Tiff和Gif格式的速度或內(nèi)存,添加矢量和多頁圖像的新類,修復(fù)多項格式轉(zhuǎn)換時發(fā)生的異常,接下來我們用示例演示新增的功能。
>>歡迎下載Aspose.Imaging for .NET v20.2體驗
key | 概述 | 類別 |
---|---|---|
IMAGINGNET-3624 | 支持TIFF格式的不同柵格數(shù)據(jù)類型 | 功能 |
IMAGINGNET-3588 | 將TIFF轉(zhuǎn)換為PNG的異常 | 功能 |
IMAGINGNET-3409 | 允許針對Tiff格式的速度或內(nèi)存優(yōu)化策略 | 功能 |
IMAGINGNET-3408 | 允許針對Gif格式的速度或內(nèi)存優(yōu)化策略 | 功能 |
IMAGINGNET-3364 | 統(tǒng)一處理多頁圖像導(dǎo)出 | 功能 |
IMAGINGNET-2548 | 介紹矢量和多頁圖像的新類 | 功能 |
IMAGINGNET-3633 | 將Tiff圖片轉(zhuǎn)換為PNG的異常 | 增強功能 |
IMAGINGNET-3632 | 將jpeg轉(zhuǎn)換為pdf的異常 | 增強功能 |
IMAGINGNET-3631 | 將JPG轉(zhuǎn)換為PDF時的異常 | 增強功能 |
IMAGINGNET-3623 | QA 19.11 .NET 3549不透明零件 | 增強功能 |
示例一:根據(jù)其自身的原始數(shù)據(jù)格式加載原始數(shù)據(jù)。
// Raw data after decoding is processed to eliminate format-specific effects (prediction and invert color component values). using (RasterImage image = (RasterImage)Image.Load("input.tif")) { image.LoadRawData(image.Bounds, image.RawDataSettings, new CustomRawDataLoader()); }
示例二:根據(jù)用戶指定的原始數(shù)據(jù)格式加載原始數(shù)據(jù)。
// In this case, in addition, raw data is converted from its own format to the one specified by the user. // Note that so far not all raw data formats can be converted to other formats (since not all color converters are still implemented and registered at the ColorConverterFactory). using (RasterImage image = (RasterImage)Image.Load("input.tif")) { RawDataSettings rawDataSettings = new RawDataSettings() { PixelDataFormat = PixelDataFormat.Rgb24Bpp, DitheringMethod = DitheringMethods.PaletteIgnore, }; rawDataSettings.LineSize = ((image.Width * rawDataSettings.PixelDataFormat.BitsPerPixel) + 7) / 8; image.LoadRawData(image.Bounds, image.RawDataSettings, new CustomRawDataLoader()); }
示例三:加載未經(jīng)處理的原始原始數(shù)據(jù)。
// Format-specific effects (prediction and invert color component values) may be present in this data, therefore this data cannot be used in color converters without pre-processing. using (RasterImage image = (RasterImage)Image.Load("input.tif")) { image.LoadRawData(image.Bounds, null, new CustomRawDataLoader()); } // Custom raw data loader class CustomRawDataLoader : IPartialRawDataLoader { ////// Processes the loaded data. //////The data rectangle.///The raw data.///The start data point. If not equal to (left,top) meaning that it is not full rectangle we have.///The end data point. If not equal to (right,bottom) meaning that it is not full rectangle we have.public void Process(Rectangle rectangle, byte[] data, Point start, Point end) { this.Process(rectangle, data, start, end, null); } ////// Processes the loaded data. //////The data rectangle.///The raw data.///The start data point. If not equal to (left,top) meaning that it is not full rectangle we have.///The end data point. If not equal to (right,bottom) meaning that it is not full rectangle we have.///The load options.public void Process(Rectangle rectangle, byte[] data, Point start, Point end, LoadOptions loadOptions) { // custom raw data processing } }
using (Image image = Image.Load("sample_car.svg")) { image.Resize(image.Width * 2, image.Height * 2); image.Save("sample_car_resize_2_2.png", new PngOptions()); }
// Setting a memory limit of 10 megabytes for target loaded image using (Image image = Image.Load("Default.tiff", new LoadOptions { BufferSizeHint = 10 })) { image.Save("Default_export.tiff", new TiffOptions(TiffExpectedFormat.Default)); } using (Image image = Image.Load("TiffCcitRle.tiff", new LoadOptions { BufferSizeHint = 10 })) { image.Save("TiffCcitRle_export.tiff", new TiffOptions(TiffExpectedFormat.TiffCcitRle)); } using (Image image = Image.Load("TiffDeflateRgb.tiff", new LoadOptions { BufferSizeHint = 10 })) { image.Save("TiffDeflateRgb_export.tiff", new TiffOptions(TiffExpectedFormat.TiffDeflateRgb)); } using (Image image = Image.Load("TiffJpegYCbCr.tiff", new LoadOptions { BufferSizeHint = 10 })) { image.Save("TiffJpegYCbCr_export.tiff", new TiffOptions(TiffExpectedFormat.TiffJpegYCbCr)); } using (Image image = Image.Load("TiffLzwCmyk.tiff", new LoadOptions { BufferSizeHint = 10 })) { image.Save("TiffLzwCmyk_export.tiff", new TiffOptions(TiffExpectedFormat.TiffLzwCmyk)); } using (Image image = Image.Load("TiffNoCompressionRgb.tiff", new LoadOptions { BufferSizeHint = 10 })) { image.Save("TiffNoCompressionRgb_export.tiff", new TiffOptions(TiffExpectedFormat.TiffNoCompressionRgb)); }
// Setting a memory limit of 10 megabytes for target loaded image using (Image image = Image.Load("flowers.gif", new LoadOptions { BufferSizeHint = 10 })) { image.Save("flowers_export.gif", new GifOptions()); }
string baseFolder = "D:\\images"; string outputFolderName = Path.Combine(baseFolder, "out"); string[] files = new[] { "MultiframePage1.dicom", "VariousObjectsMultiPage.odg" }; foreach (string inputFileName in files) { using (Image image = Image.Load(Path.Combine(baseFolder, inputFileName))) { PdfOptions imageOptions = new PdfOptions(); imageOptions.MultiPageOptions = new MultiPageOptions(new IntRange(1, 2)); if (image is VectorImage) { imageOptions.VectorRasterizationOptions = (VectorRasterizationOptions)image.GetDefaultOptions(new object[] { Color.White, image.Width, image.Height }); imageOptions.VectorRasterizationOptions.TextRenderingHint = TextRenderingHint.SingleBitPerPixel; imageOptions.VectorRasterizationOptions.SmoothingMode = SmoothingMode.None; } string outFileName = Path.Combine(outputFolderName, inputFileName + ".pdf"); image.Save(outFileName, imageOptions); } }
using (Image image = Image.Load(fileName)) { if (image is VectorImage) { ... } else { ... } }
using (Image image = Image.Load(fileName)) { if (image is IMultipageImage) { var pages = ((IMultipageImage)image).Pages; } }
int startPage = 3; int countPage = 2; using (Image image = Image.Load(fileName)) { PngOptions pngOptions = new PngOptions(); pngOptions.MultiPageOptions = new MultiPageOptions(new IntRange(startPage, countPage)); image.Save(outFileName, pngOptions); }
本站文章除注明轉(zhuǎn)載外,均為本站原創(chuàng)或翻譯。歡迎任何形式的轉(zhuǎn)載,但請務(wù)必注明出處、不得修改原文相關(guān)鏈接,如果存在內(nèi)容上的異議請郵件反饋至chenjj@fc6vip.cn