Someone
public text v1 · immutableBufferedImage iOut = new BufferedImage(finalw, finalh, BufferedImage.TYPE_INT_RGB);
Image wtf = iIn.getScaledInstance(finalw, finalh, BufferedImage.SCALE_AREA_AVERAGING);
iOut.getGraphics().drawImage(wtf, 0, 0, null);
ByteArrayOutputStream byteStream = new ByteArrayOutputStream();
ImageIO.write(iOut, "jpeg", byteStream);
byte[] blap = byteStream.toByteArray();