public static final byte[] getImageBytes(Webcam webcam, String format) { return ImageUtils.toByteArray(webcam.getImage(), format); }
@Override public void process(Exchange exchange) throws Exception { Webcam webcam = getEndpoint().getWebcam(); if (webcam == null) { throw new WebcamNotFoundException("No webcams found"); } else if (!webcam.isOpen() && !webcam.open()) { throw new IllegalStateException("Unable to open webcam"); } BufferedImage image = webcam.getImage(); if (image != null) { exchange.getIn().setBody(ImageUtils.toByteArray(image, getEndpoint().getFormat())); } }