Hi, Support:
I want to know whether the PSD.dll api support image mix with filters such as soften,dissolve,darken…and so on, which is the same as those in PS.
If so, how to perform it in VB.net.
Thanks for you help !
Hi, Support:
I want to know whether the PSD.dll api support image mix with filters such as soften,dissolve,darken…and so on, which is the same as those in PS.
If so, how to perform it in VB.net.
Thanks for you help !
Firstly, you need to add Nuget Package Aspose.PSD NuGet Gallery | Aspose.PSD 23.11.0 to your project.
Please check the following code:
Imports Aspose.PSD
Imports Aspose.PSD.ImageOptions
Imports Aspose.PSD.FileFormats.Psd
Imports Aspose.PSD.FileFormats.Core.Blending
Module DemoModule
Sub Main()
Using img As PsdImage = Aspose.PSD.Image.Load("AllTypesLayerPsd.psd")
Dim pngOpt = New PngOptions()
pngOpt.ColorType = FileFormats.Png.PngColorType.TruecolorWithAlpha
Dim layers = img.Layers
' Aspose.PSD supports all blending modes, but doesn't support filters with the same effects, also, thay can be added with ISmartFilter API https://reference.aspose.com/psd/net/aspose.psd.fileformats.psd.layers.smartfilters/
layers(2).BlendModeKey = BlendMode.Darken
layers(4).BlendModeKey = BlendMode.Dissolve
img.Save("Vb.export.png", pngOpt)
End Using
End Sub
End Module
Aspose.PSD supports all possible Adjustment Layers, and many other PSD format specific filters and features. We have good documentation with C# examples Aspose.PSD for .NET|Documentation, all of them can be reproduced using VB .Net Syntax.
Please also check our offers with Paid Consulting, specialists can help you to implement any gprahics effects. Pricing - Purchase - aspose.com
Please, if you have any other questions, don’t hesitate to ask
Thanks!
And how to blend two images and save as any type ,especially as png or jpg with given compessed quality?
'here,how to blend Forimage into Backimage at given position (x,y) and with given opacity, and save the blended psd as png or jpg with given compresssion quality?
Thanks for your help!
@ducaisoft Please check the following code:
Aspose.PSD has limitations - not PSD formats can be opened only like layers
Using stream1 As FileStream = New FileStream("C:\22\vb\img1.png", FileMode.Open)
Using stream2 As FileStream = New FileStream("C:\22\vb\img2.png", FileMode.Open)
Dim layer1 = New Layer(stream1)
Dim layer2 = New Layer(stream2)
Using newImg As PsdImage = New PsdImage(200, 200)
Dim newLayers = New List(Of Layer)
newLayers.Add(layer1)
layer1.BlendModeKey = BlendMode.Dissolve
layer1.Opacity = 190
layer2.BlendModeKey = BlendMode.Dissolve
layer2.Opacity = 150
newLayers.Add(layer2)
newImg.Layers = newLayers.ToArray
newImg.Save("C:\22\vb\final.psd", New PsdOptions)
Dim pngOpt = New PngOptions
pngOpt.ColorType = FileFormats.Png.PngColorType.TruecolorWithAlpha
newImg.Save("C:\22\vb\final.png", pngOpt)
Dim jpgOpt = New JpegOptions
jpgOpt.Quality = 85
newImg.Save("C:\22\vb\final.jpg", jpgOpt)
End Using
End Using
End Using
We have documentation for all these cases Developer Guide - C# .NET Photoshop Manipulation API|Documentation but unfortunately it made for C#, but all API is the same, only should be applied VB .net syntax
Thanks!
And else, how to place layer2 on layer1 at given position(x,y). while blending.
@ducaisoft please add following code to my previous example. It should work fine. All position of layer should be given from Top Left Point of Image.
Dim width = layer2.Width
Dim height = layer2.Height
Dim givenPositionLeft = 50
Dim givenPositionTop = 25
layer2.Left = givenPositionLeft
layer2.Top = givenPositionTop
layer2.Right = givenPositionLeft + width
layer2.Bottom = givenPositionTop + height
Thanks.
And else, there is a issue that report error for :
Dim layer1 = New Layer(stream1)
it should be declared as Dim Layer1=new Layer(id,name), and then
How to copy the Stream1 to Layer1.Contents?
111.jpg (88.0 KB)
Please check these Imports:
Imports Aspose.PSD
Imports Aspose.PSD.ImageOptions
Imports Aspose.PSD.FileFormats.Psd
Imports Aspose.PSD.FileFormats.Core.Blending
Imports Aspose.PSD.FileFormats.Psd.Layers
Imports System.IO
And please note, according to your code you are using Aspose.Imaging, not Aspose.PSD. My code works only for Aspose.PSD. Aspose.Imaging is not suitable for PSD Image manipulation. Please use Aspose.PSD, or I can move this task to Aspose.Imaging Support Forum.
Thanks!
Those errors are gone after Imports Aspose.PSD.FileFormats.Psd.Layers.