Packages

 

com.aspose.imaging.fileformats.bmp

Class BmpImage

    • Constructor Detail

      • BmpImage

        public BmpImage(String path)

        Initializes a new instance of the BmpImage class.

        Parameters:
        path - The path to load image from and initialize pixel and palette data with.
        Throws:
        com.aspose.ms.System.ArgumentNullException - raster image is null;rasterImage
        BmpImageException - The height should be positive.
        com.aspose.ms.System.ArgumentException - Palette should be specified for images with 8 bits per pixel or less.;palette
      • BmpImage

        public BmpImage(String path,
                        int bitsPerPixel,
                        long compression,
                        double horizontalResolution,
                        double verticalResolution)

        Initializes a new instance of the BmpImage class.

        Parameters:
        path - The path to load image from and initialize pixel and palette data with.
        bitsPerPixel - The bits per pixel.
        compression - The compression to use.
        horizontalResolution - The horizontal resolution. Note due to the rounding the resulting resolution may slightly differ from the passed.
        verticalResolution - The vertical resolution. Note due to the rounding the resulting resolution may slightly differ from the passed.
        Throws:
        com.aspose.ms.System.ArgumentNullException - The raster image cannot be null;rasterImage
        BmpImageException - The height should be positive.
        com.aspose.ms.System.ArgumentException - Palette should be specified for images with 8 bits per pixel or less.;palette
      • BmpImage

        public BmpImage(InputStream stream)

        Initializes a new instance of the BmpImage class.

        Parameters:
        stream - The stream to load image from and initialize pixel and palette data with.
        Throws:
        com.aspose.ms.System.ArgumentNullException - The raster image cannot be null;rasterImage
        BmpImageException - The height should be positive.
        com.aspose.ms.System.ArgumentException - Palette should be specified for images with 8 bits per pixel or less.;palette
      • BmpImage

        public BmpImage(InputStream stream,
                        int bitsPerPixel,
                        long compression,
                        double horizontalResolution,
                        double verticalResolution)

        Initializes a new instance of the BmpImage class.

        Parameters:
        stream - The stream to load image from and initialize pixel and palette data with.
        bitsPerPixel - The bits per pixel.
        compression - The compression to use.
        horizontalResolution - The horizontal resolution. Note due to the rounding the resulting resolution may slightly differ from the passed.
        verticalResolution - The vertical resolution. Note due to the rounding the resulting resolution may slightly differ from the passed.
        Throws:
        com.aspose.ms.System.ArgumentNullException - The raster image cannot be null;rasterImage
        BmpImageException - The height should be positive.
        com.aspose.ms.System.ArgumentException - Palette should be specified for images with 8 bits per pixel or less.;palette
      • BmpImage

        public BmpImage(RasterImage rasterImage)

        Initializes a new instance of the BmpImage class.

        Parameters:
        rasterImage - The image to initialize pixel and palette data with.
        Throws:
        com.aspose.ms.System.ArgumentNullException - The raster image cannot be null;rasterImage
        BmpImageException - The height should be positive.
        com.aspose.ms.System.ArgumentException - Palette should be specified for images with 8 bits per pixel or less.;palette
      • BmpImage

        public BmpImage(RasterImage rasterImage,
                        int bitsPerPixel,
                        long compression,
                        double horizontalResolution,
                        double verticalResolution)

        Initializes a new instance of the BmpImage class.

        Parameters:
        rasterImage - The image to initialize pixel and palette data with.
        bitsPerPixel - The bits per pixel.
        compression - The compression to use.
        horizontalResolution - The horizontal resolution. Note due to the rounding the resulting resolution may slightly differ from the passed.
        verticalResolution - The vertical resolution. Note due to the rounding the resulting resolution may slightly differ from the passed.
        Throws:
        com.aspose.ms.System.ArgumentNullException - The raster image cannot be null;rasterImage
        BmpImageException - The height should be positive.
        com.aspose.ms.System.ArgumentException - Palette should be specified for images with 8 bits per pixel or less.;palette
      • BmpImage

        public BmpImage(int width,
                        int height)

        Initializes a new instance of the BmpImage class.

        Parameters:
        width - The image width.
        height - The image height.
        Throws:
        BmpImageException - The height should be positive.
        com.aspose.ms.System.ArgumentException - Palette should be specified for images with 8 bits per pixel or less.;palette
      • BmpImage

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

        Initializes a new instance of the BmpImage class.

        Parameters:
        width - The image width.
        height - The image height.
        bitsPerPixel - The bits per pixel.
        palette - The color palette.
        Throws:
        BmpImageException - The height should be positive.
        com.aspose.ms.System.ArgumentException - Palette should be specified for images with 8 bits per pixel or less.;palette
      • BmpImage

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

        Initializes a new instance of the BmpImage class.

        Parameters:
        width - The image width.
        height - The image height.
        bitsPerPixel - The bits per pixel.
        palette - The color palette.
        compression - The compression to use.
        horizontalResolution - The horizontal resolution. Note due to the rounding the resulting resolution may slightly differ from the passed.
        verticalResolution - The vertical resolution. Note due to the rounding the resulting resolution may slightly differ from the passed.
        Throws:
        BmpImageException - The height should be positive.
        com.aspose.ms.System.ArgumentException - Palette should be specified for images with 8 bits per pixel or less.;palette
    • Method Detail

      • getBitmapInfoHeader

        public BitmapInfoHeader getBitmapInfoHeader()

        Gets the bitmap information header.

        Value: The bitmap information header.
      • getFileFormat

        public long getFileFormat()

        Gets a value of file format

        Overrides:
        getFileFormat in class Image
      • getRawLineSize

        public int getRawLineSize()

        Gets the raw line size in bytes.

        Value: The raw line size in bytes.
        Overrides:
        getRawLineSize in class RasterImage
        Returns:
        The raw line size in bytes.
      • getCompression

        public long getCompression()

        Gets the image compression.

        Value: The image compression.
      • getWidth

        public int getWidth()

        Gets the image width.

        Value: The image width.
        Specified by:
        getWidth in interface IObjectWithBounds
        Specified by:
        getWidth in class Image
        Returns:
        The image width.
      • getHeight

        public int getHeight()

        Gets the image height.

        Value: The image height.
        Specified by:
        getHeight in interface IObjectWithBounds
        Specified by:
        getHeight in class Image
        Returns:
        The image height.
      • getBitsPerPixel

        public int getBitsPerPixel()

        Gets the image bits per pixel count.

        Value: The image bits per pixel count.
        Specified by:
        getBitsPerPixel in class Image
        Returns:
        The image bits per pixel count.
      • getHorizontalResolution

        public double getHorizontalResolution()

        Gets or sets the horizontal resolution, in pixels per inch, of this RasterImage.

        Value: The horizontal resolution.

        Note by default this value is always 96 since different platforms cannot return the screen resolution. You may consider using the SetResolution method for updating both resolution values in single call.

        Overrides:
        getHorizontalResolution in class RasterImage
        Returns:
        The horizontal resolution.

        Note by default this value is always 96 since different platforms cannot return the screen resolution. You may consider using the SetResolution method for updating both resolution values in single call.

      • setHorizontalResolution

        public void setHorizontalResolution(double value)

        Gets or sets the horizontal resolution, in pixels per inch, of this RasterImage.

        Value: The horizontal resolution.

        Note by default this value is always 96 since different platforms cannot return the screen resolution. You may consider using the SetResolution method for updating both resolution values in single call.

        Overrides:
        setHorizontalResolution in class RasterImage
        Parameters:
        value - The horizontal resolution.

        Note by default this value is always 96 since different platforms cannot return the screen resolution. You may consider using the SetResolution method for updating both resolution values in single call.

      • getVerticalResolution

        public double getVerticalResolution()

        Gets or sets the vertical resolution, in pixels per inch, of this RasterImage.

        Value: The vertical resolution.

        Note by default this value is always 96 since different platforms cannot return the screen resolution. You may consider using the SetResolution method for updating both resolution values in single call.

        Overrides:
        getVerticalResolution in class RasterImage
        Returns:
        The vertical resolution.

        Note by default this value is always 96 since different platforms cannot return the screen resolution. You may consider using the SetResolution method for updating both resolution values in single call.

      • setVerticalResolution

        public void setVerticalResolution(double value)

        Gets or sets the vertical resolution, in pixels per inch, of this RasterImage.

        Value: The vertical resolution.

        Note by default this value is always 96 since different platforms cannot return the screen resolution. You may consider using the SetResolution method for updating both resolution values in single call.

        Overrides:
        setVerticalResolution in class RasterImage
        Parameters:
        value - The vertical resolution.

        Note by default this value is always 96 since different platforms cannot return the screen resolution. You may consider using the SetResolution method for updating both resolution values in single call.

      • setResolution

        public void setResolution(double dpiX,
                                  double dpiY)

        Sets the resolution for this RasterImage.

        Overrides:
        setResolution in class RasterImage
        Parameters:
        dpiX - The horizontal resolution, in dots per inch, of the RasterImage.
        dpiY - The vertical resolution, in dots per inch, of the RasterImage.