1

I want to take some pictures with the Raspberry PI Camara. This works fine. But I cannot load the pictures after I've save them on the PI… Here is the code how I load the Images:

    BufferedImage imgBuff = null;
    try {
        imgBuff = ImageIO.read(new File(saveFile + picName));
    } catch (IOException e) {
        e.printStackTrace();
    }
    PlanarImage imgPI = PlanarImage.wrapRenderedImage(imgBuff);

And here is the exception: javax.imageio.IIOException: Can't read input file! But the Image exists... Here is the code how I take the pictures:

    try {
        StringBuilder sb = new StringBuilder(raspistillPath);
        sb.append(" -n -bm");
        sb.append(" -t " + picTimeout);
        sb.append(" -w " + picWidth);
        sb.append(" -h " + picHeight);
        sb.append(" -q " + picQuality);
        sb.append(" -e " + picType);
        sb.append(" -o " + saveFile + picName);

        Runtime.getRuntime().exec(sb.toString());
        Thread.sleep(picTimeout);

    } catch (Exception e) {
        System.exit(e.hashCode());          

    }
selan sama
  • 35
  • 3
  • Is "saveFile + picname" really resulting the path that you expect? And does the user executing the java have rights on that path? What format do you specify? – Fildor Nov 16 '15 at 14:38
  • when I restart the program, I can load the images without problems... so the path, the picname and the rights are not the problem. – selan sama Nov 16 '15 at 15:23
  • when I start the program for the fist time, I take a pic, save it and load it (in the same session) then I become an exception. But when I start the program for the second time... the images could be found... – selan sama Nov 16 '15 at 15:33

0 Answers0