Class ImageEncoderPNG
java.lang.Object
one.jpro.platform.image.manager.encoder.ImageEncoderPNG
- All Implemented Interfaces:
ImageEncoder,JsonConvertible
An implementation of the ImageEncoder interface for PNG image format.
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionGets the file extension for this encoder, which is "png".voidsaveImage(BufferedImage image, File target) Saves the provided BufferedImage to a specified target file in PNG format.org.json.JSONObjecttoJSON()Converts the object to a JSON representation.
-
Constructor Details
-
ImageEncoderPNG
public ImageEncoderPNG()
-
-
Method Details
-
saveImage
Saves the provided BufferedImage to a specified target file in PNG format.- Specified by:
saveImagein interfaceImageEncoder- Parameters:
image- The BufferedImage to be saved.target- The target file where the image should be saved.- Throws:
ImageEncoderException- If there's an error during the save process, or if the provided format is unsupported.
-
getFileExtension
Gets the file extension for this encoder, which is "png".- Specified by:
getFileExtensionin interfaceImageEncoder- Returns:
- The file extension string.
-
toJSON
public org.json.JSONObject toJSON()Description copied from interface:JsonConvertibleConverts the object to a JSON representation.- Specified by:
toJSONin interfaceJsonConvertible- Returns:
- A JSONObject representing the object.
-