Save(RasterImage,Uri,RasterImageFormat,int) Method (original) (raw)
Summary
Saves a RasterImage to a remote URL in any of the supported compressed or uncompressed formats.
Syntax
Parameters
image
The RasterImage object that holds the image data.
uri
The Uri containing the output URL name.
bitsPerPixel
Resulting file's pixel depth. Note that not all bits per pixel are available to all file formats. For valid values, refer to Summary of All Supported File Formats. If bitsPerPixel is 0, the image will be stored using the closest bits/pixel value supported by that format. For example, if a file format supports 1, 4, and 24 bits/pixel, and RasterImage.BitsPerPixel is 5, the file will be stored as 24 bit. Likewise, if RasterImage.BitsPerPixel is 2, the file will be stored as 4 bit.
Example
using Leadtools;
using Leadtools.Codecs;
using Leadtools.ImageProcessing;
using Leadtools.ImageProcessing.Color;
using Leadtools.Svg;
public void SaveToSharePointExample()
{
RasterCodecs codecs = new RasterCodecs();
// Change the path to a server you have access to
string mySharePointServer = @"http://leadweb3/Shared%20Documents";
string myDocumentFileName = mySharePointServer + "/MyJpegFile.jpg";
RasterImage image = null;
// Create a multi-page TIF file
for (int i = 0; i < 4; i++)
{
string pageFileName = Path.Combine(LEAD_VARS.ImagesDir, "Ocr" + (i + 1).ToString() + ".tif");
RasterImage pageImage = codecs.Load(pageFileName, 0, CodecsLoadByteOrder.BgrOrGray, 1, 1);
if (image == null)
image = pageImage;
else
{
image.AddPage(pageImage);
pageImage.Dispose();
}
}
// We have the image, upload it
// Use the credentials of the logged in user
// Change this if you have different user name/password/domain
// For example:
// codecs.UriOperationCredentials = new System.Net.NetworkCredential("myuser", "mypassword", "mydomain");
codecs.UriOperationCredentials = System.Net.CredentialCache.DefaultCredentials;
// Use the default proxy
codecs.UriOperationProxy = WebRequest.DefaultWebProxy;
// Upload the second page of the file to the server as JPEG
codecs.Save(image, new Uri(myDocumentFileName), RasterImageFormat.Jpeg, 24, 2, 2);
image.Dispose();
codecs.Dispose();
}
static class LEAD_VARS
{
public const string ImagesDir = @"C:\LEADTOOLS22\Resources\Images";
}
Leadtools.Codecs Assembly
CompactFile(Stream,Stream,int,int,bool,int,int,bool,int,CodecsSavePageMode,bool,bool) Method
CompactFile(Stream,Stream,int,int,bool,long,int,bool,long,CodecsSavePageMode,bool,bool,bool) Method
CompactFile(string,string,int,int,bool,int,int,bool,int,CodecsSavePageMode,bool,bool) Method
CompactFile(string,string,int,int,bool,long,int,bool,long,CodecsSavePageMode,bool,bool,bool) Method