Loads the specified channel from the specified PSD file.
public Leadtools.RasterImage LoadPsdChannel(
string fileName,
int bitsPerPixel,
Leadtools.Codecs.CodecsLoadByteOrder order,
int channelIndex,
Leadtools.Codecs.CodecsPsdChannelInfo channelInfo
)
Public Function LoadPsdChannel( _
ByVal fileName As String, _
ByVal bitsPerPixel As Integer, _
ByVal order As Leadtools.Codecs.CodecsLoadByteOrder, _
ByVal channelIndex As Integer, _
ByVal channelInfo As Leadtools.Codecs.CodecsPsdChannelInfo _
) As Leadtools.RasterImage
public Leadtools.RasterImage LoadPsdChannel(
string fileName,
int bitsPerPixel,
Leadtools.Codecs.CodecsLoadByteOrder order,
int channelIndex,
Leadtools.Codecs.CodecsPsdChannelInfo channelInfo
)
function Leadtools.Codecs.RasterCodecs.LoadPsdChannel(
fileName ,
bitsPerPixel ,
order ,
channelIndex ,
channelInfo
)
public:
Leadtools.RasterImage^ LoadPsdChannel(
String^ fileName,
int bitsPerPixel,
Leadtools.Codecs.CodecsLoadByteOrder order,
int channelIndex,
Leadtools.Codecs.CodecsPsdChannelInfo^ channelInfo
)
fileName
A String containing the name of the image file to load.
bitsPerPixel
Resulting image pixel depth. Valid values are:
Value | Meaning |
---|---|
0 | Keep the original file's pixel depth (Do not convert). |
1 to 8 | The specified bits per pixel in the resulting image. |
12 | 12 bits per pixel in the resulting image. |
16 | 16 bits per pixel in the resulting image. |
24 | 24 bits per pixel in the resulting image. |
32 | 32 bits per pixel in the resulting image. |
48 | 48 bits per pixel in the resulting image. |
64 | 64 bits per pixel in the resulting image. |
order
The desired color order.
channelIndex
Index of the channel to load. This index is zero-based. Pass 0 to load the first channel, 1 to load the second channel, etc.
channelInfo
a CodecsPsdChannelInfo object to be updated with information about the loaded channel. Pass a null reference for this parameter if channel information is not needed.
The RasterImage object that this method loads.
Use this method to load PSD files only.
This method works similarly to a normal Load or LoadAsync methods, except that it loads only a channel from a PSD file. It loads the channel specified in channelIndex.
Before calling this method, you may need to get or set file information, such as the number of channels on the file. Refer to CodecsPsdImageInfo.
The number of channels in a file is indicated in CodecsPsdImageInfo.Channels. If this number is 0, the file does not contains any channels and this method should not be called.
This example loads all channels from a PSD file
using Leadtools;
using Leadtools.Codecs;
using Leadtools.ImageProcessing;
using Leadtools.ImageProcessing.Color;
using Leadtools.Svg;
using LeadtoolsExamples.Common;
public void LoadPsdChannels()
{
RasterCodecs codecs = new RasterCodecs();
string srcFileName = Path.Combine(LEAD_VARS.ImagesDir, "Sunflower.psd");
CodecsImageInfo imageInfo = codecs.GetInformation(srcFileName, false);
for (int iCount = 0; iCount < imageInfo.Psd.Channels; iCount++)
{
CodecsPsdChannelInfo ChannelInfo = new CodecsPsdChannelInfo();
RasterImage ChannelImage = codecs.LoadPsdChannel(srcFileName, 0, CodecsLoadByteOrder.Rgb, iCount, ChannelInfo);
string destFileName = Path.Combine(LEAD_VARS.ImagesDir, "Channel_");
destFileName = destFileName + iCount + ".Bmp";
codecs.Save(ChannelImage, destFileName, RasterImageFormat.Bmp, ChannelImage.BitsPerPixel);
ChannelImage.Dispose();
}
// Clean up
codecs.Dispose();
}
static class LEAD_VARS
{
public const string ImagesDir = @"C:\Users\Public\Documents\LEADTOOLS Images";
}
Imports Leadtools
Imports Leadtools.Codecs
Imports Leadtools.ImageProcessing
Imports Leadtools.ImageProcessing.Color
Imports Leadtools.Drawing
Imports Leadtools.Svg
Public Sub LoadPsdChannels()
Dim codecs As New RasterCodecs()
Dim srcFileName As String = Path.Combine(LEAD_VARS.ImagesDir, "Sunflower.psd")
Dim imageInfo As CodecsImageInfo = codecs.GetInformation(srcFileName, False)
For iCount As Integer = 0 To imageInfo.Psd.Channels - 1
Dim ChannelInfo As New CodecsPsdChannelInfo()
Dim ChannelImage As RasterImage = codecs.LoadPsdChannel(srcFileName, 0, CodecsLoadByteOrder.Rgb, iCount, ChannelInfo)
Dim destFileName As String = Path.Combine(LEAD_VARS.ImagesDir, "Channel_")
destFileName = destFileName & iCount & ".Bmp"
codecs.Save(ChannelImage, destFileName, RasterImageFormat.Bmp, ChannelImage.BitsPerPixel)
ChannelImage.Dispose()
Next
' Clean up
codecs.Dispose()
End Sub
Public NotInheritable Class LEAD_VARS
Public Const ImagesDir As String = "C:\Users\Public\Documents\LEADTOOLS Images"
End Class
Products |
Support |
Feedback: LoadPsdChannel Method - Leadtools.Codecs |
Introduction |
Help Version 19.0.2017.6.16
|
Raster .NET | C API | C++ Class Library | JavaScript HTML5
Document .NET | C API | C++ Class Library | JavaScript HTML5
Medical .NET | C API | C++ Class Library | JavaScript HTML5
Medical Web Viewer .NET
Your email has been sent to support! Someone should be in touch! If your matter is urgent please come back into chat.
Chat Hours:
Monday - Friday, 8:30am to 6pm ET
Thank you for your feedback!
Please fill out the form again to start a new chat.
All agents are currently offline.
Chat Hours:
Monday - Friday
8:30AM - 6PM EST
To contact us please fill out this form and we will contact you via email.