Package in.itzmeanjan.filterit
Class ImportExportImage
- java.lang.Object
-
- in.itzmeanjan.filterit.ImportExportImage
-
public class ImportExportImage extends java.lang.Object
Helper class to read content of an image into BufferedImage object & write BufferedImage into image file
-
-
Constructor Summary
Constructors Constructor Description ImportExportImage()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static in.itzmeanjan.filterit.ReturnVal
exportImage(java.awt.image.BufferedImage img, java.lang.String sink)
Exports content of BufferedImage into a sink filestatic java.lang.String
imageExtension(java.lang.String fileName)
Given an image file name, obtains extension of that image i.e.static java.awt.image.BufferedImage
importImage(java.lang.String src)
Reads content of specified image file into a BufferedImage objectstatic java.awt.image.BufferedImage
prepareCanvas(int width, int height, java.awt.Color color)
Generates a RGB buffered image of specified size, with each pixel set to given colorstatic java.awt.image.BufferedImage
setCanvas(java.awt.image.BufferedImage img, java.awt.Color color)
Given a buffered image, we'll modify it by setting each pixel with provided color, could be helpful in setting background of image & then draw on it.
-
-
-
Method Detail
-
importImage
public static java.awt.image.BufferedImage importImage(java.lang.String src)
Reads content of specified image file into a BufferedImage object
-
exportImage
public static in.itzmeanjan.filterit.ReturnVal exportImage(java.awt.image.BufferedImage img, java.lang.String sink)
Exports content of BufferedImage into a sink file
-
imageExtension
public static java.lang.String imageExtension(java.lang.String fileName)
Given an image file name, obtains extension of that image i.e. jpg / png
-
setCanvas
public static java.awt.image.BufferedImage setCanvas(java.awt.image.BufferedImage img, java.awt.Color color)
Given a buffered image, we'll modify it by setting each pixel with provided color, could be helpful in setting background of image & then draw on it.- Parameters:
img
- Image to be modifiedcolor
- Color value to be set at each pixel location across image I- Returns:
- Returns modified image buffer, in place editing performed
-
prepareCanvas
public static java.awt.image.BufferedImage prepareCanvas(int width, int height, java.awt.Color color)
Generates a RGB buffered image of specified size, with each pixel set to given color- Parameters:
width
- Width of image to be generatedheight
- Height of image to be generatedcolor
- Color at each pixel on image- Returns:
- Buffered RGB image with pixels set to specified color intensity value
-
-