The new on-line! PSD file management controls Aspose.PSD resolve practical function - Color Balance adjustment layer

A spose.PSD for the .NET Advanced PSD file format operation API, Adobe Photoshop without any dependencies. API allows you to create or edit a Photoshop file, and provide updates layer properties, add watermarks, or perform graphics operations to convert one file format to another file function.

Recently, Aspose.PSD for the .NET update to the latest version v19.10, including new support for the PSD Bicubic resampling, reverse, and color balance adjustment layer support. How exactly does it work? We take a look at the new features explain it!


Embodiment bicubic resampling

Resampling means that you should change the pixel size. The next sampling is in fact the elimination of pixels, so will delete the information and detail from the image. When upsampling, and you add pixels to enhance details. Photoshop to add these by using pixel interpolation. In the following example, we demonstrated how to perform bicubic resampling by using the .NET Aspose.PSD.

 

// Add a color overlay effect at runtime 
String RunExamples.GetDataDir_PSD dataDir = (); 


String = dataDir a sourceFile + "sample_bicubic.psd"; 
String destNameCubicConvolution = dataDir + "ResamplerCubicConvolutionStripes_after.psd"; 

// existing image into PsdImage class instances 
the using (Image PsdImage = (PsdImage) image.load (a sourceFile)) 
{ 
    image.Resize (300, 300, ResizeType.CubicConvolution); 
    Image.Save (destNameCubicConvolution, new new PsdOptions (Image)); 
} 

   
String = destNameCatmullRom + dataDir "ResamplerCatmullRomStripes_after.psd"; 

// load an image into an existing instance of class PsdImage 
the using (image PsdImage = (PsdImage) image.load (a sourceFile)) 
{ 
    image.Resize (300, 300, ResizeType.CatmullRom);
    Image.Save (destNameCatmullRom, new new PsdOptions (Image)); 
}

          
destNameMitchell = String "ResamplerMitchellStripes_after.psd"; 

// load an image into an existing instance of class PsdImage 
the using (Image PsdImage = (PsdImage) image.load (a sourceFile)) 
{ 
    image.Resize (300, 300, ResizeType.Mitchell) ; 
    Image.Save (destNameMitchell, new new PsdOptions (image)); 
} 

           
String destNameCubicBSpline = "ResamplerCubicBSplineStripes_after.psd"; 

// load an image into an existing class PsdImage example 
using (PsdImage image = (PsdImage) image.Load (sourceFile )) 
{ 
    image.Resize (300, 300, ResizeType.CubicBSpline); 
    Image.Save (destNameCubicBSpline, new new PsdOptions (image)); 
} 

           
String destNameSinC = "ResamplerSinCStripes_after.psd"; 

// load an image into an existing class PsdImage examples
using (PsdImage image = (PsdImage)Image.Load(sourceFile))
{
    image.Resize(300, 300, ResizeType.SinC);
    image.Save(destNameSinC, new PsdOptions(image));
}

           
string destNameBell = "ResamplerBellStripes_after.psd";

// 将现有图像加载到PsdImage类的实例中
using (PsdImage image = (PsdImage)Image.Load(sourceFile))
{
    image.Resize(300, 300, ResizeType.Bell);
    image.Save(destNameBell, new PsdOptions(image));
}

 

Color Balance adjustment layer

Color Balance adjustment layer allows you to adjust the color of its image. It shows the three color channels and complementary colors, you can adjust the color balance these two pairs to change the appearance of the image. This article demonstrates the use of Aspose.PSD for .NET implementation of the "color balance" adjustment layer on the image.

 

//在运行时添加颜色叠加层效果
string dataDir = RunExamples.GetDataDir_PSD();


var filePath = dataDir + "ColorBalance.psd";
var outputPath = dataDir + "ColorBalance_out.psd";
using (var im = (FileFormats.Psd.PsdImage)Image.Load(filePath))
{
    foreach (var layer in im.Layers)
    {
        var cbLayer = layer as ColorBalanceAdjustmentLayer;
        if (cbLayer != null)
        {
            cbLayer.ShadowsCyanRedBalance = 30;
            cbLayer.ShadowsMagentaGreenBalance = -15;
            cbLayer.ShadowsYellowBlueBalance = 40;
            cbLayer.MidtonesCyanRedBalance = -90;
            cbLayer.MidtonesMagentaGreenBalance = -25;
            cbLayer.MidtonesYellowBlueBalance = 20;
            cbLayer.HighlightsCyanRedBalance = -30;
            cbLayer.HighlightsMagentaGreenBalance = 67;
            cbLayer.HighlightsYellowBlueBalance = -95;
            cbLayer.PreserveLuminosity = true;
        }
    }

    im.Save(outputPath);
}

If you have any needs, please feel free to join Aspose technical exchange group (642 018 183)

Guess you like

Origin www.cnblogs.com/mnrssj-Aspsoe/p/11820736.html