Alpha channel creation


#1

Hi,
I have added two more layers on the existing PSD file and finally, I could download the output PSD file.
My requirement is, Can I set the Alpha channel on the PSD file?
If is it possible, Can you share the right code for this?

Thanks


#2

@Esakkikumar

I have observed you requirements and have not been able to completely understand them. Can you please share the source PSD file exhibiting your requirements so that we may proceed further to help you.


#3

# How to Save a Selection as an Alpha Channel in Photoshop using .Net?


#4

@Esakkikumar,

I have observed your requirements and an issue with ID PSDNET-226 has been created in our issue tracking system to further investigate the requirements on our end. This thread has been linked with the issue so that you may be notified once the issue will be fixed.


#5

How to save psd file with alpha channel ?
I saw your release notes version Aspose.Imaging for.NET18.7 - IMAGINGNET-2984 The alpha channel enabled by default for PSD images. I am using latest version 19.10 and I couldn’t get the alpha channel on my saved .psd file.
Can you share any sample code for creating or enabling alpha channel?


#6

@Esakkikumar,

Can you please try to use following sample code on your end and share feedback with us if there is still an issue.

string sourceFileName =“alphachannel.psd”;
string outputFileName = “result.jpg”;
using (PsdImage image =(PsdImage)
Image.Load(
sourceFileName,
new PsdLoadOptions() { ReadOnlyMode = true, IgnoreAlphaChannel = true }))
{
image.Save(outputFileName, new JpegOptions());
}


#7

We couldn’t get the exact output by using the above code.
Herewith I have attached “Player.psd” file, it has one layer “Layer 1” and Alpha channel also.
When reading this psd file using your code below, the image1 object showing channelscount=5 but inside the Layer object it showing channelscount=4 only.

using (PsdImage image1 = (PsdImage)Aspose.Imaging.Image.Load(“Player.psd”, new PsdLoadOptions() {ReadOnlyMode=true,IgnoreAlphaChannel= true }))
{
image1.Save(“newplayer.psd”,new PsdOptions());
}
After saving the new psd file without changing any properties (newplayer.psd) it doesn’t have alpha channel.
Can you check both the PSD files?
psd files.zip (4.9 MB)


#8

@Esakkikumar,

I like to inform that we have investigated issue on our end. Can you please share desired result with us for further investigation.


#9

I want the resulting psd file should have an alpha channel like same as “player. Psd” file.


#10

@Esakkikumar,

We have tried to understand your requirements and have not been able to completely understand them. Can you please explain that what you actually mean by “set the Alpha channel on the PSD”? 1We haven’t any tools for selection. Do you need to make whole image more transparent or some region of it? Can you please share example of what do you want to get and from what file. We will be able to comprehend your requirements based on shared feedback to help you further.


#11

Hi,
Originally I have an one psd file (“Layer1.psd”) with 1 layer.
After that I am using the following code to draw the 2 images on the existing psd file.
Finally I will get the new output psd file with 3 layers.

                    Layer Layer2= new Layer();
                    Layer Layer3= new Layer();
                    using (PsdImage image = (PsdImage)Aspose.Imaging.Image.Load("Layer1.psd"))
                    {
                        image.AddRegularLayer();                        
                        image.Layers[1].Name = "Layer 2";
                        Layer2 = image.Layers[1];   //** I need alpha channel for this layer alone **//                         
                        Layer2.Left = 0;
                        Layer2.Top = 0;
                        Layer2.Right = 1920;
                        Layer2.Bottom = 1080;                            

                        image.AddRegularLayer();
                        image.Layers[2].Name = "Layer 3";
                        Layer3 = image.Layers[2];
                        Layer3.Left = 0;
                        Layer3.Top = 0;
                        Layer3.Right = 1920;
                        Layer3.Bottom = 1080;                           


                        using (RasterImage drawImage = (RasterImage)Aspose.Imaging.Image.Load("Layer2.png"))
                        {
                            Layer2.DrawImage(new Aspose.Imaging.Point(0, 0), drawImage);   //** I need alpha channel for this layer alone **//                              
                        }

                        using (RasterImage drawImage1 = (RasterImage)Aspose.Imaging.Image.Load("Layer3.png"))
                        {
                            Layer3.DrawImage(new Aspose.Imaging.Point(0, 0), drawImage1);
                        }
                       
                        image.Save("finaloutput.psd", new PsdOptions());
                       
                    }

My requirement is I want to set alpha channel for the second layer.
Is it possible to add alpha channel on the second layer while drawing that image on existing psd file?


#12

@Esakkikumar,

Thank you for sharing the information with us. With your following comments, I have envisaged that you are trying to set the alpha channel on layer level.

As requested earlier please additionally provide the source file and desired output file that I may link with our issue tracking system for resolution.


#13

Any upadations on this alpha channel creation?


#14

Hi,

Herewith I have attached the source files and desired output p sd file. Original psd file and images and expected output psd.zip (54.9 KB)

Please check and let me know if anything needed.

Thanks


#15

@Esakkikumar,

Thank you for sharing requested files. We have linked this into ticket and will share good news with you soon.


#16

Hi,

Any updates on an issue with ID PSDNET-226?


#17

@Esakkikumar,

I have verified from our issue tracking system and regret to share that at present there are no updates. We request for your patience and will share the good news with you as soon as it will be shared.