Skip to content

Commit 2468fe8

Browse files
committed
fix:Ugoira lowPoly image
1 parent fcac466 commit 2468fe8

File tree

2 files changed

+27
-21
lines changed

2 files changed

+27
-21
lines changed

src/main/kotlin/com/hcyacg/details/PicDetails.kt

+25-19
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ import java.awt.image.BufferedImage
2626
import java.io.ByteArrayInputStream
2727
import java.io.ByteArrayOutputStream
2828
import java.io.File
29+
import java.io.InputStream
2930
import java.util.concurrent.TimeUnit
3031
import javax.imageio.ImageIO
3132

@@ -384,26 +385,31 @@ object PicDetails {
384385
} // 读入需要播放的jpg文件
385386

386387

387-
val out = ByteArrayOutputStream()
388-
withContext(Dispatchers.IO) {
389-
ImageIO.write(src[i], "png", out)
390-
}
391-
// val input: InputStream = ByteArrayInputStream(out.toByteArray())
392-
e.addFrame(withContext(Dispatchers.IO) {
393-
ImageIO.read(
394-
ByteArrayInputStream(
395-
LowPoly.generate(
396-
ByteArrayInputStream(out.toByteArray()),
397-
200,
398-
1F,
399-
true,
400-
"png",
401-
false,
402-
200
403-
).toByteArray()
388+
389+
if(Config.lowPoly){
390+
val out = ByteArrayOutputStream()
391+
withContext(Dispatchers.IO) {
392+
ImageIO.write(src[i], "png", out)
393+
}
394+
e.addFrame(withContext(Dispatchers.IO) {
395+
ImageIO.read(
396+
ByteArrayInputStream(
397+
LowPoly.generate(
398+
ByteArrayInputStream(out.toByteArray()),
399+
200,
400+
1F,
401+
true,
402+
"png",
403+
false,
404+
200
405+
).toByteArray()
406+
)
404407
)
405-
)
406-
}) //添加到帧中
408+
}) //添加到帧中
409+
}else{
410+
e.addFrame(src[i])
411+
}
412+
407413
}
408414

409415
e.finish()

src/main/kotlin/com/hcyacg/initial/Command.kt

+2-2
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ object Command: AutoSavePluginConfig("Command") {
4545
@ValueDescription("帮助")
4646
var help: String by value("帮助")
4747

48-
@ValueName("晶格化")
48+
@ValueName("lowPoly")
4949
@ValueDescription("晶格化命令")
50-
var lowPoly: String by value("帮助")
50+
var lowPoly: String by value("晶格化")
5151
}

0 commit comments

Comments
 (0)