mirror of
https://github.com/librecaptcha/lc-core.git
synced 2025-11-29 05:18:50 -05:00
Rename DPISetter to PngImageWritter
Make fn static Signed-off-by: Rahul Rudragoudar <rr83019@gmail.com>
This commit is contained in:
@@ -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()
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user