0
我已經安裝了新版本的姿勢成像大會(版本17.7.0.0),我需要重寫代碼,以便它將支持下面的新版本大會,如果我需要重寫
因爲它不接受默認的構造函數 問題是與TIFF選項代碼Aspose成像圖像選擇構造函數
public void ImageToTIFF(string imagePath, string outputPath, string server, string folder, int sequenceNumber)
{
int page = 0;
using (Aspose.Imaging.Image inputImage = Aspose.Imaging.Image.Load(imagePath))
{
page++;
Aspose.Imaging.ImageOptions.TiffOptions tiffSaveOptions = new Aspose.Imaging.ImageOptions.TiffOptions();
tiffSaveOptions.Compression = Aspose.Imaging.FileFormats.Tiff.Enums.TiffCompressions.CcittFax4;
tiffSaveOptions.Photometric = Aspose.Imaging.FileFormats.Tiff.Enums.TiffPhotometrics.MinIsBlack;
tiffSaveOptions.BitsPerSample = new ushort[] {1};
tiffSaveOptions.Palette = Aspose.Imaging.ColorPaletteHelper.CreateMonochrome();
// Get the pixels of image by specifying the area as image boundary
Aspose.Imaging.RasterImage image = inputImage as Aspose.Imaging.RasterImage;
Aspose.Imaging.Color[] imageColors = image.LoadPixels(inputImage.Bounds);
int power;
for (int i = 0; i <= imageColors.Length - 1; i++)
{
try
{
power = (int)imageColors[i].R + (int)imageColors[i].G + (int)imageColors[i].B;
if (power < 380)
{
imageColors[i] = Aspose.Imaging.Color.White;
}
else
{
imageColors[i] = Aspose.Imaging.Color.Black;
}
}
catch (Exception ex)
{
Console.WriteLine("i: {0}, imageColors[i].R: {1}, imageColors[i].G: {2}, imageColors[i].B: {3}", i, imageColors[i].R, imageColors[i].G, imageColors[i].B);
Console.WriteLine("Error: {0}", ex.Message);
imageColors[i] = Aspose.Imaging.Color.White;
}
}
Aspose.Imaging.RasterImage imagePixels = inputImage as Aspose.Imaging.RasterImage;
imagePixels.SavePixels(inputImage.Bounds, imageColors);
inputImage.Save(outputPath + FileCreateTime(new FileInfo(imagePath)) + "_" + server + "_" + folder + "_" + sequenceNumber.ToString("D6") + "_" + page.ToString("D4") + ".tif", tiffSaveOptions);
}
}
我投票關閉這一問題作爲題外話,因爲不設法,這只是一個「請轉換我的代碼」主題。 – Styxxy
如果您升級代碼,請閱讀您以前的版本和新版本之間的所有版本說明。 Aspose通常解釋瞭如何解決這個問題(他們在實際刪除代碼之前先棄用代碼)。 – Styxxy