Class BmpImage

Class BmpImage

İsim alanı : Aspose.Imaging.FileFormats.Bmp Toplantı: Aspose.Imaging.dll (25.4.0)

Bitmap (BMP) ve Device Independent Bitmap’ı kolayca işleyebilirsiniz.(DIB) dosyaları, etkili manipülasyon ve raster işleme kolaylaştırmakGörüntüler üzerinde çeşitli işlemleri gerçekleştirerek, bu APIiş akışı, geliştiricilere BMP ile çalışmak için güvenilir bir araç kit sunar veDIB biçimleri kendi yazılım uygulamalarında.

[JsonObject(MemberSerialization.OptIn)]
public sealed class BmpImage : RasterCachedImage, IDisposable, IObjectWithBounds, IRasterImageArgb32PixelLoader, IRasterImageRawDataLoader, IHasXmpData, IHasMetadata

Inheritance

object DisposableObject DataStreamSupporter Image RasterImage RasterCachedImage BmpImage

Implements

IDisposable , IObjectWithBounds , IRasterImageArgb32PixelLoader , IRasterImageRawDataLoader , IHasXmpData , IHasMetadata

mirasçı üyeleri

RasterCachedImage.CacheData() , RasterCachedImage.Blend(Point, RasterImage, Rectangle, byte) , RasterCachedImage.Resize(int, int, ResizeType) , RasterCachedImage.Resize(int, int, ImageResizeSettings) , RasterCachedImage.RotateFlip(RotateFlipType) , RasterCachedImage.Rotate(float, bool, Color) , RasterCachedImage.Crop(Rectangle) , RasterCachedImage.Dither(DitheringMethod, int, IColorPalette) , RasterCachedImage.Grayscale() , RasterCachedImage.NormalizeHistogram() , RasterCachedImage.BinarizeFixed(byte) , RasterCachedImage.BinarizeOtsu() , RasterCachedImage.BinarizeBradley(double, int) , RasterCachedImage.BinarizeBradley(double) , RasterCachedImage.AdjustBrightness(int) , RasterCachedImage.AdjustContrast(float) , RasterCachedImage.AdjustGamma(float, float, float) , RasterCachedImage.AdjustGamma(float) , RasterCachedImage.IsCached , RasterImage.RemoveMetadata() , RasterImage.Save(Stream, ImageOptionsBase, Rectangle) , RasterImage.GetModifyDate(bool) , RasterImage.Dither(DitheringMethod, int) , RasterImage.Dither(DitheringMethod, int, IColorPalette) , RasterImage.GetDefaultPixels(Rectangle, IPartialArgb32PixelLoader) , RasterImage.GetDefaultRawData(Rectangle, IPartialRawDataLoader, RawDataSettings) , RasterImage.GetDefaultArgb32Pixels(Rectangle) , RasterImage.GetDefaultRawData(Rectangle, RawDataSettings) , RasterImage.GetArgb32Pixel(int, int) , RasterImage.GetPixel(int, int) , RasterImage.SetArgb32Pixel(int, int, int) , RasterImage.SetPixel(int, int, Color) , RasterImage.ReadScanLine(int) , RasterImage.ReadArgb32ScanLine(int) , RasterImage.WriteScanLine(int, Color[]) , RasterImage.WriteArgb32ScanLine(int, int[]) , RasterImage.LoadPartialArgb32Pixels(Rectangle, IPartialArgb32PixelLoader) , RasterImage.LoadPartialPixels(Rectangle, IPartialPixelLoader) , RasterImage.LoadArgb32Pixels(Rectangle) , RasterImage.LoadArgb64Pixels(Rectangle) , RasterImage.LoadPartialArgb64Pixels(Rectangle, IPartialArgb64PixelLoader) , RasterImage.LoadPixels(Rectangle) , RasterImage.LoadCmykPixels(Rectangle) , RasterImage.LoadCmyk32Pixels(Rectangle) , RasterImage.LoadRawData(Rectangle, RawDataSettings, IPartialRawDataLoader) , RasterImage.LoadRawData(Rectangle, Rectangle, RawDataSettings, IPartialRawDataLoader) , RasterImage.SaveRawData(byte[], int, Rectangle, RawDataSettings) , RasterImage.SaveArgb32Pixels(Rectangle, int[]) , RasterImage.SavePixels(Rectangle, Color[]) , RasterImage.SaveCmykPixels(Rectangle, CmykColor[]) , RasterImage.SaveCmyk32Pixels(Rectangle, int[]) , RasterImage.SetResolution(double, double) , RasterImage.SetPalette(IColorPalette, bool) , RasterImage.Resize(int, int, ImageResizeSettings) , RasterImage.Rotate(float, bool, Color) , RasterImage.Rotate(float) , RasterImage.BinarizeFixed(byte) , RasterImage.BinarizeOtsu() , RasterImage.BinarizeBradley(double) , RasterImage.BinarizeBradley(double, int) , RasterImage.Blend(Point, RasterImage, Rectangle, byte) , RasterImage.Blend(Point, RasterImage, byte) , RasterImage.Grayscale() , RasterImage.NormalizeHistogram() , RasterImage.AdjustBrightness(int) , RasterImage.AdjustContrast(float) , RasterImage.AdjustGamma(float, float, float) , RasterImage.AdjustGamma(float) , RasterImage.GetSkewAngle() , RasterImage.NormalizeAngle() , RasterImage.NormalizeAngle(bool, Color) , RasterImage.Filter(Rectangle, FilterOptionsBase) , RasterImage.ReplaceColor(Color, byte, Color) , RasterImage.ReplaceColor(int, byte, int) , RasterImage.ReplaceNonTransparentColors(Color) , RasterImage.ReplaceNonTransparentColors(int) , RasterImage.ToBitmap() , RasterImage.PremultiplyComponents , RasterImage.UseRawData , RasterImage.UpdateXmpData , RasterImage.XmpData , RasterImage.RawIndexedColorConverter , RasterImage.RawCustomColorConverter , RasterImage.RawFallbackIndex , RasterImage.RawDataSettings , RasterImage.UsePalette , RasterImage.RawDataFormat , RasterImage.RawLineSize , RasterImage.IsRawDataAvailable , RasterImage.HorizontalResolution , RasterImage.VerticalResolution , RasterImage.HasTransparentColor , RasterImage.HasAlpha , RasterImage.TransparentColor , RasterImage.ImageOpacity , Image.CanLoad(string) , Image.CanLoad(string, LoadOptions) , Image.CanLoad(Stream) , Image.CanLoad(Stream, LoadOptions) , Image.Create(ImageOptionsBase, int, int) , Image.Create(Image[]) , Image.Create(MultipageCreateOptions) , Image.Create(string[], bool) , Image.Create(string[]) , Image.Create(Image[], bool) , Image.GetFileFormat(string) , Image.GetFileFormat(Stream) , Image.GetFittingRectangle(Rectangle, int, int) , Image.GetFittingRectangle(Rectangle, int[], int, int) , Image.Load(string, LoadOptions) , Image.Load(string) , Image.Load(Stream, LoadOptions) , Image.Load(Stream) , Image.GetProportionalWidth(int, int, int) , Image.GetProportionalHeight(int, int, int) , Image.RemoveMetadata() , Image.CanSave(ImageOptionsBase) , Image.Resize(int, int) , Image.Resize(int, int, ResizeType) , Image.Resize(int, int, ImageResizeSettings) , Image.GetDefaultOptions(object[]) , Image.GetOriginalOptions() , Image.ResizeWidthProportionally(int) , Image.ResizeHeightProportionally(int) , Image.ResizeWidthProportionally(int, ResizeType) , Image.ResizeHeightProportionally(int, ResizeType) , Image.ResizeWidthProportionally(int, ImageResizeSettings) , Image.ResizeHeightProportionally(int, ImageResizeSettings) , Image.RotateFlip(RotateFlipType) , Image.Rotate(float) , Image.Crop(Rectangle) , Image.Crop(int, int, int, int) , Image.Save() , Image.Save(string) , Image.Save(string, ImageOptionsBase) , Image.Save(string, ImageOptionsBase, Rectangle) , Image.Save(Stream, ImageOptionsBase) , Image.Save(Stream, ImageOptionsBase, Rectangle) , Image.GetSerializedStream(ImageOptionsBase, Rectangle, out int) , Image.SetPalette(IColorPalette, bool) , Image.BitsPerPixel , Image.Bounds , Image.Container , Image.Height , Image.Palette , Image.UsePalette , Image.Size , Image.Width , Image.InterruptMonitor , Image.BufferSizeHint , Image.AutoAdjustPalette , Image.HasBackgroundColor , Image.FileFormat , Image.BackgroundColor , DataStreamSupporter.CacheData() , DataStreamSupporter.Save() , DataStreamSupporter.Save(Stream) , DataStreamSupporter.Save(string) , DataStreamSupporter.Save(string, bool) , DataStreamSupporter.DataStreamContainer , DataStreamSupporter.IsCached , DisposableObject.Dispose() , DisposableObject.Disposed , object.GetType() , object.ToString() , object.Equals(object?) , object.Equals(object?, object?) , object.ReferenceEquals(object?, object?) , object.GetHashCode()

Examples

Önceden DXT1 kompresyon algoritması kullanılarak sıkıştırılmış BMP görüntüsü.

using (var image = Image.Load("CompressedTiger.bmp"))
                                                                                                 {
                                                                                                     image.Save("DecompressedTiger.bmp", new BmpOptions());
                                                                                                 }

BMP görüntüsünü DXT1 kompresyon algoritması kullanarak sıkıştırın.

using (var image = Image.Load("Tiger.bmp"))
                                                               {
                                                                   image.Save("CompressedTiger.bmp", new BmpOptions { Compression = BitmapCompression.Dxt1 });
                                                               }

Örnek, Telea algoritması ile Graphics Path kullanarak görüntüden herhangi bir nesneyi nasıl kaldırılacağını gösterir.

var imageFilePath = "ball.png"; 
                                                                                                              using (var image = Image.Load(imageFilePath))
                                                                                                              {
                                                                                                                  var pngImage = (PngImage)image;

                                                                                                                  var mask = new GraphicsPath();
                                                                                                                  var firstFigure = new Figure();
                                                                                                                  firstFigure.AddShape(new EllipseShape(new RectangleF(350, 170, 570 - 350, 400 - 170)));
                                                                                                                  mask.AddFigure(firstFigure);

                                                                                                                  var options = new TeleaWatermarkOptions(mask);

                                                                                                                  var result = WatermarkRemover.PaintOver(pngImage, options);

                                                                                                                  result.Save(outputPath);
                                                                                                              }

Örnek, Rgb kompresyon tipi ile bir BmpImage nasıl ihraç edileceğini gösterir.

string sourcePath = "input.png";
                                                                                    // Load a PNG image from a file.
                                                                                    using (Image pngImage = Image.Load(sourcePath))
                                                                                    {
                                                                                        // BMP image is saved with transparency support by default, that is achieved by using the BitmapCompression.Bitfields compression method. 
                                                                                        // To save a BMP image with the Rgb compression method, the BmpOptions with the Compression property set to BitmapCompression.Rgb should be specified.
                                                                                        pngImage.Save(outputPath, new BmpOptions() { Compression = BitmapCompression.Rgb });
                                                                                    }

Örnek, herhangi bir nesneyi görüntüden Görüntüleme Yolu ile İçerik Bilinçli doldurma algoritması kullanarak nasıl kaldırılacağını gösterir.

var imageFilePath = "ball.png"; 
                                                                                                                           using (var image = Image.Load(imageFilePath))
                                                                                                                           {
                                                                                                                               var pngImage = (PngImage)image;

                                                                                                                               var mask = new GraphicsPath();
                                                                                                                               var firstFigure = new Figure();
                                                                                                                               firstFigure.AddShape(new EllipseShape(new RectangleF(350, 170, 570 - 350, 400 - 170)));
                                                                                                                               mask.AddFigure(firstFigure);

                                                                                                                               var options = new ContentAwareFillWatermarkOptions(mask) 
                                                                                                                               { 
                                                                                                                                   MaxPaintingAttempts = 4
                                                                                                                               };

                                                                                                                               var result = WatermarkRemover.PaintOver(pngImage, options);

                                                                                                                               result.Save(outputPath);
                                                                                                                           }

Aşağıdaki örnek, belirtilen büyüklüğün bir BMP görüntüsünü nasıl oluşturacağınızı gösterir.

string dir = "c:\\temp\\";

                                                                                       // Create a BMP image 100 x 100 px.
                                                                                       using (Aspose.Imaging.FileFormats.Bmp.BmpImage bmpImage = new Aspose.Imaging.FileFormats.Bmp.BmpImage(100, 100))
                                                                                       {
                                                                                           // Fill the image with a simple linear red-black gradient.
                                                                                           int width = bmpImage.Width;
                                                                                           int height = bmpImage.Height;
                                                                                           for (int y = 0; y < height; y++)
                                                                                           {
                                                                                               for (int x = 0; x < width; x++)
                                                                                               {
                                                                                                   int hue = (255 * x) / width;
                                                                                                   bmpImage.SetPixel(x, y, Aspose.Imaging.Color.FromArgb(255, hue, 0, 0));
                                                                                               }
                                                                                           }

                                                                                           using (System.IO.FileStream stream = new System.IO.FileStream(dir + "output.bmp", System.IO.FileMode.Create))
                                                                                           {
                                                                                               bmpImage.Save(stream);
                                                                                           }
                                                                                       }

Örnek, alfa kanalı tutarken bir Png dosyasından bir BmpImage’ı nasıl ihraç edeceğinizi gösterir, bir Bmp dosyasını şeffaflıkla kaydeder.

string sourcePath = "input.png";
                                                                                                                                         // Load a PNG image from a file.
                                                                                                                                         using (Image pngImage = Image.Load(sourcePath))
                                                                                                                                         {
                                                                                                                                             // BMP image is saved with transparency support by default. 
                                                                                                                                             // If you want to explicitly specify such mode, the BmpOptions's Compression property should be set to BitmapCompression.Bitfields.
                                                                                                                                             // The BitmapCompression.Bitfields compression method is the default compression method in the BmpOptions.
                                                                                                                                             // So the same result of exporting a Bmp image with transparency can be achieved by either one of the following ways.
                                                                                                                                             // With an implicit default options:
                                                                                                                                             pngImage.Save(outputPath);
                                                                                                                                             // With an explicit default options:
                                                                                                                                             pngImage.Save(outputPath, new BmpOptions());
                                                                                                                                             // Specifying the BitmapCompression.Bitfields compression method:
                                                                                                                                             pngImage.Save(outputPath, new BmpOptions() { Compression = BitmapCompression.Bitfields });
                                                                                                                                         }

Constructors

BmpImage(Sırt)

BmpImage sınıfını bu yapımcıyla çaba sarf etmeden kullanmaya başlayınyeni bir örnek başlatır. geliştiriciler için mükemmel veAspose.Imaging.FileFormats.Bmp.BmpImage nesneleri hızlı ve verimli bir şekilde çalıştırın.

public BmpImage(string path)

Parameters

path string

Görüntü yükleme ve piksel ve palet verileri ile başlatma yolu.

Examples

Örnek, bir dosyadan bir BmpImage nasıl yüklendiğini gösterir.

string dir = "c:\\temp\\";

                                                                // Load a BMP image from a file.
                                                                // The source pixels will be converted to 32-bpp format if required.
                                                                using (Aspose.Imaging.FileFormats.Bmp.BmpImage bmpImage = new Aspose.Imaging.FileFormats.Bmp.BmpImage(dir + "sample.bmp"))
                                                                {
                                                                    // Do some image processing.
                                                                    // Save to another BMP file.
                                                                    bmpImage.Save(dir + "sample.output.32bpp.bmp");
                                                                }

Exceptions

ArgumentNullException

Raster görüntüsü sıfırdır.

BmpImageException

Yükseklik olumlu olmalıdır.

ArgumentException

Palet, piksel başına 8 bit veya daha az olan görüntüler için belirtilmelidir.

BmpImage(çubuk, ushort, BitmapCompression, çift, çift)

Bu yapılandırıcı ile Aspose.Imaging.FileFormats.Bmp.BmpImage sınıfının yeni bir örneğini çabucak oluşturun,Path, bitsPerPixel ve kompres gibi belirli parametreleri kullanın. geliştiriciler için idealBmpImage nesneleri hızlı ve verimli bir şekilde başlatmak, doğru kontrol ileGörüntü özellikleri hakkında.

public BmpImage(string path, ushort bitsPerPixel, BitmapCompression compression, double horizontalResolution, double verticalResolution)

Parameters

path string

Görüntü yükleme ve piksel ve palet verileri ile başlatma yolu.

bitsPerPixel ushort

Piksel başına bitler.

compression BitmapCompression

Kullanmak için kompres.

horizontalResolution double

Görüntülü çözünürlük: Görüntülü çözünürlüklü çözünürlüklü çözünürlüklü çözünürlüklü çözünürlüklü çözünürlüklü çözünürlüklü çözünürlüklü çözünürlüklü çözünürlüklü çözünürlüklü çözünürlüklü

verticalResolution double

Vertikal çözünürlük. not yuvarlanma nedeniyle sonuçlanan çözünürlük geçmişten hafifçe farklı olabilir.

Examples

Örnek, belirlenen bit derinliği ve çözünürlüğüne sahip bir dosyadan bir BmpImage nasıl yükleneceğini gösterir.

string dir = "c:\\temp\\";

                                                                                                            // Load a BMP image from a file.
                                                                                                            // The source pixels will be converted to 24-bpp format if required.
                                                                                                            // The resolution will be set to 96 dpi.
                                                                                                            using (Aspose.Imaging.FileFormats.Bmp.BmpImage bmpImage =
                                                                                                                new Aspose.Imaging.FileFormats.Bmp.BmpImage(dir + "sample.bmp", 24, Aspose.Imaging.FileFormats.Bmp.BitmapCompression.Rgb, 96.0, 96.0))
                                                                                                            {
                                                                                                                // Do some image processing.
                                                                                                                // Save to another BMP file.
                                                                                                                bmpImage.Save(dir + "sample.output.24bpp.96dpi.bmp");
                                                                                                            }

Exceptions

ArgumentNullException

Raster görüntüsü sıfırdır.

BmpImageException

Yükseklik olumlu olmalıdır.

ArgumentException

Palet, piksel başına 8 bit veya daha az olan görüntüler için belirtilmelidir.

BmpImage(Stream)

Aspose.Imaging.FileFormats.Bmp.BmpImage sınıfını yeni bir örnek başlatarak çaba göstermeden kullanmaya başlayınbu yapımcı ile, giriş olarak bir akım kullanarak. geliştiriciler için mükemmelÇeşitli veri kaynaklarından BmpImage nesneleriyle çalışmanın uygun bir yolu,Esneklik ve kolaylık sağlamak.

public BmpImage(Stream stream)

Parameters

stream Stream

Görüntüyü yüklemek ve piksel ve palet verileri ile başlatmak için akışı.

Examples

Örnek, bir dosya akışından bir BmpImage nasıl yüklendiğini gösterir.

string dir = "c:\\temp\\";

                                                                       // Load a BMP image from a file stream.
                                                                       // The source pixels will be converted to 32-bpp format if required.
                                                                       using (System.IO.Stream stream = System.IO.File.OpenRead(dir + "sample.bmp"))
                                                                       {
                                                                           using (Aspose.Imaging.FileFormats.Bmp.BmpImage bmpImage = new Aspose.Imaging.FileFormats.Bmp.BmpImage(stream))
                                                                           {
                                                                               // Do some image processing.
                                                                               // Save to another BMP file.
                                                                               bmpImage.Save(dir + "sample.output.32bpp.bmp");
                                                                           }
                                                                       }

Exceptions

ArgumentNullException

Raster görüntüsü sıfırdır.

BmpImageException

Yükseklik olumlu olmalıdır.

ArgumentException

Palet, piksel başına 8 bit veya daha az olan görüntüler için belirtilmelidir.

BmpImage(Stream, ushort, BitmapCompression, çift, çift)

Aspose.Imaging.FileFormats.Bmp.BmpImage sınıfı ile çalışmaya başlayınbir akış kullanan yeni bir örnek, bitsPerPixel gibi belirlenmiş parametrelerle birlikteGeliştiriciler için mükemmel ve basit bir yol bulmak içinBmpImage nesneleri, projelerinde esneklik ve verimlilik sağlar.

public BmpImage(Stream stream, ushort bitsPerPixel, BitmapCompression compression, double horizontalResolution, double verticalResolution)

Parameters

stream Stream

Görüntüyü yüklemek ve piksel ve palet verileri ile başlatmak için akışı.

bitsPerPixel ushort

Piksel başına bitler.

compression BitmapCompression

Kullanmak için kompres.

horizontalResolution double

Görüntülü çözünürlük: Görüntülü çözünürlüklü çözünürlüklü çözünürlüklü çözünürlüklü çözünürlüklü çözünürlüklü çözünürlüklü çözünürlüklü çözünürlüklü çözünürlüklü çözünürlüklü çözünürlüklü

verticalResolution double

Vertikal çözünürlük. not yuvarlanma nedeniyle sonuçlanan çözünürlük geçmişten hafifçe farklı olabilir.

Examples

Örnek, belirlenen bit derinliği ve çözünürlüğü ile bir dosya akışından bir BmpImage nasıl yükleneceğini gösterir.

string dir = "c:\\temp\\";

                                                                                                                   // Load a BMP image from a file stream.
                                                                                                                   // The source pixels will be converted to 24-bpp format if required.
                                                                                                                   // The resolution will be set to 96 dpi.
                                                                                                                   using (System.IO.Stream stream = System.IO.File.OpenRead(dir + "sample.bmp"))
                                                                                                                   {
                                                                                                                       using (Aspose.Imaging.FileFormats.Bmp.BmpImage bmpImage =
                                                                                                                           new Aspose.Imaging.FileFormats.Bmp.BmpImage(stream, 24, Aspose.Imaging.FileFormats.Bmp.BitmapCompression.Rgb, 96.0, 96.0))
                                                                                                                       {
                                                                                                                           // Do some image processing.
                                                                                                                           // Save to another BMP file.
                                                                                                                           bmpImage.Save(dir + "sample.output.24bpp.96dpi.bmp");
                                                                                                                       }
                                                                                                                   }

Exceptions

ArgumentNullException

Raster görüntüsü sıfırdır.

BmpImageException

Yükseklik olumlu olmalıdır.

ArgumentException

Palet, piksel başına 8 bit veya daha az olan görüntüler için belirtilmelidir.

BmpImage(RasterImage)

Sorunsuz bir şekilde Aspose.Imaging.FileFormats.Bmp.BmpImage sınıfının yeni bir örneğini oluşturunbir RasterImage nesne ile başlatarak. geliştiriciler için mükemmelmevcut raster görüntüleri BmpImage biçiminde kesintisiz olarak dönüştürmek,Projelerine kolaylık ve uyumluluk sağlar.

public BmpImage(RasterImage rasterImage)

Parameters

rasterImage RasterImage

Görüntü ile piksel ve palet verileri başlatmak için.

Examples

Örnek, RasterImage’in başka bir örneğinden bir BmpImage’ı nasıl yüklediğini gösterir.

string dir = "c:\\temp\\";

                                                                                         // Create a new PNG image.
                                                                                         Aspose.Imaging.ImageOptions.PngOptions createOptions = new Aspose.Imaging.ImageOptions.PngOptions();
                                                                                         createOptions.Source = new Aspose.Imaging.Sources.StreamSource(new System.IO.MemoryStream(), true);
                                                                                         using (Aspose.Imaging.RasterImage rasterImage = (Aspose.Imaging.RasterImage)Aspose.Imaging.Image.Create(createOptions, 100, 100))
                                                                                         {
                                                                                             // Fill the entire PNG image in red.
                                                                                             Aspose.Imaging.Graphics gr = new Aspose.Imaging.Graphics(rasterImage);
                                                                                             Aspose.Imaging.Brushes.SolidBrush brush = new Aspose.Imaging.Brushes.SolidBrush(Aspose.Imaging.Color.Red);
                                                                                             gr.FillRectangle(brush, rasterImage.Bounds);

                                                                                             // Create a BMP image based on the PNG image.
                                                                                             // The source pixels will be converted to 32-bpp format if required.
                                                                                             using (Aspose.Imaging.FileFormats.Bmp.BmpImage bmpImage = new Aspose.Imaging.FileFormats.Bmp.BmpImage(rasterImage))
                                                                                             {
                                                                                                 // Save to a BMP file
                                                                                                 bmpImage.Save(dir + "output.32bpp.bmp");
                                                                                             }
                                                                                         }

Exceptions

ArgumentNullException

Raster görüntüsü sıfırdır.

BmpImageException

Yükseklik olumlu olmalıdır.

ArgumentException

Palet, piksel başına 8 bit veya daha az olan görüntüler için belirtilmelidir.

BmpImage(RasterImage, ushort, BitmapCompression, çift, çift)

Aspose.Imaging.FileFormats.Bmp.BmpImage sınıfı ile çalışmaya başlayın, yeni bir örnek oluşturarakbir rasterImage kullanarak, bitsPerPixel ve kompresyon gibi belirlenmiş parametrelerle birlikte.BmpImage nesneleri ele almak için basit bir yol arayan geliştiriciler için mükemmel,Projelerinde esneklik ve verimlilik sağlamak.

public BmpImage(RasterImage rasterImage, ushort bitsPerPixel, BitmapCompression compression, double horizontalResolution, double verticalResolution)

Parameters

rasterImage RasterImage

Görüntü ile piksel ve palet verileri başlatmak için.

bitsPerPixel ushort

Piksel başına bitler.

compression BitmapCompression

Kullanmak için kompres.

horizontalResolution double

Görüntülü çözünürlük: Görüntülü çözünürlüklü çözünürlüklü çözünürlüklü çözünürlüklü çözünürlüklü çözünürlüklü çözünürlüklü çözünürlüklü çözünürlüklü çözünürlüklü çözünürlüklü çözünürlüklü

verticalResolution double

Vertikal çözünürlük. not yuvarlanma nedeniyle sonuçlanan çözünürlük geçmişten hafifçe farklı olabilir.

Examples

Örnek, RasterImage’in başka bir örneğinden bir BmpImage’ı belirtilen bit derinliği ve sıkıştırma ile nasıl yükleneceğini gösterir.

string dir = "c:\\temp\\";

                                                                                                                                      // Create a new PNG image.
                                                                                                                                      Aspose.Imaging.ImageOptions.PngOptions createOptions = new Aspose.Imaging.ImageOptions.PngOptions();
                                                                                                                                      createOptions.Source = new Aspose.Imaging.Sources.StreamSource(new System.IO.MemoryStream(), true);
                                                                                                                                      using (Aspose.Imaging.RasterImage rasterImage = (Aspose.Imaging.RasterImage)Aspose.Imaging.Image.Create(createOptions, 100, 100))
                                                                                                                                      {
                                                                                                                                          // Fill the entire PNG image in red.
                                                                                                                                          Aspose.Imaging.Graphics gr = new Aspose.Imaging.Graphics(rasterImage);
                                                                                                                                          Aspose.Imaging.Brushes.SolidBrush brush = new Aspose.Imaging.Brushes.SolidBrush(Aspose.Imaging.Color.Red);
                                                                                                                                          gr.FillRectangle(brush, rasterImage.Bounds);

                                                                                                                                          // Create a BMP image based on the PNG image.
                                                                                                                                          // The source pixels will be converted to 24-bpp format if required.
                                                                                                                                          // The resolution will be set to 96 dpi.
                                                                                                                                          using (Aspose.Imaging.FileFormats.Bmp.BmpImage bmpImage = new Aspose.Imaging.FileFormats.Bmp.BmpImage(rasterImage, 24, Aspose.Imaging.FileFormats.Bmp.BitmapCompression.Rgb, 96.0, 96.0))
                                                                                                                                          {
                                                                                                                                              // Save to a BMP file
                                                                                                                                              bmpImage.Save(dir + "output.24bpp.96dpi.bmp");
                                                                                                                                          }
                                                                                                                                      }

Exceptions

ArgumentNullException

Raster görüntüsü sıfırdır.

BmpImageException

Yükseklik olumlu olmalıdır.

ArgumentException

Palet, piksel başına 8 bit veya daha az olan görüntüler için belirtilmelidir.

BmpImage(int , int , int)

Aspose.Imaging.FileFormats.Bmp.BmpImage sınıfını yeni bir örnek oluşturarak çaba göstermeden kullanmaya başlayınbelirli genişlik ve yükseklik parametreleri ile. geliştiriciler için idealBmpImage nesneleri özelleştirilmiş boyutlarda üretmenin uygun bir yolu,Projelerine kolaylık ve esneklik sağlar.

public BmpImage(int width, int height)

Parameters

width int

Görüntü genişliği.

height int

Görüntü yüksekliği.

Examples

Örnek, belirtilen büyüklükte bir BmpImage nasıl oluşturulacağını gösterir.

string dir = "c:\\temp\\";

                                                                            // Create a 32-bpp BMP image of 100 x 100 px.
                                                                            using (Aspose.Imaging.FileFormats.Bmp.BmpImage bmpImage = new Aspose.Imaging.FileFormats.Bmp.BmpImage(100, 100))
                                                                            {
                                                                                // Fill the entire image in red.
                                                                                Aspose.Imaging.Graphics gr = new Aspose.Imaging.Graphics(bmpImage);
                                                                                Aspose.Imaging.Brushes.SolidBrush brush = new Aspose.Imaging.Brushes.SolidBrush(Aspose.Imaging.Color.Red);
                                                                                gr.FillRectangle(brush, bmpImage.Bounds);

                                                                                // Save to a BMP file
                                                                                bmpImage.Save(dir + "output.bmp");
                                                                            }

Aşağıdaki örnek, çıkış boyutunu azaltmak için bir BMP görüntüsünü nasıl paletize edeceğinizi gösterir.

// Create a BMP image 100 x 100 px.
                                                                                              using (Aspose.Imaging.FileFormats.Bmp.BmpImage bmpImage = new Aspose.Imaging.FileFormats.Bmp.BmpImage(100, 100))
                                                                                              {
                                                                                                  // The linear gradient from the left-top to the right-bottom corner of the image.
                                                                                                  Aspose.Imaging.Brushes.LinearGradientBrush brush =
                                                                                                      new Aspose.Imaging.Brushes.LinearGradientBrush(
                                                                                                          new Aspose.Imaging.Point(0, 0),
                                                                                                          new Aspose.Imaging.Point(bmpImage.Width, bmpImage.Height),
                                                                                                          Aspose.Imaging.Color.Red,
                                                                                                          Aspose.Imaging.Color.Green);

                                                                                                  // Fill the entire image with the linear gradient brush.
                                                                                                  Aspose.Imaging.Graphics gr = new Aspose.Imaging.Graphics(bmpImage);
                                                                                                  gr.FillRectangle(brush, bmpImage.Bounds);

                                                                                                  // Get the closest 8-bit color palette which covers as many pixels as possible, so that a palettized image
                                                                                                  // is almost visually indistinguishable from a non-palletized one.
                                                                                                  Aspose.Imaging.IColorPalette palette = Aspose.Imaging.ColorPaletteHelper.GetCloseImagePalette(bmpImage, 256);

                                                                                                  // 8-bit palette contains at most 256 colors.
                                                                                                  Aspose.Imaging.ImageOptions.BmpOptions saveOptions = new Aspose.Imaging.ImageOptions.BmpOptions();
                                                                                                  saveOptions.Palette = palette;
                                                                                                  saveOptions.BitsPerPixel = 8;

                                                                                                  using (System.IO.MemoryStream stream = new System.IO.MemoryStream())
                                                                                                  {
                                                                                                      bmpImage.Save(stream, saveOptions);
                                                                                                      System.Console.WriteLine("The palettized image size is {0} bytes.", stream.Length);
                                                                                                  }

                                                                                                  using (System.IO.MemoryStream stream = new System.IO.MemoryStream())
                                                                                                  {
                                                                                                      bmpImage.Save(stream);
                                                                                                      System.Console.WriteLine("The non-palettized image size is {0} bytes.", stream.Length);
                                                                                                  }
                                                                                              }

                                                                                              // The output looks like this:
                                                                                              // The palettized image size is 11078 bytes.
                                                                                              // The non-palettized image size is 40054 bytes.

Exceptions

BmpImageException

Yükseklik olumlu olmalıdır.

ArgumentException

Palet, piksel başına 8 bit veya daha az olan görüntüler için belirtilmelidir.

BmpImage(int , int , ushort , IColorPalette)

Aspose.Imaging.FileFormats.Bmp.BmpImage sınıfını yeni bir örnek başlatarak kullanmaya başlayınGenişlik, yükseklik, bit derinlik ve palet gibi parametrelerle.geliştiriciler BmpImage nesneleri oluşturmak için basit bir yol arıyorÖzelleştirilmiş boyutlar ve renk konfigürasyonları, projelerinde esneklik ve verimlilik sağlar.

public BmpImage(int width, int height, ushort bitsPerPixel, IColorPalette palette)

Parameters

width int

Görüntü genişliği.

height int

Görüntü yüksekliği.

bitsPerPixel ushort

Piksel başına bitler.

palette IColorPalette

Renk paleti var.

Examples

Örnek, belirtilen paletle belirtilen büyüklüğün bir BmpImage’ı nasıl oluşturacağınızı gösterir.

string dir = "c:\\temp\\";

                                                                                                       Aspose.Imaging.Color[] paletterColors = new Aspose.Imaging.Color[]
                                                                                                       {
                                                                                                           Aspose.Imaging.Color.Red,
                                                                                                           Aspose.Imaging.Color.Green,
                                                                                                       };

                                                                                                       // Create a monochrome palette which contains only red and green colors.
                                                                                                       Aspose.Imaging.IColorPalette palette = new Aspose.Imaging.ColorPalette(paletterColors);

                                                                                                       // Create a monochrome 1-bpp BMP image of 100 x 100 px.
                                                                                                       using (Aspose.Imaging.FileFormats.Bmp.BmpImage bmpImage = new Aspose.Imaging.FileFormats.Bmp.BmpImage(100, 100, 1, palette))
                                                                                                       {
                                                                                                           Aspose.Imaging.Graphics gr = new Aspose.Imaging.Graphics(bmpImage);

                                                                                                           // Fill the upper half of the image in red.
                                                                                                           Aspose.Imaging.Brushes.SolidBrush redBrush = new Aspose.Imaging.Brushes.SolidBrush(Aspose.Imaging.Color.Red);
                                                                                                           gr.FillRectangle(redBrush, new Aspose.Imaging.Rectangle(0, 0, bmpImage.Width, bmpImage.Height / 2));

                                                                                                           // Fill the lower half of the image in green.
                                                                                                           Aspose.Imaging.Brushes.SolidBrush greenBrush = new Aspose.Imaging.Brushes.SolidBrush(Aspose.Imaging.Color.Green);
                                                                                                           gr.FillRectangle(greenBrush, new Aspose.Imaging.Rectangle(0, bmpImage.Height / 2, bmpImage.Width, bmpImage.Height / 2));

                                                                                                           // Save to BMP
                                                                                                           bmpImage.Save(dir + "output.monochrome.bmp");
                                                                                                       }

Exceptions

BmpImageException

Yükseklik olumlu olmalıdır.

ArgumentException

Palet, piksel başına 8 bit veya daha az olan görüntüler için belirtilmelidir.

BmpImage(int, int, ushort, IColorPalette, BitmapCompression, çift, çift)

Bu yapılandırıcı ile Aspose.Imaging.FileFormats.Bmp.BmpImage sınıfının yeni bir örneğini çabucak oluşturun,genişlik, yükseklik, bitsPerPixel ve palet gibi parametreleri belirler. geliştiriciler için mükemmelBmpImage nesneleri özelleştirilmiş boyutlarla üretmek için uygun bir yol aramakve renk yapılandırmaları, projelerine esneklik ve kolaylık sağlamak.

public BmpImage(int width, int height, ushort bitsPerPixel, IColorPalette palette, BitmapCompression compression, double horizontalResolution, double verticalResolution)

Parameters

width int

Görüntü genişliği.

height int

Görüntü yüksekliği.

bitsPerPixel ushort

Piksel başına bitler.

palette IColorPalette

Renk paleti var.

compression BitmapCompression

Kullanmak için kompres.

horizontalResolution double

Görüntülü çözünürlük: Görüntülü çözünürlüklü çözünürlüklü çözünürlüklü çözünürlüklü çözünürlüklü çözünürlüklü çözünürlüklü çözünürlüklü çözünürlüklü çözünürlüklü çözünürlüklü çözünürlüklü

verticalResolution double

Vertikal çözünürlük. not yuvarlanma nedeniyle sonuçlanan çözünürlük geçmişten hafifçe farklı olabilir.

Examples

Örnek, çeşitli seçenekleri kullanarak bir BmpImage nasıl oluşturulacağını gösterir.

string dir = "c:\\temp\\";

                                                                            Aspose.Imaging.Color[] paletterColors = new Aspose.Imaging.Color[]
                                                                            {
                                                                                Aspose.Imaging.Color.Red,
                                                                                Aspose.Imaging.Color.Green,
                                                                            };

                                                                            // Create a monochrome palette which contains only red and green colors.
                                                                            Aspose.Imaging.IColorPalette palette = new Aspose.Imaging.ColorPalette(paletterColors);

                                                                            // Create a monochrome 1-bpp BMP image of 100 x 100 px.
                                                                            // The horizontal and vertical resolution will be set to 96 dpi.
                                                                            using (Aspose.Imaging.FileFormats.Bmp.BmpImage bmpImage = new Aspose.Imaging.FileFormats.Bmp.BmpImage(100, 100, 1, palette, Aspose.Imaging.FileFormats.Bmp.BitmapCompression.Rgb, 96.0, 96.0))
                                                                            {
                                                                                Aspose.Imaging.Graphics gr = new Aspose.Imaging.Graphics(bmpImage);

                                                                                // Fill the upper half of the image in red.
                                                                                Aspose.Imaging.Brushes.SolidBrush redBrush = new Aspose.Imaging.Brushes.SolidBrush(Aspose.Imaging.Color.Red);
                                                                                gr.FillRectangle(redBrush, new Aspose.Imaging.Rectangle(0, 0, bmpImage.Width, bmpImage.Height / 2));

                                                                                // Fill the lower half of the image in green.
                                                                                Aspose.Imaging.Brushes.SolidBrush greenBrush = new Aspose.Imaging.Brushes.SolidBrush(Aspose.Imaging.Color.Green);
                                                                                gr.FillRectangle(greenBrush, new Aspose.Imaging.Rectangle(0, bmpImage.Height / 2, bmpImage.Width, bmpImage.Height / 2));

                                                                                // Save to a BMP file
                                                                                bmpImage.Save(dir + "output.monochrome.96dpi.bmp");
                                                                            }

Exceptions

BmpImageException

Yükseklik olumlu olmalıdır.

ArgumentException

Palet, piksel başına 8 bit veya daha az olan görüntüler için belirtilmelidir.

Properties

BitmapInfoHeader

Bitmap resminizle ilgili önemli detaylara bu basit işlevi ile hızlı bir şekilde erişebilirsiniz.Geliştiricilerin resimleri için başlık bilgileri almak zorunda kalmaları için mükemmel.

public BitmapInfoHeader BitmapInfoHeader { get; }

Mülkiyet Değer

BitmapInfoHeader

Examples

Aşağıdaki örnek BMP başlığından bilgi alır ve konsoluna yazdırır.

using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Load(@"c:\temp\sample.bmp"))
                                                                                                       {
                                                                                                           Aspose.Imaging.FileFormats.Bmp.BmpImage bmpImage = (Aspose.Imaging.FileFormats.Bmp.BmpImage)image;
                                                                                                           Aspose.Imaging.FileFormats.Bmp.BitmapInfoHeader header = bmpImage.BitmapInfoHeader;

                                                                                                           System.Console.WriteLine("The number of palette colors that are required for displaying the bitmap: {0}", header.BitmapColorsImportant);
                                                                                                           System.Console.WriteLine("The number of palette colors used in the bitmap: {0}", header.BitmapColorsUsed);
                                                                                                           System.Console.WriteLine("The bitmap compression: {0}", header.BitmapCompression);
                                                                                                           System.Console.WriteLine("The bitmap height: {0}", header.BitmapHeight);
                                                                                                           System.Console.WriteLine("The bitmap width: {0}", header.BitmapWidth);
                                                                                                           System.Console.WriteLine("The bitmap raw data size in bytes: {0}", header.BitmapImageSize);
                                                                                                           System.Console.WriteLine("The number of planes: {0}", header.BitmapPlanes);
                                                                                                           System.Console.WriteLine("The horizontal resolution of the bitmap, in pixels-per-meter: {0}", header.BitmapXPelsPerMeter);
                                                                                                           System.Console.WriteLine("The vertical resolution of the bitmap, in pixels-per-meter: {0}", header.BitmapYPelsPerMeter);
                                                                                                           System.Console.WriteLine("The number of bits per pixel: {0}", header.BitsPerPixel);
                                                                                                           System.Console.WriteLine("The extra bits masks: {0}", header.ExtraBitMasks);
                                                                                                           System.Console.WriteLine("The header size in bytes: {0}", header.HeaderSize);
                                                                                                       }

                                                                                                       //The output may look like this:
                                                                                                       //The number of palette colors that are required for displaying the bitmap: 0
                                                                                                       //The number of palette colors used in the bitmap: 0
                                                                                                       //The bitmap compression: 0
                                                                                                       //The bitmap height: 375
                                                                                                       //The bitmap width: 500
                                                                                                       //The bitmap raw data size in bytes: 562500
                                                                                                       //The number of planes: 1
                                                                                                       //The horizontal resolution of the bitmap, in pixels-per-meter: 0
                                                                                                       //The vertical resolution of the bitmap, in pixels-per-meter: 0
                                                                                                       //The number of bits per pixel: 24
                                                                                                       //The extra bits masks: 
                                                                                                       //The header size in bytes: 40

BitsPerPixel

Bu özellik kullanarak görüntü için piksel başına bit sayısına kolayca erişebilirsiniz.Görüntü kalitesi ve derinliği hakkında hızlı bilgi arayan geliştiriciler için mükemmel.

public override int BitsPerPixel { get; }

Mülkiyet Değer

int

Examples

Aşağıdaki örnek, piksel biçimi, görüntü boyutu, çözünürlük, sıkıştırma vb. dahil olmak üzere görüntü hakkında genel bilgileri alır.

using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Load(@"c:\temp\sample.bmp"))
                                                                                                                                              {
                                                                                                                                                  Aspose.Imaging.FileFormats.Bmp.BmpImage bmpImage = (Aspose.Imaging.FileFormats.Bmp.BmpImage)image;                

                                                                                                                                                  System.Console.WriteLine("The pixel format: {0}", bmpImage.RawDataFormat);                
                                                                                                                                                  System.Console.WriteLine("The raw line size in bytes: {0}", bmpImage.RawLineSize);
                                                                                                                                                  System.Console.WriteLine("The bitmap compression: {0}", bmpImage.Compression);
                                                                                                                                                  System.Console.WriteLine("The bitmap width: {0}", bmpImage.Width);
                                                                                                                                                  System.Console.WriteLine("The bitmap height: {0}", bmpImage.Height);
                                                                                                                                                  System.Console.WriteLine("The number of bits per pixel: {0}", bmpImage.BitsPerPixel);

                                                                                                                                                  double hres = bmpImage.HorizontalResolution;
                                                                                                                                                  double vres = bmpImage.VerticalResolution;
                                                                                                                                                  System.Console.WriteLine("The horizontal resolution, in pixels per inch: {0}", hres);
                                                                                                                                                  System.Console.WriteLine("The vertical resolution, in pixels per inch: {0}", vres);

                                                                                                                                                  if (hres != 96.0 || vres != 96.0)
                                                                                                                                                  {
                                                                                                                                                      // You may consider using the SetResolution method for updating both resolution values in single call.
                                                                                                                                                      System.Console.WriteLine("Set resolution values to 96 dpi");
                                                                                                                                                      bmpImage.SetResolution(96.0, 96.0);

                                                                                                                                                      System.Console.WriteLine("The horizontal resolution, in pixels per inch: {0}", bmpImage.HorizontalResolution);
                                                                                                                                                      System.Console.WriteLine("The vertical resolution, in pixels per inch: {0}", bmpImage.VerticalResolution);
                                                                                                                                                  }

                                                                                                                                                  //The output may look like this:
                                                                                                                                                  //The pixel format: Rgb24Bpp, used channels: 8,8,8
                                                                                                                                                  //The raw line size in bytes: 1500
                                                                                                                                                  //The bitmap compression: Rgb
                                                                                                                                                  //The bitmap width: 500
                                                                                                                                                  //The bitmap height: 375
                                                                                                                                                  //The number of bits per pixel: 24
                                                                                                                                                  //The horizontal resolution, in pixels per inch: 0
                                                                                                                                                  //The vertical resolution, in pixels per inch: 0
                                                                                                                                                  //Set resolution values to 96 dpi
                                                                                                                                                  //The horizontal resolution, in pixels per inch: 96.012
                                                                                                                                                  //The vertical resolution, in pixels per inch: 96.012
                                                                                                                                              }

Aşağıdaki örnek, bitmap kompresyonunun çıkış görüntü boyutunu nasıl etkilediğini gösterir.

Aspose.Imaging.FileFormats.Bmp.BitmapCompression[] compressions = new Aspose.Imaging.FileFormats.Bmp.BitmapCompression[]
                                                                                                {
                                                                                                    Aspose.Imaging.FileFormats.Bmp.BitmapCompression.Rgb,
                                                                                                    Aspose.Imaging.FileFormats.Bmp.BitmapCompression.Rle8,
                                                                                                };

                                                                                                Aspose.Imaging.Color[] paletterColors = new Aspose.Imaging.Color[]
                                                                                                {
                                                                                                    Aspose.Imaging.Color.Red,
                                                                                                    Aspose.Imaging.Color.Green,
                                                                                                };

                                                                                                // Create a monochrome palette which contains only red and green colors.
                                                                                                Aspose.Imaging.IColorPalette palette = new Aspose.Imaging.ColorPalette(paletterColors);

                                                                                                foreach (Aspose.Imaging.FileFormats.Bmp.BitmapCompression compression in compressions)
                                                                                                {
                                                                                                    // Create a 8-bpp BMP image of 100 x 100 px.
                                                                                                    using (Aspose.Imaging.FileFormats.Bmp.BmpImage bmpImage = new Aspose.Imaging.FileFormats.Bmp.BmpImage(100, 100, 8, palette, compression, 0.0, 0.0))
                                                                                                    {
                                                                                                        Aspose.Imaging.Graphics gr = new Aspose.Imaging.Graphics(bmpImage);

                                                                                                        // Fill the entire image in red.
                                                                                                        Aspose.Imaging.Brushes.SolidBrush redBrush = new Aspose.Imaging.Brushes.SolidBrush(Aspose.Imaging.Color.Red);
                                                                                                        gr.FillRectangle(redBrush, bmpImage.Bounds);

                                                                                                        // Save the image to a stream to get the output image size.
                                                                                                        using (System.IO.MemoryStream stream = new System.IO.MemoryStream())
                                                                                                        {
                                                                                                            bmpImage.Save(stream);

                                                                                                            System.Console.WriteLine("---------------------------------------------");
                                                                                                            System.Console.WriteLine("The compression={0}", bmpImage.Compression);
                                                                                                            System.Console.WriteLine("The number of bits per pixel={0}", bmpImage.BitsPerPixel);
                                                                                                            System.Console.WriteLine("The image dimensions={0} x {1}", bmpImage.Width, bmpImage.Height);
                                                                                                            System.Console.WriteLine("The raw line size={0}", bmpImage.RawLineSize);
                                                                                                            System.Console.WriteLine("The output size in bytes={0}", stream.Length);
                                                                                                        }
                                                                                                    }
                                                                                                }

                                                                                                // The output looks like this:
                                                                                                // ---------------------------------------------
                                                                                                // The compression = Rgb
                                                                                                // The number of bits per pixel = 8
                                                                                                // The image dimensions = 100 x 100
                                                                                                // The raw line size = 100
                                                                                                // The output size in bytes = 11078
                                                                                                // ---------------------------------------------
                                                                                                // The compression = Rle8
                                                                                                // The number of bits per pixel = 8
                                                                                                // The image dimensions = 100 x 100
                                                                                                // The raw line size = 100
                                                                                                // The output size in bytes = 856

Compression

Bu özellikle resim için kullanılan kompres türünü çaba sarf etmeyin.Görüntü sıkıştırma ile ilgili bilgilere hızlı erişim gerektiren geliştiriciler için mükemmel.

public BitmapCompression Compression { get; }

Mülkiyet Değer

BitmapCompression

Examples

Aşağıdaki örnek, piksel biçimi, görüntü boyutu, çözünürlük, sıkıştırma vb. dahil olmak üzere görüntü hakkında genel bilgileri alır.

using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Load(@"c:\temp\sample.bmp"))
                                                                                                                                              {
                                                                                                                                                  Aspose.Imaging.FileFormats.Bmp.BmpImage bmpImage = (Aspose.Imaging.FileFormats.Bmp.BmpImage)image;                

                                                                                                                                                  System.Console.WriteLine("The pixel format: {0}", bmpImage.RawDataFormat);                
                                                                                                                                                  System.Console.WriteLine("The raw line size in bytes: {0}", bmpImage.RawLineSize);
                                                                                                                                                  System.Console.WriteLine("The bitmap compression: {0}", bmpImage.Compression);
                                                                                                                                                  System.Console.WriteLine("The bitmap width: {0}", bmpImage.Width);
                                                                                                                                                  System.Console.WriteLine("The bitmap height: {0}", bmpImage.Height);
                                                                                                                                                  System.Console.WriteLine("The number of bits per pixel: {0}", bmpImage.BitsPerPixel);

                                                                                                                                                  double hres = bmpImage.HorizontalResolution;
                                                                                                                                                  double vres = bmpImage.VerticalResolution;
                                                                                                                                                  System.Console.WriteLine("The horizontal resolution, in pixels per inch: {0}", hres);
                                                                                                                                                  System.Console.WriteLine("The vertical resolution, in pixels per inch: {0}", vres);

                                                                                                                                                  if (hres != 96.0 || vres != 96.0)
                                                                                                                                                  {
                                                                                                                                                      // You may consider using the SetResolution method for updating both resolution values in single call.
                                                                                                                                                      System.Console.WriteLine("Set resolution values to 96 dpi");
                                                                                                                                                      bmpImage.SetResolution(96.0, 96.0);

                                                                                                                                                      System.Console.WriteLine("The horizontal resolution, in pixels per inch: {0}", bmpImage.HorizontalResolution);
                                                                                                                                                      System.Console.WriteLine("The vertical resolution, in pixels per inch: {0}", bmpImage.VerticalResolution);
                                                                                                                                                  }

                                                                                                                                                  //The output may look like this:
                                                                                                                                                  //The pixel format: Rgb24Bpp, used channels: 8,8,8
                                                                                                                                                  //The raw line size in bytes: 1500
                                                                                                                                                  //The bitmap compression: Rgb
                                                                                                                                                  //The bitmap width: 500
                                                                                                                                                  //The bitmap height: 375
                                                                                                                                                  //The number of bits per pixel: 24
                                                                                                                                                  //The horizontal resolution, in pixels per inch: 0
                                                                                                                                                  //The vertical resolution, in pixels per inch: 0
                                                                                                                                                  //Set resolution values to 96 dpi
                                                                                                                                                  //The horizontal resolution, in pixels per inch: 96.012
                                                                                                                                                  //The vertical resolution, in pixels per inch: 96.012
                                                                                                                                              }

Aşağıdaki örnek, bitmap kompresyonunun çıkış görüntü boyutunu nasıl etkilediğini gösterir.

Aspose.Imaging.FileFormats.Bmp.BitmapCompression[] compressions = new Aspose.Imaging.FileFormats.Bmp.BitmapCompression[]
                                                                                                {
                                                                                                    Aspose.Imaging.FileFormats.Bmp.BitmapCompression.Rgb,
                                                                                                    Aspose.Imaging.FileFormats.Bmp.BitmapCompression.Rle8,
                                                                                                };

                                                                                                Aspose.Imaging.Color[] paletterColors = new Aspose.Imaging.Color[]
                                                                                                {
                                                                                                    Aspose.Imaging.Color.Red,
                                                                                                    Aspose.Imaging.Color.Green,
                                                                                                };

                                                                                                // Create a monochrome palette which contains only red and green colors.
                                                                                                Aspose.Imaging.IColorPalette palette = new Aspose.Imaging.ColorPalette(paletterColors);

                                                                                                foreach (Aspose.Imaging.FileFormats.Bmp.BitmapCompression compression in compressions)
                                                                                                {
                                                                                                    // Create a 8-bpp BMP image of 100 x 100 px.
                                                                                                    using (Aspose.Imaging.FileFormats.Bmp.BmpImage bmpImage = new Aspose.Imaging.FileFormats.Bmp.BmpImage(100, 100, 8, palette, compression, 0.0, 0.0))
                                                                                                    {
                                                                                                        Aspose.Imaging.Graphics gr = new Aspose.Imaging.Graphics(bmpImage);

                                                                                                        // Fill the entire image in red.
                                                                                                        Aspose.Imaging.Brushes.SolidBrush redBrush = new Aspose.Imaging.Brushes.SolidBrush(Aspose.Imaging.Color.Red);
                                                                                                        gr.FillRectangle(redBrush, bmpImage.Bounds);

                                                                                                        // Save the image to a stream to get the output image size.
                                                                                                        using (System.IO.MemoryStream stream = new System.IO.MemoryStream())
                                                                                                        {
                                                                                                            bmpImage.Save(stream);

                                                                                                            System.Console.WriteLine("---------------------------------------------");
                                                                                                            System.Console.WriteLine("The compression={0}", bmpImage.Compression);
                                                                                                            System.Console.WriteLine("The number of bits per pixel={0}", bmpImage.BitsPerPixel);
                                                                                                            System.Console.WriteLine("The image dimensions={0} x {1}", bmpImage.Width, bmpImage.Height);
                                                                                                            System.Console.WriteLine("The raw line size={0}", bmpImage.RawLineSize);
                                                                                                            System.Console.WriteLine("The output size in bytes={0}", stream.Length);
                                                                                                        }
                                                                                                    }
                                                                                                }

                                                                                                // The output looks like this:
                                                                                                // ---------------------------------------------
                                                                                                // The compression = Rgb
                                                                                                // The number of bits per pixel = 8
                                                                                                // The image dimensions = 100 x 100
                                                                                                // The raw line size = 100
                                                                                                // The output size in bytes = 11078
                                                                                                // ---------------------------------------------
                                                                                                // The compression = Rle8
                                                                                                // The number of bits per pixel = 8
                                                                                                // The image dimensions = 100 x 100
                                                                                                // The raw line size = 100
                                                                                                // The output size in bytes = 856

FileFormat

Bu kullanıcı dostu özellik ile dosya biçiminin değerini kolayca geri alabilirsiniz.Dosya biçimi hakkında bilgi için hızlı erişim arayan geliştiriciler için idealdir.

public override FileFormat FileFormat { get; }

Mülkiyet Değer

FileFormat

Examples

Aşağıdaki örnek, bir BMP görüntüsünden hammadde veri biçimi ve alfa kanalı hakkında bilgi nasıl çıkarılacağını göstermektedir.

// Create a 32-bpp BMP image of 100 x 100 px.
                                                                                                                           using (Aspose.Imaging.FileFormats.Bmp.BmpImage bmpImage = new Aspose.Imaging.FileFormats.Bmp.BmpImage(100, 100, 32, null))
                                                                                                                           {
                                                                                                                               System.Console.WriteLine("FileFormat={0}, RawDataFormat={1}, HasAlpha={2}", bmpImage.FileFormat, bmpImage.RawDataFormat, bmpImage.HasAlpha);
                                                                                                                           };

                                                                                                                           // Create a 24-bpp BMP image of 100 x 100 px.
                                                                                                                           using (Aspose.Imaging.FileFormats.Bmp.BmpImage bmpImage = new Aspose.Imaging.FileFormats.Bmp.BmpImage(100, 100, 24, null))
                                                                                                                           {
                                                                                                                               System.Console.WriteLine("FileFormat={0}, RawDataFormat={1}, HasAlpha={2}", bmpImage.FileFormat, bmpImage.RawDataFormat, bmpImage.HasAlpha);
                                                                                                                           };

                                                                                                                           // Generally, BMP doesn't support alpha channel so the output will look like this:
                                                                                                                           // FileFormat = Bmp, RawDataFormat = Rgb32Bpp, used channels: 8,8,8,8, HasAlpha = False
                                                                                                                           // FileFormat = Bmp, RawDataFormat = Rgb24Bpp, used channels: 8,8,8, HasAlpha = False

HasAlpha

Bu durumun alfa olup olmadığını gösteren bir değer alır.

public override bool HasAlpha { get; }

Mülkiyet Değer

bool

Height

Bu özellikle görüntü yüksekliğini çaba sarf etmeyin. geliştiriciler için idealGörüntü boyutları ile ilgili bilgilere hızlı erişim gerektirir.

public override int Height { get; }

Mülkiyet Değer

int

Examples

Aşağıdaki örnek, piksel biçimi, görüntü boyutu, çözünürlük, sıkıştırma vb. dahil olmak üzere görüntü hakkında genel bilgileri alır.

using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Load(@"c:\temp\sample.bmp"))
                                                                                                                                              {
                                                                                                                                                  Aspose.Imaging.FileFormats.Bmp.BmpImage bmpImage = (Aspose.Imaging.FileFormats.Bmp.BmpImage)image;                

                                                                                                                                                  System.Console.WriteLine("The pixel format: {0}", bmpImage.RawDataFormat);                
                                                                                                                                                  System.Console.WriteLine("The raw line size in bytes: {0}", bmpImage.RawLineSize);
                                                                                                                                                  System.Console.WriteLine("The bitmap compression: {0}", bmpImage.Compression);
                                                                                                                                                  System.Console.WriteLine("The bitmap width: {0}", bmpImage.Width);
                                                                                                                                                  System.Console.WriteLine("The bitmap height: {0}", bmpImage.Height);
                                                                                                                                                  System.Console.WriteLine("The number of bits per pixel: {0}", bmpImage.BitsPerPixel);

                                                                                                                                                  double hres = bmpImage.HorizontalResolution;
                                                                                                                                                  double vres = bmpImage.VerticalResolution;
                                                                                                                                                  System.Console.WriteLine("The horizontal resolution, in pixels per inch: {0}", hres);
                                                                                                                                                  System.Console.WriteLine("The vertical resolution, in pixels per inch: {0}", vres);

                                                                                                                                                  if (hres != 96.0 || vres != 96.0)
                                                                                                                                                  {
                                                                                                                                                      // You may consider using the SetResolution method for updating both resolution values in single call.
                                                                                                                                                      System.Console.WriteLine("Set resolution values to 96 dpi");
                                                                                                                                                      bmpImage.SetResolution(96.0, 96.0);

                                                                                                                                                      System.Console.WriteLine("The horizontal resolution, in pixels per inch: {0}", bmpImage.HorizontalResolution);
                                                                                                                                                      System.Console.WriteLine("The vertical resolution, in pixels per inch: {0}", bmpImage.VerticalResolution);
                                                                                                                                                  }

                                                                                                                                                  //The output may look like this:
                                                                                                                                                  //The pixel format: Rgb24Bpp, used channels: 8,8,8
                                                                                                                                                  //The raw line size in bytes: 1500
                                                                                                                                                  //The bitmap compression: Rgb
                                                                                                                                                  //The bitmap width: 500
                                                                                                                                                  //The bitmap height: 375
                                                                                                                                                  //The number of bits per pixel: 24
                                                                                                                                                  //The horizontal resolution, in pixels per inch: 0
                                                                                                                                                  //The vertical resolution, in pixels per inch: 0
                                                                                                                                                  //Set resolution values to 96 dpi
                                                                                                                                                  //The horizontal resolution, in pixels per inch: 96.012
                                                                                                                                                  //The vertical resolution, in pixels per inch: 96.012
                                                                                                                                              }

Aşağıdaki örnek, bitmap kompresyonunun çıkış görüntü boyutunu nasıl etkilediğini gösterir.

Aspose.Imaging.FileFormats.Bmp.BitmapCompression[] compressions = new Aspose.Imaging.FileFormats.Bmp.BitmapCompression[]
                                                                                                {
                                                                                                    Aspose.Imaging.FileFormats.Bmp.BitmapCompression.Rgb,
                                                                                                    Aspose.Imaging.FileFormats.Bmp.BitmapCompression.Rle8,
                                                                                                };

                                                                                                Aspose.Imaging.Color[] paletterColors = new Aspose.Imaging.Color[]
                                                                                                {
                                                                                                    Aspose.Imaging.Color.Red,
                                                                                                    Aspose.Imaging.Color.Green,
                                                                                                };

                                                                                                // Create a monochrome palette which contains only red and green colors.
                                                                                                Aspose.Imaging.IColorPalette palette = new Aspose.Imaging.ColorPalette(paletterColors);

                                                                                                foreach (Aspose.Imaging.FileFormats.Bmp.BitmapCompression compression in compressions)
                                                                                                {
                                                                                                    // Create a 8-bpp BMP image of 100 x 100 px.
                                                                                                    using (Aspose.Imaging.FileFormats.Bmp.BmpImage bmpImage = new Aspose.Imaging.FileFormats.Bmp.BmpImage(100, 100, 8, palette, compression, 0.0, 0.0))
                                                                                                    {
                                                                                                        Aspose.Imaging.Graphics gr = new Aspose.Imaging.Graphics(bmpImage);

                                                                                                        // Fill the entire image in red.
                                                                                                        Aspose.Imaging.Brushes.SolidBrush redBrush = new Aspose.Imaging.Brushes.SolidBrush(Aspose.Imaging.Color.Red);
                                                                                                        gr.FillRectangle(redBrush, bmpImage.Bounds);

                                                                                                        // Save the image to a stream to get the output image size.
                                                                                                        using (System.IO.MemoryStream stream = new System.IO.MemoryStream())
                                                                                                        {
                                                                                                            bmpImage.Save(stream);

                                                                                                            System.Console.WriteLine("---------------------------------------------");
                                                                                                            System.Console.WriteLine("The compression={0}", bmpImage.Compression);
                                                                                                            System.Console.WriteLine("The number of bits per pixel={0}", bmpImage.BitsPerPixel);
                                                                                                            System.Console.WriteLine("The image dimensions={0} x {1}", bmpImage.Width, bmpImage.Height);
                                                                                                            System.Console.WriteLine("The raw line size={0}", bmpImage.RawLineSize);
                                                                                                            System.Console.WriteLine("The output size in bytes={0}", stream.Length);
                                                                                                        }
                                                                                                    }
                                                                                                }

                                                                                                // The output looks like this:
                                                                                                // ---------------------------------------------
                                                                                                // The compression = Rgb
                                                                                                // The number of bits per pixel = 8
                                                                                                // The image dimensions = 100 x 100
                                                                                                // The raw line size = 100
                                                                                                // The output size in bytes = 11078
                                                                                                // ---------------------------------------------
                                                                                                // The compression = Rle8
                                                                                                // The number of bits per pixel = 8
                                                                                                // The image dimensions = 100 x 100
                                                                                                // The raw line size = 100
                                                                                                // The output size in bytes = 856

HorizontalResolution

Bu mülk, yatay çözünürlüğün kolayca elde edilmesini veya ayarlanmasını sağlar,Aspose.Imaging.RasterImage nesnesinden inç başına piksel olarak ölçülür.Geliştirici uygulamaları için görüntü çözünürlüğünün doğru kontrolü gerektirir.

public override double HorizontalResolution { get; set; }

Mülkiyet Değer

double

Examples

Aşağıdaki örnek, bir BMP görüntüsünün yatay/vertikal çözünürlüğünü nasıl ayarlayacağınızı gösterir.

string dir = "c:\\temp\\";

                                                                                                using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Load(dir + "sample.bmp"))
                                                                                                {
                                                                                                    Aspose.Imaging.FileFormats.Bmp.BmpImage bmpImage = (Aspose.Imaging.FileFormats.Bmp.BmpImage)image;

                                                                                                    // Get horizontal and vertical resolution of the BmpImage
                                                                                                    double horizontalResolution = bmpImage.HorizontalResolution;
                                                                                                    double verticalResolution = bmpImage.VerticalResolution;
                                                                                                    System.Console.WriteLine("The horizontal resolution, in pixels per inch: {0}", horizontalResolution);
                                                                                                    System.Console.WriteLine("The vertical resolution, in pixels per inch: {0}", verticalResolution);

                                                                                                    if (horizontalResolution != 96.0 || verticalResolution != 96.0)
                                                                                                    {
                                                                                                        // Use the SetResolution method for updating both resolution values in a single call.
                                                                                                        System.Console.WriteLine("Set resolution values to 96 dpi");
                                                                                                        bmpImage.SetResolution(96.0, 96.0);

                                                                                                        System.Console.WriteLine("The horizontal resolution, in pixels per inch: {0}", bmpImage.HorizontalResolution);
                                                                                                        System.Console.WriteLine("The vertical resolution, in pixels per inch: {0}", bmpImage.VerticalResolution);
                                                                                                    }

                                                                                                    // The output may look like this:
                                                                                                    // The horizontal resolution, in pixels per inch: 0
                                                                                                    // The vertical resolution, in pixels per inch: 0
                                                                                                    // Set resolution values to 96 dpi
                                                                                                    // The horizontal resolution, in pixels per inch: 96.012
                                                                                                    // The vertical resolution, in pixels per inch: 96.012
                                                                                                }

Aşağıdaki örnek, piksel biçimi, görüntü boyutu, çözünürlük, sıkıştırma vb. dahil olmak üzere görüntü hakkında genel bilgileri alır.

using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Load(@"c:\temp\sample.bmp"))
                                                                                                                                              {
                                                                                                                                                  Aspose.Imaging.FileFormats.Bmp.BmpImage bmpImage = (Aspose.Imaging.FileFormats.Bmp.BmpImage)image;                

                                                                                                                                                  System.Console.WriteLine("The pixel format: {0}", bmpImage.RawDataFormat);                
                                                                                                                                                  System.Console.WriteLine("The raw line size in bytes: {0}", bmpImage.RawLineSize);
                                                                                                                                                  System.Console.WriteLine("The bitmap compression: {0}", bmpImage.Compression);
                                                                                                                                                  System.Console.WriteLine("The bitmap width: {0}", bmpImage.Width);
                                                                                                                                                  System.Console.WriteLine("The bitmap height: {0}", bmpImage.Height);
                                                                                                                                                  System.Console.WriteLine("The number of bits per pixel: {0}", bmpImage.BitsPerPixel);

                                                                                                                                                  double hres = bmpImage.HorizontalResolution;
                                                                                                                                                  double vres = bmpImage.VerticalResolution;
                                                                                                                                                  System.Console.WriteLine("The horizontal resolution, in pixels per inch: {0}", hres);
                                                                                                                                                  System.Console.WriteLine("The vertical resolution, in pixels per inch: {0}", vres);

                                                                                                                                                  if (hres != 96.0 || vres != 96.0)
                                                                                                                                                  {
                                                                                                                                                      // You may consider using the SetResolution method for updating both resolution values in single call.
                                                                                                                                                      System.Console.WriteLine("Set resolution values to 96 dpi");
                                                                                                                                                      bmpImage.SetResolution(96.0, 96.0);

                                                                                                                                                      System.Console.WriteLine("The horizontal resolution, in pixels per inch: {0}", bmpImage.HorizontalResolution);
                                                                                                                                                      System.Console.WriteLine("The vertical resolution, in pixels per inch: {0}", bmpImage.VerticalResolution);
                                                                                                                                                  }

                                                                                                                                                  //The output may look like this:
                                                                                                                                                  //The pixel format: Rgb24Bpp, used channels: 8,8,8
                                                                                                                                                  //The raw line size in bytes: 1500
                                                                                                                                                  //The bitmap compression: Rgb
                                                                                                                                                  //The bitmap width: 500
                                                                                                                                                  //The bitmap height: 375
                                                                                                                                                  //The number of bits per pixel: 24
                                                                                                                                                  //The horizontal resolution, in pixels per inch: 0
                                                                                                                                                  //The vertical resolution, in pixels per inch: 0
                                                                                                                                                  //Set resolution values to 96 dpi
                                                                                                                                                  //The horizontal resolution, in pixels per inch: 96.012
                                                                                                                                                  //The vertical resolution, in pixels per inch: 96.012
                                                                                                                                              }

Remarks

Varsayılan olarak, bu değer her zaman 96’dır, çünkü farklı platformlar ekran çözünürlüğünü iade edemez.

RawDataFormat

Bu kullanıcı dostu fonksiyonu ile hammadde verilerinizin biçimini kolayca elde edin.Geliştiriciler, veri biçimleri ile ilgili önemli bilgilere hızlı bir şekilde erişmek istiyorlar.

public override PixelDataFormat RawDataFormat { get; }

Mülkiyet Değer

PixelDataFormat

Examples

Aşağıdaki örnek, bir BMP görüntüsünden hammadde veri biçimi ve alfa kanalı hakkında bilgi nasıl çıkarılacağını göstermektedir.

// Create a 32-bpp BMP image of 100 x 100 px.
                                                                                                                           using (Aspose.Imaging.FileFormats.Bmp.BmpImage bmpImage = new Aspose.Imaging.FileFormats.Bmp.BmpImage(100, 100, 32, null))
                                                                                                                           {
                                                                                                                               System.Console.WriteLine("FileFormat={0}, RawDataFormat={1}, HasAlpha={2}", bmpImage.FileFormat, bmpImage.RawDataFormat, bmpImage.HasAlpha);
                                                                                                                           };

                                                                                                                           // Create a 24-bpp BMP image of 100 x 100 px.
                                                                                                                           using (Aspose.Imaging.FileFormats.Bmp.BmpImage bmpImage = new Aspose.Imaging.FileFormats.Bmp.BmpImage(100, 100, 24, null))
                                                                                                                           {
                                                                                                                               System.Console.WriteLine("FileFormat={0}, RawDataFormat={1}, HasAlpha={2}", bmpImage.FileFormat, bmpImage.RawDataFormat, bmpImage.HasAlpha);
                                                                                                                           };

                                                                                                                           // Generally, BMP doesn't support alpha channel so the output will look like this:
                                                                                                                           // FileFormat = Bmp, RawDataFormat = Rgb32Bpp, used channels: 8,8,8,8, HasAlpha = False
                                                                                                                           // FileFormat = Bmp, RawDataFormat = Rgb24Bpp, used channels: 8,8,8, HasAlpha = False

Aşağıdaki örnek, piksel biçimi, görüntü boyutu, çözünürlük, sıkıştırma vb. dahil olmak üzere görüntü hakkında genel bilgileri alır.

using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Load(@"c:\temp\sample.bmp"))
                                                                                                                                              {
                                                                                                                                                  Aspose.Imaging.FileFormats.Bmp.BmpImage bmpImage = (Aspose.Imaging.FileFormats.Bmp.BmpImage)image;                

                                                                                                                                                  System.Console.WriteLine("The pixel format: {0}", bmpImage.RawDataFormat);                
                                                                                                                                                  System.Console.WriteLine("The raw line size in bytes: {0}", bmpImage.RawLineSize);
                                                                                                                                                  System.Console.WriteLine("The bitmap compression: {0}", bmpImage.Compression);
                                                                                                                                                  System.Console.WriteLine("The bitmap width: {0}", bmpImage.Width);
                                                                                                                                                  System.Console.WriteLine("The bitmap height: {0}", bmpImage.Height);
                                                                                                                                                  System.Console.WriteLine("The number of bits per pixel: {0}", bmpImage.BitsPerPixel);

                                                                                                                                                  double hres = bmpImage.HorizontalResolution;
                                                                                                                                                  double vres = bmpImage.VerticalResolution;
                                                                                                                                                  System.Console.WriteLine("The horizontal resolution, in pixels per inch: {0}", hres);
                                                                                                                                                  System.Console.WriteLine("The vertical resolution, in pixels per inch: {0}", vres);

                                                                                                                                                  if (hres != 96.0 || vres != 96.0)
                                                                                                                                                  {
                                                                                                                                                      // You may consider using the SetResolution method for updating both resolution values in single call.
                                                                                                                                                      System.Console.WriteLine("Set resolution values to 96 dpi");
                                                                                                                                                      bmpImage.SetResolution(96.0, 96.0);

                                                                                                                                                      System.Console.WriteLine("The horizontal resolution, in pixels per inch: {0}", bmpImage.HorizontalResolution);
                                                                                                                                                      System.Console.WriteLine("The vertical resolution, in pixels per inch: {0}", bmpImage.VerticalResolution);
                                                                                                                                                  }

                                                                                                                                                  //The output may look like this:
                                                                                                                                                  //The pixel format: Rgb24Bpp, used channels: 8,8,8
                                                                                                                                                  //The raw line size in bytes: 1500
                                                                                                                                                  //The bitmap compression: Rgb
                                                                                                                                                  //The bitmap width: 500
                                                                                                                                                  //The bitmap height: 375
                                                                                                                                                  //The number of bits per pixel: 24
                                                                                                                                                  //The horizontal resolution, in pixels per inch: 0
                                                                                                                                                  //The vertical resolution, in pixels per inch: 0
                                                                                                                                                  //Set resolution values to 96 dpi
                                                                                                                                                  //The horizontal resolution, in pixels per inch: 96.012
                                                                                                                                                  //The vertical resolution, in pixels per inch: 96.012
                                                                                                                                              }

RawLineSize

Bu basit özellik ile her ham çizginin boyutuna hızlı bir şekilde erişebilirsiniz.Geliştiricilerin hassas görüntü verilerini verimli bir şekilde işleme ihtiyacı olanlar için idealdir.

public override int RawLineSize { get; }

Mülkiyet Değer

int

Examples

Aşağıdaki örnek, piksel biçimi, görüntü boyutu, çözünürlük, sıkıştırma vb. dahil olmak üzere görüntü hakkında genel bilgileri alır.

using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Load(@"c:\temp\sample.bmp"))
                                                                                                                                              {
                                                                                                                                                  Aspose.Imaging.FileFormats.Bmp.BmpImage bmpImage = (Aspose.Imaging.FileFormats.Bmp.BmpImage)image;                

                                                                                                                                                  System.Console.WriteLine("The pixel format: {0}", bmpImage.RawDataFormat);                
                                                                                                                                                  System.Console.WriteLine("The raw line size in bytes: {0}", bmpImage.RawLineSize);
                                                                                                                                                  System.Console.WriteLine("The bitmap compression: {0}", bmpImage.Compression);
                                                                                                                                                  System.Console.WriteLine("The bitmap width: {0}", bmpImage.Width);
                                                                                                                                                  System.Console.WriteLine("The bitmap height: {0}", bmpImage.Height);
                                                                                                                                                  System.Console.WriteLine("The number of bits per pixel: {0}", bmpImage.BitsPerPixel);

                                                                                                                                                  double hres = bmpImage.HorizontalResolution;
                                                                                                                                                  double vres = bmpImage.VerticalResolution;
                                                                                                                                                  System.Console.WriteLine("The horizontal resolution, in pixels per inch: {0}", hres);
                                                                                                                                                  System.Console.WriteLine("The vertical resolution, in pixels per inch: {0}", vres);

                                                                                                                                                  if (hres != 96.0 || vres != 96.0)
                                                                                                                                                  {
                                                                                                                                                      // You may consider using the SetResolution method for updating both resolution values in single call.
                                                                                                                                                      System.Console.WriteLine("Set resolution values to 96 dpi");
                                                                                                                                                      bmpImage.SetResolution(96.0, 96.0);

                                                                                                                                                      System.Console.WriteLine("The horizontal resolution, in pixels per inch: {0}", bmpImage.HorizontalResolution);
                                                                                                                                                      System.Console.WriteLine("The vertical resolution, in pixels per inch: {0}", bmpImage.VerticalResolution);
                                                                                                                                                  }

                                                                                                                                                  //The output may look like this:
                                                                                                                                                  //The pixel format: Rgb24Bpp, used channels: 8,8,8
                                                                                                                                                  //The raw line size in bytes: 1500
                                                                                                                                                  //The bitmap compression: Rgb
                                                                                                                                                  //The bitmap width: 500
                                                                                                                                                  //The bitmap height: 375
                                                                                                                                                  //The number of bits per pixel: 24
                                                                                                                                                  //The horizontal resolution, in pixels per inch: 0
                                                                                                                                                  //The vertical resolution, in pixels per inch: 0
                                                                                                                                                  //Set resolution values to 96 dpi
                                                                                                                                                  //The horizontal resolution, in pixels per inch: 96.012
                                                                                                                                                  //The vertical resolution, in pixels per inch: 96.012
                                                                                                                                              }

Aşağıdaki örnek, bitmap kompresyonunun çıkış görüntü boyutunu nasıl etkilediğini gösterir.

Aspose.Imaging.FileFormats.Bmp.BitmapCompression[] compressions = new Aspose.Imaging.FileFormats.Bmp.BitmapCompression[]
                                                                                                {
                                                                                                    Aspose.Imaging.FileFormats.Bmp.BitmapCompression.Rgb,
                                                                                                    Aspose.Imaging.FileFormats.Bmp.BitmapCompression.Rle8,
                                                                                                };

                                                                                                Aspose.Imaging.Color[] paletterColors = new Aspose.Imaging.Color[]
                                                                                                {
                                                                                                    Aspose.Imaging.Color.Red,
                                                                                                    Aspose.Imaging.Color.Green,
                                                                                                };

                                                                                                // Create a monochrome palette which contains only red and green colors.
                                                                                                Aspose.Imaging.IColorPalette palette = new Aspose.Imaging.ColorPalette(paletterColors);

                                                                                                foreach (Aspose.Imaging.FileFormats.Bmp.BitmapCompression compression in compressions)
                                                                                                {
                                                                                                    // Create a 8-bpp BMP image of 100 x 100 px.
                                                                                                    using (Aspose.Imaging.FileFormats.Bmp.BmpImage bmpImage = new Aspose.Imaging.FileFormats.Bmp.BmpImage(100, 100, 8, palette, compression, 0.0, 0.0))
                                                                                                    {
                                                                                                        Aspose.Imaging.Graphics gr = new Aspose.Imaging.Graphics(bmpImage);

                                                                                                        // Fill the entire image in red.
                                                                                                        Aspose.Imaging.Brushes.SolidBrush redBrush = new Aspose.Imaging.Brushes.SolidBrush(Aspose.Imaging.Color.Red);
                                                                                                        gr.FillRectangle(redBrush, bmpImage.Bounds);

                                                                                                        // Save the image to a stream to get the output image size.
                                                                                                        using (System.IO.MemoryStream stream = new System.IO.MemoryStream())
                                                                                                        {
                                                                                                            bmpImage.Save(stream);

                                                                                                            System.Console.WriteLine("---------------------------------------------");
                                                                                                            System.Console.WriteLine("The compression={0}", bmpImage.Compression);
                                                                                                            System.Console.WriteLine("The number of bits per pixel={0}", bmpImage.BitsPerPixel);
                                                                                                            System.Console.WriteLine("The image dimensions={0} x {1}", bmpImage.Width, bmpImage.Height);
                                                                                                            System.Console.WriteLine("The raw line size={0}", bmpImage.RawLineSize);
                                                                                                            System.Console.WriteLine("The output size in bytes={0}", stream.Length);
                                                                                                        }
                                                                                                    }
                                                                                                }

                                                                                                // The output looks like this:
                                                                                                // ---------------------------------------------
                                                                                                // The compression = Rgb
                                                                                                // The number of bits per pixel = 8
                                                                                                // The image dimensions = 100 x 100
                                                                                                // The raw line size = 100
                                                                                                // The output size in bytes = 11078
                                                                                                // ---------------------------------------------
                                                                                                // The compression = Rle8
                                                                                                // The number of bits per pixel = 8
                                                                                                // The image dimensions = 100 x 100
                                                                                                // The raw line size = 100
                                                                                                // The output size in bytes = 856

VerticalResolution

Kolayca geri almak veya vertikal çözünürlüğünü ayarlamak, inç başına piksel olarak ölçülür,bu Aspose.Imaging.RasterImage nesne ile bu mülk. geliştiriciler için mükemmelUygulamalarında görüntü çözünürlüğünün doğru kontrolü.

public override double VerticalResolution { get; set; }

Mülkiyet Değer

double

Examples

Aşağıdaki örnek, bir BMP görüntüsünün yatay/vertikal çözünürlüğünü nasıl ayarlayacağınızı gösterir.

string dir = "c:\\temp\\";

                                                                                                using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Load(dir + "sample.bmp"))
                                                                                                {
                                                                                                    Aspose.Imaging.FileFormats.Bmp.BmpImage bmpImage = (Aspose.Imaging.FileFormats.Bmp.BmpImage)image;

                                                                                                    // Get horizontal and vertical resolution of the BmpImage
                                                                                                    double horizontalResolution = bmpImage.HorizontalResolution;
                                                                                                    double verticalResolution = bmpImage.VerticalResolution;
                                                                                                    System.Console.WriteLine("The horizontal resolution, in pixels per inch: {0}", horizontalResolution);
                                                                                                    System.Console.WriteLine("The vertical resolution, in pixels per inch: {0}", verticalResolution);

                                                                                                    if (horizontalResolution != 96.0 || verticalResolution != 96.0)
                                                                                                    {
                                                                                                        // Use the SetResolution method for updating both resolution values in a single call.
                                                                                                        System.Console.WriteLine("Set resolution values to 96 dpi");
                                                                                                        bmpImage.SetResolution(96.0, 96.0);

                                                                                                        System.Console.WriteLine("The horizontal resolution, in pixels per inch: {0}", bmpImage.HorizontalResolution);
                                                                                                        System.Console.WriteLine("The vertical resolution, in pixels per inch: {0}", bmpImage.VerticalResolution);
                                                                                                    }

                                                                                                    // The output may look like this:
                                                                                                    // The horizontal resolution, in pixels per inch: 0
                                                                                                    // The vertical resolution, in pixels per inch: 0
                                                                                                    // Set resolution values to 96 dpi
                                                                                                    // The horizontal resolution, in pixels per inch: 96.012
                                                                                                    // The vertical resolution, in pixels per inch: 96.012
                                                                                                }

Aşağıdaki örnek, piksel biçimi, görüntü boyutu, çözünürlük, sıkıştırma vb. dahil olmak üzere görüntü hakkında genel bilgileri alır.

using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Load(@"c:\temp\sample.bmp"))
                                                                                                                                              {
                                                                                                                                                  Aspose.Imaging.FileFormats.Bmp.BmpImage bmpImage = (Aspose.Imaging.FileFormats.Bmp.BmpImage)image;                

                                                                                                                                                  System.Console.WriteLine("The pixel format: {0}", bmpImage.RawDataFormat);                
                                                                                                                                                  System.Console.WriteLine("The raw line size in bytes: {0}", bmpImage.RawLineSize);
                                                                                                                                                  System.Console.WriteLine("The bitmap compression: {0}", bmpImage.Compression);
                                                                                                                                                  System.Console.WriteLine("The bitmap width: {0}", bmpImage.Width);
                                                                                                                                                  System.Console.WriteLine("The bitmap height: {0}", bmpImage.Height);
                                                                                                                                                  System.Console.WriteLine("The number of bits per pixel: {0}", bmpImage.BitsPerPixel);

                                                                                                                                                  double hres = bmpImage.HorizontalResolution;
                                                                                                                                                  double vres = bmpImage.VerticalResolution;
                                                                                                                                                  System.Console.WriteLine("The horizontal resolution, in pixels per inch: {0}", hres);
                                                                                                                                                  System.Console.WriteLine("The vertical resolution, in pixels per inch: {0}", vres);

                                                                                                                                                  if (hres != 96.0 || vres != 96.0)
                                                                                                                                                  {
                                                                                                                                                      // You may consider using the SetResolution method for updating both resolution values in single call.
                                                                                                                                                      System.Console.WriteLine("Set resolution values to 96 dpi");
                                                                                                                                                      bmpImage.SetResolution(96.0, 96.0);

                                                                                                                                                      System.Console.WriteLine("The horizontal resolution, in pixels per inch: {0}", bmpImage.HorizontalResolution);
                                                                                                                                                      System.Console.WriteLine("The vertical resolution, in pixels per inch: {0}", bmpImage.VerticalResolution);
                                                                                                                                                  }

                                                                                                                                                  //The output may look like this:
                                                                                                                                                  //The pixel format: Rgb24Bpp, used channels: 8,8,8
                                                                                                                                                  //The raw line size in bytes: 1500
                                                                                                                                                  //The bitmap compression: Rgb
                                                                                                                                                  //The bitmap width: 500
                                                                                                                                                  //The bitmap height: 375
                                                                                                                                                  //The number of bits per pixel: 24
                                                                                                                                                  //The horizontal resolution, in pixels per inch: 0
                                                                                                                                                  //The vertical resolution, in pixels per inch: 0
                                                                                                                                                  //Set resolution values to 96 dpi
                                                                                                                                                  //The horizontal resolution, in pixels per inch: 96.012
                                                                                                                                                  //The vertical resolution, in pixels per inch: 96.012
                                                                                                                                              }

Remarks

Varsayılan olarak, bu değer her zaman 96’dır, çünkü farklı platformlar ekran çözünürlüğünü iade edemez.

Width

Bu özellikle görüntü genişliğine kolayca erişebilirsiniz. geliştiriciler için idealGörüntü boyutları hakkında hızlı bilgi aramak.

public override int Width { get; }

Mülkiyet Değer

int

Examples

Aşağıdaki örnek, piksel biçimi, görüntü boyutu, çözünürlük, sıkıştırma vb. dahil olmak üzere görüntü hakkında genel bilgileri alır.

using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Load(@"c:\temp\sample.bmp"))
                                                                                                                                              {
                                                                                                                                                  Aspose.Imaging.FileFormats.Bmp.BmpImage bmpImage = (Aspose.Imaging.FileFormats.Bmp.BmpImage)image;                

                                                                                                                                                  System.Console.WriteLine("The pixel format: {0}", bmpImage.RawDataFormat);                
                                                                                                                                                  System.Console.WriteLine("The raw line size in bytes: {0}", bmpImage.RawLineSize);
                                                                                                                                                  System.Console.WriteLine("The bitmap compression: {0}", bmpImage.Compression);
                                                                                                                                                  System.Console.WriteLine("The bitmap width: {0}", bmpImage.Width);
                                                                                                                                                  System.Console.WriteLine("The bitmap height: {0}", bmpImage.Height);
                                                                                                                                                  System.Console.WriteLine("The number of bits per pixel: {0}", bmpImage.BitsPerPixel);

                                                                                                                                                  double hres = bmpImage.HorizontalResolution;
                                                                                                                                                  double vres = bmpImage.VerticalResolution;
                                                                                                                                                  System.Console.WriteLine("The horizontal resolution, in pixels per inch: {0}", hres);
                                                                                                                                                  System.Console.WriteLine("The vertical resolution, in pixels per inch: {0}", vres);

                                                                                                                                                  if (hres != 96.0 || vres != 96.0)
                                                                                                                                                  {
                                                                                                                                                      // You may consider using the SetResolution method for updating both resolution values in single call.
                                                                                                                                                      System.Console.WriteLine("Set resolution values to 96 dpi");
                                                                                                                                                      bmpImage.SetResolution(96.0, 96.0);

                                                                                                                                                      System.Console.WriteLine("The horizontal resolution, in pixels per inch: {0}", bmpImage.HorizontalResolution);
                                                                                                                                                      System.Console.WriteLine("The vertical resolution, in pixels per inch: {0}", bmpImage.VerticalResolution);
                                                                                                                                                  }

                                                                                                                                                  //The output may look like this:
                                                                                                                                                  //The pixel format: Rgb24Bpp, used channels: 8,8,8
                                                                                                                                                  //The raw line size in bytes: 1500
                                                                                                                                                  //The bitmap compression: Rgb
                                                                                                                                                  //The bitmap width: 500
                                                                                                                                                  //The bitmap height: 375
                                                                                                                                                  //The number of bits per pixel: 24
                                                                                                                                                  //The horizontal resolution, in pixels per inch: 0
                                                                                                                                                  //The vertical resolution, in pixels per inch: 0
                                                                                                                                                  //Set resolution values to 96 dpi
                                                                                                                                                  //The horizontal resolution, in pixels per inch: 96.012
                                                                                                                                                  //The vertical resolution, in pixels per inch: 96.012
                                                                                                                                              }

Aşağıdaki örnek, bitmap kompresyonunun çıkış görüntü boyutunu nasıl etkilediğini gösterir.

Aspose.Imaging.FileFormats.Bmp.BitmapCompression[] compressions = new Aspose.Imaging.FileFormats.Bmp.BitmapCompression[]
                                                                                                {
                                                                                                    Aspose.Imaging.FileFormats.Bmp.BitmapCompression.Rgb,
                                                                                                    Aspose.Imaging.FileFormats.Bmp.BitmapCompression.Rle8,
                                                                                                };

                                                                                                Aspose.Imaging.Color[] paletterColors = new Aspose.Imaging.Color[]
                                                                                                {
                                                                                                    Aspose.Imaging.Color.Red,
                                                                                                    Aspose.Imaging.Color.Green,
                                                                                                };

                                                                                                // Create a monochrome palette which contains only red and green colors.
                                                                                                Aspose.Imaging.IColorPalette palette = new Aspose.Imaging.ColorPalette(paletterColors);

                                                                                                foreach (Aspose.Imaging.FileFormats.Bmp.BitmapCompression compression in compressions)
                                                                                                {
                                                                                                    // Create a 8-bpp BMP image of 100 x 100 px.
                                                                                                    using (Aspose.Imaging.FileFormats.Bmp.BmpImage bmpImage = new Aspose.Imaging.FileFormats.Bmp.BmpImage(100, 100, 8, palette, compression, 0.0, 0.0))
                                                                                                    {
                                                                                                        Aspose.Imaging.Graphics gr = new Aspose.Imaging.Graphics(bmpImage);

                                                                                                        // Fill the entire image in red.
                                                                                                        Aspose.Imaging.Brushes.SolidBrush redBrush = new Aspose.Imaging.Brushes.SolidBrush(Aspose.Imaging.Color.Red);
                                                                                                        gr.FillRectangle(redBrush, bmpImage.Bounds);

                                                                                                        // Save the image to a stream to get the output image size.
                                                                                                        using (System.IO.MemoryStream stream = new System.IO.MemoryStream())
                                                                                                        {
                                                                                                            bmpImage.Save(stream);

                                                                                                            System.Console.WriteLine("---------------------------------------------");
                                                                                                            System.Console.WriteLine("The compression={0}", bmpImage.Compression);
                                                                                                            System.Console.WriteLine("The number of bits per pixel={0}", bmpImage.BitsPerPixel);
                                                                                                            System.Console.WriteLine("The image dimensions={0} x {1}", bmpImage.Width, bmpImage.Height);
                                                                                                            System.Console.WriteLine("The raw line size={0}", bmpImage.RawLineSize);
                                                                                                            System.Console.WriteLine("The output size in bytes={0}", stream.Length);
                                                                                                        }
                                                                                                    }
                                                                                                }

                                                                                                // The output looks like this:
                                                                                                // ---------------------------------------------
                                                                                                // The compression = Rgb
                                                                                                // The number of bits per pixel = 8
                                                                                                // The image dimensions = 100 x 100
                                                                                                // The raw line size = 100
                                                                                                // The output size in bytes = 11078
                                                                                                // ---------------------------------------------
                                                                                                // The compression = Rle8
                                                                                                // The number of bits per pixel = 8
                                                                                                // The image dimensions = 100 x 100
                                                                                                // The raw line size = 100
                                                                                                // The output size in bytes = 856

Methods

GetDefaultOptions(nesne[])

Bu basit yöntemle varsayılan seçenekleri çaba sarf etmeyin.İdeal görüntü ayarlarına veya yapılandırmalara hızlı erişim arayan geliştiriciler için idealdir.

public override ImageOptionsBase GetDefaultOptions(object[] args)

Parameters

args object […]

ve argümanları.

Returns

ImageOptionsBase

Default seçenekleri

OnCached()

Bilgiler gizlenir ve tüm ilgili kaynaklar dağıtılabilir.

protected override void OnCached()

OnPaletteChanging(İKOLOR, İKOLOR İKOLOR)

Palet değiştiğinde söylenir.

protected override void OnPaletteChanging(IColorPalette oldPalette, IColorPalette newPalette)

Parameters

oldPalette IColorPalette

O eski palet.

newPalette IColorPalette

Yeni palet için.

SaveData(Stream)

Verileri tasarruf edin.

protected override void SaveData(Stream stream)

Parameters

stream Stream

veri kaydetmek için akış.

SetResolution(Çift , Çift)

Aspose.Imaging.RasterImage’in çözünürlüğünü bu şekilde kolayca ayarlayınKullanıcı dostu yöntem. geliştiriciler için mükemmelUygulamalarında resim çözünürlüğü.

public override void SetResolution(double dpiX, double dpiY)

Parameters

dpiX double

Aspose.Imaging.RasterImage’ın yatay çözünürlüğü, inç başına noktalarda.

dpiY double

Aspose.Imaging.RasterImage’ın vertikal çözünürlüğü, inç başına noktalarda.

Examples

Aşağıdaki örnek, bir BMP görüntüsünün yatay/vertikal çözünürlüğünü nasıl ayarlayacağınızı gösterir.

string dir = "c:\\temp\\";

                                                                                                using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Load(dir + "sample.bmp"))
                                                                                                {
                                                                                                    Aspose.Imaging.FileFormats.Bmp.BmpImage bmpImage = (Aspose.Imaging.FileFormats.Bmp.BmpImage)image;

                                                                                                    // Get horizontal and vertical resolution of the BmpImage
                                                                                                    double horizontalResolution = bmpImage.HorizontalResolution;
                                                                                                    double verticalResolution = bmpImage.VerticalResolution;
                                                                                                    System.Console.WriteLine("The horizontal resolution, in pixels per inch: {0}", horizontalResolution);
                                                                                                    System.Console.WriteLine("The vertical resolution, in pixels per inch: {0}", verticalResolution);

                                                                                                    if (horizontalResolution != 96.0 || verticalResolution != 96.0)
                                                                                                    {
                                                                                                        // Use the SetResolution method for updating both resolution values in a single call.
                                                                                                        System.Console.WriteLine("Set resolution values to 96 dpi");
                                                                                                        bmpImage.SetResolution(96.0, 96.0);

                                                                                                        System.Console.WriteLine("The horizontal resolution, in pixels per inch: {0}", bmpImage.HorizontalResolution);
                                                                                                        System.Console.WriteLine("The vertical resolution, in pixels per inch: {0}", bmpImage.VerticalResolution);
                                                                                                    }

                                                                                                    // The output may look like this:
                                                                                                    // The horizontal resolution, in pixels per inch: 0
                                                                                                    // The vertical resolution, in pixels per inch: 0
                                                                                                    // Set resolution values to 96 dpi
                                                                                                    // The horizontal resolution, in pixels per inch: 96.012
                                                                                                    // The vertical resolution, in pixels per inch: 96.012
                                                                                                }

Aşağıdaki örnek, piksel biçimi, görüntü boyutu, çözünürlük, sıkıştırma vb. dahil olmak üzere görüntü hakkında genel bilgileri alır.

using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Load(@"c:\temp\sample.bmp"))
                                                                                                                                              {
                                                                                                                                                  Aspose.Imaging.FileFormats.Bmp.BmpImage bmpImage = (Aspose.Imaging.FileFormats.Bmp.BmpImage)image;                

                                                                                                                                                  System.Console.WriteLine("The pixel format: {0}", bmpImage.RawDataFormat);                
                                                                                                                                                  System.Console.WriteLine("The raw line size in bytes: {0}", bmpImage.RawLineSize);
                                                                                                                                                  System.Console.WriteLine("The bitmap compression: {0}", bmpImage.Compression);
                                                                                                                                                  System.Console.WriteLine("The bitmap width: {0}", bmpImage.Width);
                                                                                                                                                  System.Console.WriteLine("The bitmap height: {0}", bmpImage.Height);
                                                                                                                                                  System.Console.WriteLine("The number of bits per pixel: {0}", bmpImage.BitsPerPixel);

                                                                                                                                                  double hres = bmpImage.HorizontalResolution;
                                                                                                                                                  double vres = bmpImage.VerticalResolution;
                                                                                                                                                  System.Console.WriteLine("The horizontal resolution, in pixels per inch: {0}", hres);
                                                                                                                                                  System.Console.WriteLine("The vertical resolution, in pixels per inch: {0}", vres);

                                                                                                                                                  if (hres != 96.0 || vres != 96.0)
                                                                                                                                                  {
                                                                                                                                                      // You may consider using the SetResolution method for updating both resolution values in single call.
                                                                                                                                                      System.Console.WriteLine("Set resolution values to 96 dpi");
                                                                                                                                                      bmpImage.SetResolution(96.0, 96.0);

                                                                                                                                                      System.Console.WriteLine("The horizontal resolution, in pixels per inch: {0}", bmpImage.HorizontalResolution);
                                                                                                                                                      System.Console.WriteLine("The vertical resolution, in pixels per inch: {0}", bmpImage.VerticalResolution);
                                                                                                                                                  }

                                                                                                                                                  //The output may look like this:
                                                                                                                                                  //The pixel format: Rgb24Bpp, used channels: 8,8,8
                                                                                                                                                  //The raw line size in bytes: 1500
                                                                                                                                                  //The bitmap compression: Rgb
                                                                                                                                                  //The bitmap width: 500
                                                                                                                                                  //The bitmap height: 375
                                                                                                                                                  //The number of bits per pixel: 24
                                                                                                                                                  //The horizontal resolution, in pixels per inch: 0
                                                                                                                                                  //The vertical resolution, in pixels per inch: 0
                                                                                                                                                  //Set resolution values to 96 dpi
                                                                                                                                                  //The horizontal resolution, in pixels per inch: 96.012
                                                                                                                                                  //The vertical resolution, in pixels per inch: 96.012
                                                                                                                                              }

ToBitmap()

Raster resminizi bu basit yöntemle kolayca bir bit haritasına dönüştürün.Çeşitli görüntü biçimleri arasındaki geçişe ihtiyaç duyan geliştiriciler için mükemmel.

public override Bitmap ToBitmap()

Returns

Bitmap

Bitmap Hakkında

Examples

Aşağıdaki örnek bir BMP görüntüsünü bir GDI bit haritasına dönüştürür.

using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Load(@"c:\temp\sample.bmp"))
                                                                      {
                                                                          Aspose.Imaging.FileFormats.Bmp.BmpImage bmpImage = (Aspose.Imaging.FileFormats.Bmp.BmpImage)image;
                                                                          System.Drawing.Bitmap bitmap = bmpImage.ToBitmap();

                                                                          // Process the GDI bitmap.
                                                                      }

UpdateDimensions(int , int , int)

Görüntü boyutlarını güncelleyin.

protected override void UpdateDimensions(int newWidth, int newHeight)

Parameters

newWidth int

Yeni görüntü genişliği.

newHeight int

Yeni görüntü yüksekliği.

 Türkçe