chore: improve code and add image type option
This commit is contained in:
8 files changed
+27
-15
No files matched your search
@@ -7,6 +7,7 @@
|
||||
|
||||
package cn.rtast.fancybot.util
|
||||
|
||||
import cn.rtast.fancybot.configManager
|
||||
import java.awt.Graphics2D
|
||||
import java.awt.geom.RoundRectangle2D
|
||||
import java.awt.image.BufferedImage
|
||||
@@ -58,7 +59,7 @@ fun ByteArray.toBufferedImage(): BufferedImage {
|
||||
|
||||
fun BufferedImage.toByteArray(): ByteArray {
|
||||
ByteArrayOutputStream().use { outputStream ->
|
||||
ImageIO.write(this, "png", outputStream)
|
||||
ImageIO.write(this, configManager.imageType.typeName, outputStream)
|
||||
return outputStream.toByteArray()
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user