java.lang.Object
de.vwsoft.barcodelib4j.image.BitmapImageIO
Provides static utility methods for writing raster graphics with a specified resolution.
The specified resolution is typically written to the header of an image file, allowing graphics software to determine the image's dimensions, such as in millimeters or inches. The formats currently supported are PNG, JPEG, and BMP.
-
Method Summary
Modifier and TypeMethodDescriptionstatic PointgetResolution(ImageReader imgReader) Retreives the resolution of an image.static voidwriteBMP(RenderedImage img, OutputStream out, int dpiResX, int dpiResY) Writes a rendered image in BMP format with the specified resolution.static voidwriteJPG(RenderedImage img, OutputStream out, int dpiResX, int dpiResY, float quality) Writes a rendered image in JPEG format with the specified resolution and quality.static voidwritePNG(RenderedImage img, OutputStream out, int dpiResX, int dpiResY) Writes a rendered image in PNG format with the specified resolution.static voidwriteTIFF(RenderedImage img, OutputStream out) Writes a rendered image in the standard TIFF format with LZW compression.
-
Method Details
-
writePNG
public static void writePNG(RenderedImage img, OutputStream out, int dpiResX, int dpiResY) throws IOException Writes a rendered image in PNG format with the specified resolution.- Parameters:
img- theRenderedImageobject to writeout- theOutputStreamto write the image data todpiResX- the horizontal resolution in dots per inch (DPI)dpiResY- the vertical resolution in dots per inch (DPI)- Throws:
IOException- if an I/O error occurs during writing
-
writeJPG
public static void writeJPG(RenderedImage img, OutputStream out, int dpiResX, int dpiResY, float quality) throws IOException Writes a rendered image in JPEG format with the specified resolution and quality.- Parameters:
img- theRenderedImageobject to writeout- theOutputStreamto write the image data todpiResX- the horizontal resolution in dots per inch (DPI)dpiResY- the vertical resolution in dots per inch (DPI)quality- the quality of the JPEG image (0.0f to 1.0f)- Throws:
IOException- if an I/O error occurs during writing
-
writeBMP
public static void writeBMP(RenderedImage img, OutputStream out, int dpiResX, int dpiResY) throws IOException Writes a rendered image in BMP format with the specified resolution.- Parameters:
img- theRenderedImageobject to writeout- theOutputStreamto write the image data todpiResX- the horizontal resolution in dots per inch (DPI)dpiResY- the vertical resolution in dots per inch (DPI)- Throws:
IOException- if an I/O error occurs during writing
-
writeTIFF
Writes a rendered image in the standard TIFF format with LZW compression.- Parameters:
img- theRenderedImageobject to writeout- theOutputStreamto write the image data to- Throws:
IOException- if an I/O error occurs during writing
-
getResolution
Retreives the resolution of an image.The formats currently supported are PNG, JPEG, and BMP.
- Parameters:
imgReader- theImageReaderobject used to read the image- Returns:
- a
Pointobject representing the resolution (in DPI) of the image - Throws:
IOException- if an I/O error occurs during reading
-