I try to make captcha using JCaptcha Component and i need to encode image in related servlet. So according to JCaptcha Tutorial, I should use JPEGImageEncoder and it\'s not
Use ImageIO:
// Image writer
ImageWriter imageWriter = (ImageWriter)ImageIO.getImageWritersBySuffix("jpeg").next();
ImageOutputStream ios = ImageIO.createImageOutputStream(jpegOutputStream);
imageWriter.setOutput(ios);
IIOMetadata imageMetaData = imageWriter.getDefaultImageMetadata(new ImageTypeSpecifier(challenge), null);
imageWriter.write(imageMetaData, new IIOImage(challenge, null, null), null);
This is replacing the deprecated JPEG functions