Leadtools.Codecs Namespace > CodecsLoadOptions Class : AllocateImage Property |
public bool AllocateImage {get; set;}
'Declaration Public Property AllocateImage As Boolean
'Usage Dim instance As CodecsLoadOptions Dim value As Boolean instance.AllocateImage = value value = instance.AllocateImage
public bool AllocateImage {get; set;}
get_AllocateImage();
set_AllocateImage(value);
Public Sub AllocateImageExample() Dim codecs As RasterCodecs = New RasterCodecs() 'Setting the loading options. 'allow LEADTOOLS to allocate the image data codecs.Options.Load.AllocateImage = True 'keeping the loaded image data compressed in memory. codecs.Options.Load.Compressed = True codecs.Options.Load.DiskMemory = False 'force a palletized image to be dithered to the LEAD fixed palette. codecs.Options.Load.FixedPalette = True 'we know the format of the file codecs.Options.Load.Format = RasterImageFormat.Cmp 'disable loading metadata markers if present in the file, false to ignore them. codecs.Options.Load.Markers = False codecs.Options.Load.NoDiskMemory = True codecs.Options.Load.NoInterlace = False codecs.Options.Load.NoTiledMemory = True codecs.Options.Load.Passes = 0 'ignore the view perspective stored in the file. codecs.Options.Load.Rotated = False 'set negative pixel values to 0. codecs.Options.Load.Signed = False codecs.Options.Load.InitAlpha = True codecs.Options.Load.StoreDataInImage = True 'load super-compressed in memory codecs.Options.Load.SuperCompressed = True codecs.Options.Load.TiledMemory = False codecs.Options.Load.XResolution = 350 codecs.Options.Load.YResolution = 350 Dim image As RasterImage = codecs.Load(Path.Combine(LEAD_VARS.ImagesDir, "Image1.cmp")) 'Meta file's comments will be saved. codecs.Options.Save.Comments = True codecs.Options.Save.FixedPalette = True codecs.Options.Save.GeoKeys = False 'Tiff file output will be gray. codecs.Options.Save.GrayOutput = True 'Meta file's markers will be saved. codecs.Options.Save.Markers = True codecs.Options.Save.MotorolaOrder = False codecs.Options.Save.OptimizedPalette = True codecs.Options.Save.Password = "LEADTOOLS" Dim resolutions As LeadSize() = New LeadSize(0) {} resolutions(0).Width = 350 resolutions(0).Height = 350 codecs.Options.Save.SetResolutions(resolutions) 'Meta file's tags will be saved. codecs.Options.Save.Tags = True codecs.Options.Save.UseImageDitheringMethod = True codecs.Save(image, Path.Combine(LEAD_VARS.ImagesDir, "allocate_image.tif"), RasterImageFormat.Tif, 8, 1, image.PageCount, 1, CodecsSavePageMode.Overwrite) ' Clean up image.Dispose() codecs.Dispose() End Sub Public NotInheritable Class LEAD_VARS Public Const ImagesDir As String = "C:\Users\Public\Documents\LEADTOOLS Images" End Class
public void AllocateImageExample() { RasterCodecs codecs = new RasterCodecs(); //Setting the loading options. //allow LEADTOOLS to allocate the image data codecs.Options.Load.AllocateImage = true; //keeping the loaded image data compressed in memory. codecs.Options.Load.Compressed = true; codecs.Options.Load.DiskMemory = false; //force a palletized image to be dithered to the LEAD fixed palette. codecs.Options.Load.FixedPalette = true; //we know the format of the file codecs.Options.Load.Format = RasterImageFormat.Cmp; //disable loading metadata markers if present in the file, false to ignore them. codecs.Options.Load.Markers = false; codecs.Options.Load.NoDiskMemory = true; codecs.Options.Load.NoInterlace = false; codecs.Options.Load.NoTiledMemory = true; codecs.Options.Load.Passes = 0; //ignore the view perspective stored in the file. codecs.Options.Load.Rotated = false; //set negative pixel values to 0. codecs.Options.Load.Signed = false; codecs.Options.Load.InitAlpha = true; codecs.Options.Load.StoreDataInImage = true; //load super-compressed in memory codecs.Options.Load.SuperCompressed = true; codecs.Options.Load.TiledMemory = false; codecs.Options.Load.XResolution = 350; codecs.Options.Load.YResolution = 350; RasterImage image = codecs.Load(Path.Combine(LEAD_VARS.ImagesDir, "Image1.cmp")); //Meta file's comments will be saved. codecs.Options.Save.Comments = true; codecs.Options.Save.FixedPalette = true; codecs.Options.Save.GeoKeys = false; //Tiff file output will be gray. codecs.Options.Save.GrayOutput = true; //Meta file's markers will be saved. codecs.Options.Save.Markers = true; codecs.Options.Save.MotorolaOrder = false; codecs.Options.Save.OptimizedPalette = true; codecs.Options.Save.Password = "LEADTOOLS"; LeadSize[] resolutions = new LeadSize[1]; resolutions[0].Width = 350; resolutions[0].Height = 350; codecs.Options.Save.SetResolutions(resolutions); //Meta file's tags will be saved. codecs.Options.Save.Tags = true; codecs.Options.Save.UseImageDitheringMethod = true; codecs.Save(image, Path.Combine(LEAD_VARS.ImagesDir, "allocate_image.tif"), RasterImageFormat.Tif, 8, 1, image.PageCount, 1, CodecsSavePageMode.Overwrite); // Clean up image.Dispose(); codecs.Dispose(); } static class LEAD_VARS { public const string ImagesDir = @"C:\Users\Public\Documents\LEADTOOLS Images"; }
CodecsOptionsExamples.prototype.AllocateImageExample = function () { Tools.SetLicense ( ) ; with (Leadtools) { with (Leadtools.Codecs) { var codecs = new RasterCodecs(); //Setting the loading options. //allow LEADTOOLS to allocate the image data codecs.options.load.allocateImage = true; //keeping the loaded image data compressed in memory. codecs.options.load.compressed = true; codecs.options.load.diskMemory = false; //force a palletized image to be dithered to the LEAD fixed palette. codecs.options.load.fixedPalette = true; //we know the format of the file codecs.options.load.format = RasterImageFormat.Cmp; //disable loading metadata markers if present in the file, false to ignore them. codecs.options.load.markers = false; codecs.options.load.noDiskMemory = true; codecs.options.load.noInterlace = false; codecs.options.load.noTiledMemory = true; codecs.options.load.passes = 0; //ignore the view perspective stored in the file. codecs.options.load.rotated = false; //set negative pixel values to 0. codecs.options.load.signed = false; codecs.options.load.initAlpha = true; codecs.options.load.storeDataInImage = true; //load super-compressed in memory codecs.options.load.superCompressed = true; codecs.options.load.tiledMemory = false; codecs.options.load.xresolution = 350; codecs.options.load.yresolution = 350; var image; var srcFileName = "Assets\\Image1.cmp"; return Tools.AppInstallFolder().getFileAsync(srcFileName).then(function (loadFile) { return codecs.loadAsync(LeadStreamFactory.create(loadFile)) }) .then(function (img) { image = img; //Meta file's comments will be saved. codecs.options.save.comments = true; codecs.options.save.fixedPalette = true; codecs.options.save.geoKeys = false; //Tiff file output will be gray. codecs.options.save.grayOutput = true; //Meta file's markers will be saved. codecs.options.save.markers = true; codecs.options.save.motorolaOrder = false; codecs.options.save.optimizedPalette = true; codecs.options.save.password = "LEADTOOLS"; var resolutions = []; resolutions[0] = {width:0, height:0}; resolutions[0].width = 350; resolutions[0].height = 350; codecs.options.save.setResolutions(resolutions); //Meta file's tags will be saved. codecs.options.save.tags = true; codecs.options.save.useImageDitheringMethod = true; var destFileName = "allocate_image.tif"; return Tools.AppLocalFolder().createFileAsync(destFileName) }) .then(function (saveFile) { return codecs.saveAsync(image, LeadStreamFactory.create(saveFile), RasterImageFormat.tif, 8, 1, image.pageCount, 1, CodecsSavePageMode.overwrite); // Clean up image.close(); codecs.close(); }); } } }
[TestMethod] public async Task AllocateImageExample() { RasterCodecs codecs = new RasterCodecs(); try { //Setting the loading options. //allow LEADTOOLS to allocate the image data codecs.Options.Load.AllocateImage = true; //keeping the loaded image data compressed in memory. codecs.Options.Load.Compressed = true; codecs.Options.Load.DiskMemory = false; //force a palletized image to be dithered to the LEAD fixed palette. codecs.Options.Load.FixedPalette = true; //we know the format of the file codecs.Options.Load.Format = RasterImageFormat.Cmp; //disable loading metadata markers if present in the file, false to ignore them. codecs.Options.Load.Markers = false; codecs.Options.Load.NoDiskMemory = true; codecs.Options.Load.NoInterlace = false; codecs.Options.Load.NoTiledMemory = true; codecs.Options.Load.Passes = 0; //ignore the view perspective stored in the file. codecs.Options.Load.Rotated = false; //set negative pixel values to 0. codecs.Options.Load.Signed = false; codecs.Options.Load.InitAlpha = true; codecs.Options.Load.StoreDataInImage = true; //load super-compressed in memory codecs.Options.Load.SuperCompressed = true; codecs.Options.Load.TiledMemory = false; codecs.Options.Load.XResolution = 350; codecs.Options.Load.YResolution = 350; string srcFileName = @"Assets\Image1.cmp"; StorageFile loadFile = await Tools.AppInstallFolder.GetFileAsync(srcFileName); RasterImage image = await codecs.LoadAsync(LeadStreamFactory.Create(loadFile)); //Meta file's comments will be saved. codecs.Options.Save.Comments = true; codecs.Options.Save.FixedPalette = true; codecs.Options.Save.GeoKeys = false; //Tiff file output will be gray. codecs.Options.Save.GrayOutput = true; //Meta file's markers will be saved. codecs.Options.Save.Markers = true; codecs.Options.Save.MotorolaOrder = false; codecs.Options.Save.OptimizedPalette = true; codecs.Options.Save.Password = "LEADTOOLS"; LeadSize[] resolutions = new LeadSize[1]; resolutions[0].Width = 350; resolutions[0].Height = 350; codecs.Options.Save.SetResolutions(resolutions); //Meta file's tags will be saved. codecs.Options.Save.Tags = true; codecs.Options.Save.UseImageDitheringMethod = true; string destFileName = @"allocate_image.tif"; StorageFile saveFile = await Tools.AppLocalFolder.CreateFileAsync(destFileName); await codecs.SaveAsync(image, LeadStreamFactory.Create(saveFile), RasterImageFormat.Tif, 8, 1, image.PageCount, 1, CodecsSavePageMode.Overwrite); // Clean up image.Dispose(); codecs.Dispose(); } catch (Exception ex) { string error = ""; RasterException rasterException = RasterException.FromHResult(ex.HResult); if (rasterException != null) error = rasterException.Message; else error = ex.Message; Debug.WriteLine(error); Assert.Fail(error); } }
public void AllocateImageExample(Stream inStreamCmp, Stream outStreamTif) { RasterCodecs codecs = new RasterCodecs(); //Setting the loading options. //allow LEADTOOLS to allocate the image data codecs.Options.Load.AllocateImage = true; //force a palletized image to be dithered to the LEAD fixed palette. codecs.Options.Load.FixedPalette = true; //we know the format of the file codecs.Options.Load.Format = RasterImageFormat.Cmp; //disable loading metadata markers if present in the file, false to ignore them. codecs.Options.Load.Markers = false; codecs.Options.Load.NoInterlace = false; codecs.Options.Load.Passes = 0; //ignore the view perspective stored in the file. codecs.Options.Load.Rotated = false; //set negative pixel values to 0. codecs.Options.Load.Signed = false; codecs.Options.Load.InitAlpha = true; codecs.Options.Load.StoreDataInImage = true; //load super-compressed in memory codecs.Options.Load.XResolution = 350; codecs.Options.Load.YResolution = 350; RasterImage image = codecs.Load(inStreamCmp); //Meta file's comments will be saved. codecs.Options.Save.Comments = true; codecs.Options.Save.FixedPalette = true; codecs.Options.Save.GeoKeys = false; //Tiff file output will be gray. codecs.Options.Save.GrayOutput = true; //Meta file's markers will be saved. codecs.Options.Save.Markers = true; codecs.Options.Save.MotorolaOrder = false; codecs.Options.Save.OptimizedPalette = true; codecs.Options.Save.Password = "LEADTOOLS"; LeadSize[] resolutions = new LeadSize[1]; resolutions[0].Width = 350; resolutions[0].Height = 350; codecs.Options.Save.SetResolutions(resolutions); //Meta file's tags will be saved. codecs.Options.Save.Tags = true; codecs.Options.Save.UseImageDitheringMethod = true; codecs.Save(image, outStreamTif, RasterImageFormat.Tif, 8, 1, image.PageCount, 1, CodecsSavePageMode.Overwrite); // Clean up image.Dispose(); }
Public Sub AllocateImageExample(ByVal inStreamCmp As Stream, ByVal outStreamTif As Stream)
Dim codecs As RasterCodecs = New RasterCodecs()
'Setting the loading options.
'allow LEADTOOLS to allocate the image data
codecs.Options.Load.AllocateImage = True
'force a palletized image to be dithered to the LEAD fixed palette.
codecs.Options.Load.FixedPalette = True
'we know the format of the file
codecs.Options.Load.Format = RasterImageFormat.Cmp
'disable loading metadata markers if present in the file, false to ignore them.
codecs.Options.Load.Markers = False
codecs.Options.Load.NoInterlace = False
codecs.Options.Load.Passes = 0
'ignore the view perspective stored in the file.
codecs.Options.Load.Rotated = False
'set negative pixel values to 0.
codecs.Options.Load.Signed = False
codecs.Options.Load.InitAlpha = True
codecs.Options.Load.StoreDataInImage = True
'load super-compressed in memory
codecs.Options.Load.XResolution = 350
codecs.Options.Load.YResolution = 350
Dim image As RasterImage = codecs.Load(inStreamCmp)
'Meta file's comments will be saved.
codecs.Options.Save.Comments = True
codecs.Options.Save.FixedPalette = True
codecs.Options.Save.GeoKeys = False
'Tiff file output will be gray.
codecs.Options.Save.GrayOutput = True
'Meta file's markers will be saved.
codecs.Options.Save.Markers = True
codecs.Options.Save.MotorolaOrder = False
codecs.Options.Save.OptimizedPalette = True
codecs.Options.Save.Password = "LEADTOOLS"
Dim resolutions As LeadSize() = New LeadSize(0){}
resolutions(0).Width = 350
resolutions(0).Height = 350
codecs.Options.Save.SetResolutions(resolutions)
'Meta file's tags will be saved.
codecs.Options.Save.Tags = True
codecs.Options.Save.UseImageDitheringMethod = True
codecs.Save(image, outStreamTif, RasterImageFormat.Tif, 8, 1, image.PageCount, 1, CodecsSavePageMode.Overwrite)
' Clean up
image.Dispose()
End Sub
Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2