Rename DPISetter to PngImageWritter

Make fn static

Signed-off-by: Rahul Rudragoudar <rr83019@gmail.com>
This commit is contained in:
Rahul Rudragoudar
2021-09-01 22:57:26 +05:30
parent 26d86bca4c
commit f83289514b
5 changed files with 13 additions and 17 deletions

View File

@@ -11,7 +11,7 @@ import java.util.List
import lc.misc.HelperFunctions
import lc.captchas.interfaces.Challenge
import lc.captchas.interfaces.ChallengeProvider
import lc.misc.DPISetter
import lc.misc.PngImageWriter
/** This captcha is only for debugging purposes. It creates very simple captchas that are deliberately easy to solve with OCR engines */
class DebugCaptcha extends ChallengeProvider {
@@ -53,8 +53,7 @@ class DebugCaptcha extends ChallengeProvider {
graphics2D.dispose()
val baos = new ByteArrayOutputStream()
try {
val dpi = new DPISetter();
dpi.setDPI(baos, img);
PngImageWriter.write(baos, img);
} catch {
case e: Exception =>
e.printStackTrace()

View File

@@ -10,7 +10,7 @@ import java.awt.Color
import lc.captchas.interfaces.ChallengeProvider
import lc.captchas.interfaces.Challenge
import java.util.{List => JavaList, Map => JavaMap}
import lc.misc.DPISetter
import lc.misc.PngImageWriter
class LabelCaptcha extends ChallengeProvider {
private var knownFiles = new File("known").list.toList
@@ -50,8 +50,7 @@ class LabelCaptcha extends ChallengeProvider {
val token = encrypt(knownImageFile + "," + unknownImageFile)
val baos = new ByteArrayOutputStream()
val dpi = new DPISetter();
dpi.setDPI(baos, mergedImage);
PngImageWriter.write(baos, mergedImage);
new Challenge(baos.toByteArray(), "image/png", token)
}