title: Directly convert BufferedImage in a File object
body: <p>I saw many examples on the internet on how to convert a File into a BufferedImage, but I need to make a counter conversion. </p>
  
  <p>I've tried some ways, but all are quite complicated. </p>
  
  <p>I wonder if there is a direct way to accomplish this.</p>
  
  <p>I have this in my code:</p>
  
  <pre><code>for (FileItem item : formItems) {
                  // processes only fields that are not form fields
                  if (!item.isFormField()) {
                      Date date = new Date();
                      String fileName = new File(item.getName()).getName();
                      String filePath = uploadPath + date.getTime() + fileName + ".tmp";
                      File storeFile = new File(filePath);
  
                      BufferedImage tempImg = ImageIO.read(storeFile);
  
                      //I make process in the tempImg
  
                      //I need save it
                      item.write(tempImg);
                  }
              }
  </code></pre>
  
  <p>I don't need write a FileItem, but the BufferedImage that I have processed.</p>