public void save(String path) {  // ignore
    boolean success = false;

    File file = new File(path);
    if (!file.isAbsolute()) {
      if (parent != null) {
        //file = new File(parent.savePath(filename));
        path = parent.savePath(path);
      } else {
        String msg = "PImage.save() requires an absolute path. " +
          "Use createImage(), or pass savePath() to save().";
        PGraphics.showException(msg);
      }
    }

    // Make sure the pixel data is ready to go
    loadPixels();

    try {
      OutputStream os = null;

      if (saveImageFormats == null) {
        saveImageFormats = javax.imageio.ImageIO.getWriterFormatNames();
      }
      if (saveImageFormats != null) {
        for (int i = 0; i < saveImageFormats.length; i++) {
          if (path.endsWith("." + saveImageFormats[i])) {
            saveImageIO(path);
            return;
          }
        }
      }

      if (path.toLowerCase().endsWith(".tga")) {
        os = new BufferedOutputStream(new FileOutputStream(path), 32768);
        success = saveTGA(os); //, pixels, width, height, format);

      } else {
        if (!path.toLowerCase().endsWith(".tif") &&
            !path.toLowerCase().endsWith(".tiff")) {
          // if no .tif extension, add it..
          path += ".tif";
        }
        os = new BufferedOutputStream(new FileOutputStream(path), 32768);
        success = saveTIFF(os); //, pixels, width, height);
      }
      os.flush();
      os.close();

    } catch (IOException e) {
      //System.err.println("Error while saving image.");
      e.printStackTrace();
      success = false;
    }
    if (!success) {
      throw new RuntimeException("Error while saving image.");
    }
  }