(PImage image, String path, String... args)
| 516 | |
| 517 | |
| 518 | static public boolean saveImage(PImage image, String path, String... args) { |
| 519 | if (saveImageExtensions == null) { |
| 520 | saveImageExtensions = javax.imageio.ImageIO.getWriterFormatNames(); |
| 521 | } |
| 522 | try { |
| 523 | if (saveImageExtensions != null) { |
| 524 | for (String saveImageFormat : saveImageExtensions) { |
| 525 | if (path.endsWith("." + saveImageFormat)) { |
| 526 | if (!saveImageIO(image, path, args)) { |
| 527 | System.err.println("Error while saving image."); |
| 528 | return false; |
| 529 | } |
| 530 | return true; |
| 531 | } |
| 532 | } |
| 533 | System.err.println("Could not save " + path + ", " + |
| 534 | "make sure it ends with a supported extension " + |
| 535 | "(" + PApplet.join(saveImageExtensions, ", ") + ")"); |
| 536 | } |
| 537 | } catch (IOException e) { |
| 538 | e.printStackTrace(); |
| 539 | } |
| 540 | return false; |
| 541 | } |
| 542 | |
| 543 | |
| 544 | static protected String[] saveImageExtensions; |
no test coverage detected