התעדכונים של Aspose.PSD עבור .NET 20.10
Contents
[
Hide
]
דף זה מכיל את רשימות השחרור עבור Aspose.PSD עבור .NET 20.10
מפתח | סיכום | קטגוריה |
---|---|---|
PSDNET-565 | חריגה בעת שמירת קובץ PSD ספציפי עם שכבות טקסט | תיקון |
PSDNET-680 | הגופנים אבודים לאחר מעגלים עם Aspose.PSD | תיקון |
PSDNET-704 | עיבוד של שכבת אובייקט חכם | תכונה |
PSDNET-707 | תמיכה בהפוך המרה בשכבת אובייקט חכם | תכונה |
PSDNET-711 | הזזת שכבת טקסט לאחר שמירה ללא שינויים | תיקון |
PSDNET-720 | Aspose.PSD 20.8: חריגת המרה מ- Psd ל- Tiff | תיקון |
שינויים ב- API הציבורי
APIs שנוספו:
- אין
APIs שהוסרו:
- אין
דוגמאות שימוש:
PSDNET-565. חריגה בעת שמירת קובץ PSD מסוים עם שכבות טקסט
string sourceFilePath = "OneReview-InDesign-RefreshPreviewIxD(2).psd";
string outputFile = "result.psd";
using (PsdImage image = (PsdImage)Image.Load(sourceFilePath))
{
image.Save(outputFile, new PsdOptions(image));
}
string sourceFilePath = "TwoFonts.psd";
string outputPsd1 = "output1.psd";
string outputPsd2 = "output2.psd";
string outputPng1 = "output1.png";
string outputPng2 = "output2.png";
void AreEqual(int expected, int actual)
{
if (expected != actual)
{
throw new Exception("ערכים אינם שווים.");
}
}
using (var psdImage = (PsdImage)Image.Load(sourceFilePath))
{
var textLayer = (TextLayer)psdImage.Layers[1];
AreEqual(1, textLayer.TextData.Items[0].Style.FontIndex);
AreEqual(0, textLayer.TextData.Items[1].Style.FontIndex);
textLayer.TextData.UpdateLayerData();
AreEqual(1, textLayer.TextData.Items[0].Style.FontIndex);
AreEqual(0, textLayer.TextData.Items[1].Style.FontIndex);
psdImage.Save(outputPsd1, new PsdOptions(psdImage));
psdImage.Save(outputPng1, new PngOptions());
}
using (var psdImage = (PsdImage)Image.Load(outputPsd1))
{
var textLayer = (TextLayer)psdImage.Layers[1];
AreEqual(1, textLayer.TextData.Items[0].Style.FontIndex);
AreEqual(0, textLayer.TextData.Items[1].Style.FontIndex);
textLayer.TextData.UpdateLayerData();
AreEqual(1, textLayer.TextData.Items[0].Style.FontIndex);
AreEqual(0, textLayer.TextData.Items[1].Style.FontIndex);
psdImage.Save(outputPsd2, new PsdOptions(psdImage));
psdImage.Save(outputPng2, new PngOptions());
}
// This example demonstrates how to replace the content of the Adobe® Photoshop® smart object layer and its correct rendering.
string dataDir = "PSDNET704_1\\";
string filePath = dataDir + "new_panama-papers-4-trans4.psd";
string pngOutputPath = dataDir + "new_panama-papers-4-trans4_replaced.png";
string psdOutputPath = dataDir + "new_panama-papers-4-trans4_replaced.psd";
string newContentPath = dataDir + "new_huset.jpg";
using (PsdImage image = (PsdImage)Image.Load(filePath))
{
var smartObjectLayer = (SmartObjectLayer)image.Layers[image.Layers.Length - 1];
smartObjectLayer.ReplaceContents(newContentPath);
image.Save(pngOutputPath, new PngOptions() { ColorType = PngColorType.TruecolorWithAlpha });
image.Save(psdOutputPath, new PsdOptions(image));
}
// This example demonstrates how to update the image cache of the Adobe® Photoshop® smart object layers and their correct rendering.
filePath = dataDir + "LayeredSmartObjects8bit2.psd";
pngOutputPath = dataDir + "LayeredSmartObjects8bit2_updated.png";
psdOutputPath = dataDir + "LayeredSmartObjects8bit2_updated.psd";
using (PsdImage image = (PsdImage)Image.Load(filePath))
{
image.SmartObjectProvider.UpdateAllModifiedContent();
image.Save(pngOutputPath, new PngOptions() { ColorType = PngColorType.TruecolorWithAlpha });
image.Save(psdOutputPath, new PsdOptions(image));
}
string dataDir = "PSDNET707_1\\";
string outputDir = dataDir;
// These examples demonstrate non-destructive transforms of the PSD file with SmartObjectLayer.
// We can scale, rotate, skew, distort, perspective transform, or warp a layer without
// losing original image data or quality because the transforms don’t affect the original data.
// This example demonstrates how to resize the Adobe® Photoshop® image with smart object layers:
ExampleOfSmartObjectImageResizeSupport("new_panama-papers-8-trans4-linked");
ExampleOfSmartObjectImageResizeSupport("picture-frame-4-linked3");
ExampleOfSmartObjectImageResizeSupport("gorilla");
// This example demonstrates how to resize the PSD file with smart object layers.
void ExampleOfSmartObjectImageResizeSupport(string fileName)
{
const int scale = 4;
string filePath = dataDir + fileName + ".psd";
string outputPath = outputDir + "Resize_" + fileName + ".psd";
string outputPngPath = outputDir + "Resize_" + fileName + ".png";
using (PsdImage image = (PsdImage)Image.Load(filePath))
{
int newWidth = image.Width * scale;
int newHeight = image.Height * scale;
image.Resize(newWidth, newHeight);
image.Save(outputPath, new PsdOptions(image));
image.Save(outputPngPath, new PngOptions { ColorType = PngColorType.TruecolorWithAlpha });
}
}
// This example demonstrates how to resize the Adobe® Photoshop® smart object layer.
ExampleOfSmartObjectLayerResizeSupport("new_panama-papers-8-trans4-linked");
ExampleOfSmartObjectLayerResizeSupport("gorilla");
// This example demonstrates how to resize a smart object layer in the PSD file.
void ExampleOfSmartObjectLayerResizeSupport(string fileName)
{
const double scale = 3.5;
string filePath = dataDir + fileName + ".psd";
string outputPath = outputDir + "ResizeLast_" + fileName + ".psd";
string outputPngPath = outputDir + "ResizeLast_" + fileName + ".png";
using (PsdImage image = (PsdImage)Image.Load(filePath))
{
var smartObjectLayer = image.Layers[image.Layers.Length - 1];
int newWidth = (int)(smartObjectLayer.Width * scale);
int newHeight = (int)(smartObjectLayer.Height * scale);
smartObjectLayer.Resize(newWidth, newHeight);
image.Save(outputPath, new PsdOptions(image));
image.Save(outputPngPath, new PngOptions { ColorType = PngColorType.TruecolorWithAlpha });
}
}
// This example demonstrates how to crop the Adobe® Photoshop® smart object layer.
ExampleOfSmartObjectLayerCropSupport("new_panama-papers-8-trans4-linked");
ExampleOfSmartObjectLayerCropSupport("gorilla");
// This example demonstrates how to crop a smart object layer in the PSD file.
void ExampleOfSmartObjectLayerCropSupport(string fileName)
{
string filePath = dataDir + fileName + ".psd";
string outputPath = outputDir + "CropLast_" + fileName + ".psd";
string outputPngPath = outputDir + "CropLast_" + fileName + ".png";
using (PsdImage image = (PsdImage)Image.Load(filePath))
{
var smartObjectLayer = image.Layers[image.Layers.Length - 1];
smartObjectLayer.Crop(25, 15, 30, 10);
image.Save(outputPath, new PsdOptions(image));
image.Save(outputPngPath, new PngOptions { ColorType = PngColorType.TruecolorWithAlpha });
}
}
// This example demonstrates how to crop the Adobe® Photoshop® smart object layer:
ExampleOfSmartObjectImageCropSupport("new_panama-papers-8-trans4-linked");
ExampleOfSmartObjectImageCropSupport("gorilla");
// This example demonstrates how to crop the PSD file with smart object layers.
void ExampleOfSmartObjectImageCropSupport(string fileName)
{
string filePath = dataDir + fileName + ".psd";
string outputPath = outputDir + "Crop_" + fileName + ".psd";
string outputPngPath = outputDir + "Crop_" + fileName + ".png";
using (PsdImage image = (PsdImage)Image.Load(filePath))
{
image.Crop(25, 10, 30, 5);
image.Save(outputPath, new PsdOptions(image));
image.Save(outputPngPath, new PngOptions { ColorType = PngColorType.TruecolorWithAlpha });
}
}
// This example demonstrates how to rotate and flip the Adobe® Photoshop® image with smart object layers:
ExampleOfSmartObjectImageRotateFlipSupport("gorilla", RotateFlipType.Rotate90FlipNone);
ExampleOfSmartObjectImageRotateFlipSupport("new_panama-papers-8-trans4-linked", RotateFlipType.RotateNoneFlipX);
ExampleOfSmartObjectImageRotateFlipSupport("new_panama-papers-8-trans4-linked", RotateFlipType.RotateNoneFlipY);
ExampleOfSmartObjectImageRotateFlipSupport("new_panama-papers-8-trans4-linked", RotateFlipType.RotateNoneFlipXY);
ExampleOfSmartObjectImageRotateFlipSupport("new_panama-papers-8-trans4-linked", RotateFlipType.Rotate90FlipNone);
ExampleOfSmartObjectImageRotateFlipSupport("new_panama-papers-8-trans4-linked", RotateFlipType.Rotate90FlipX);
ExampleOfSmartObjectImageRotateFlipSupport("new_panama-papers-8-trans4-linked", RotateFlipType.Rotate90FlipY);
ExampleOfSmartObjectImageRotateFlipSupport("new_panama-papers-8-trans4-linked", RotateFlipType.Rotate90FlipXY);
// This example demonstrates how to rotate and flip the PSD file with smart object layers.
void ExampleOfSmartObjectImageRotateFlipSupport(string fileName, RotateFlipType rotateFlipType)
{
string filePath = dataDir + fileName + ".psd";
string outputPath = outputDir + rotateFlipType + "_" + fileName + ".psd";
string outputPngPath = outputDir + rotateFlipType + "_" + fileName + ".png";
using (PsdImage image = (PsdImage)Image.Load(filePath))
{
image.RotateFlip(rotateFlipType);
image.Save(outputPath, new PsdOptions(image));
image.Save(outputPngPath, new PngOptions { ColorType = PngColorType.TruecolorWithAlpha });
}
}
// This example demonstrates how to rotate and flip the Adobe® Photoshop® smart object layer.
ExampleOfSmartObjectLayerRotateFlipSupport("gorilla", RotateFlipType.Rotate90FlipNone);
ExampleOfSmartObjectLayerRotateFlipSupport("r3-embedded-transform2", RotateFlipType.RotateNoneFlipX);
ExampleOfSmartObjectLayerRotateFlipSupport("r3-embedded-transform2", RotateFlipType.RotateNoneFlipY);
ExampleOfSmartObjectLayerRotateFlipSupport("r3-embedded-transform2", RotateFlipType.RotateNoneFlipXY);
ExampleOfSmartObjectLayerRotateFlipSupport("r3-embedded-transform2", RotateFlipType.Rotate90FlipNone);
ExampleOfSmartObjectLayerRotateFlipSupport("r3-embedded-transform2", RotateFlipType.Rotate90FlipX);
ExampleOfSmartObjectLayerRotateFlipSupport("r3-embedded-transform2", RotateFlipType.Rotate90FlipY);
ExampleOfSmartObjectLayerRotateFlipSupport("r3-embedded-transform2", RotateFlipType.Rotate90FlipXY);
// This example demonstrates how to rotate and flip a smart object layer in the PSD file.
void ExampleOfSmartObjectLayerRotateFlipSupport(string fileName, RotateFlipType rotateFlipType)
{
string filePath = dataDir + fileName + ".psd";
string outputPath = outputDir + rotateFlipType + "Last_" + fileName + ".psd";
string outputPngPath = outputDir + rotateFlipType + "Last_" + fileName + ".png";
using (PsdImage image = (PsdImage)Image.Load(filePath))
{
var smartObjectLayer = (SmartObjectLayer)image.Layers[image.Layers.Length - 1];
smartObjectLayer.RotateFlip(rotateFlipType);
image.Save(outputPath, new PsdOptions(image));
image.Save(outputPngPath, new PngOptions { ColorType = PngColorType.TruecolorWithAlpha });
}
}
// This example demonstrates how to rotate the Adobe® Photoshop® smart object layer by any angle:
const string AngleFormat = "+#;-#;+0";
ExampleOfSmartObjectLayerRotateSupport("gorilla", 45, false);
ExampleOfSmartObjectLayerRotateSupport("gorilla", 45, true);
ExampleOfSmartObjectLayerRotateSupport("r3-embedded-transform2", -30, true);
ExampleOfSmartObjectLayerRotateSupport("r3-embedded-transform2", -30, false);
ExampleOfSmartObjectLayerRotateSupport("new_panama-papers-8-trans4-linked", 190, false);
ExampleOfSmartObjectLayerRotateSupport("new_panama-papers-8-trans4-linked", 190, true);
// This example demonstrates how to rotate a smart object layer in the PSD file by any angle.
void ExampleOfSmartObjectLayerRotateSupport(string fileName, float angle, bool resizeProportionally)
{
string prefix = "RotateLast" + angle.ToString(AngleFormat) + (resizeProportionally ? "ResizeProportionally" : "") + "_";
string filePath = dataDir + fileName + ".psd";
string outputPath = outputDir + prefix + fileName + ".psd";
string outputPngPath = outputDir + prefix + fileName + ".png";
using (PsdImage image = (PsdImage)Image.Load(filePath))
{
var smartObjectLayer = (SmartObjectLayer)image.Layers[image.Layers.Length - 1];
smartObjectLayer.Rotate(angle, resizeProportionally, Color.Empty);
image.Save(outputPath, new PsdOptions(image));
image.Save(outputPngPath, new PngOptions { ColorType = PngColorType.TruecolorWithAlpha });
}
}
// This example demonstrates how to rotate the Adobe® Photoshop® image with smart object layer by any angle
ExampleOfSmartObjectImageRotateSupport("gorilla", 45, false);
ExampleOfSmartObjectImageRotateSupport("new_panama-papers-8-trans4-linked", -30, false);
// This example demonstrates how to rotate the PSD file with smart object layers by any angle.
void ExampleOfSmartObjectImageRotateSupport(string fileName, float angle, bool resizeProportionally)
{
string prefix = "Rotate" + angle.ToString(AngleFormat) + (resizeProportionally ? "ResizeProportionally" : "") + "_";
string filePath = dataDir + fileName + ".psd";
string outputPath = outputDir + prefix + fileName + ".psd";
string outputPngPath = outputDir + prefix + fileName + ".png";
using (PsdImage image = (PsdImage)Image.Load(filePath))
{
image.Rotate(angle, resizeProportionally, Color.Empty);
image.Save(outputPath, new PsdOptions(image));