From da8468b83aef15ba4f4eedc8b2926ce06bc384e6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Fernando=20Casta=C3=B1eda=20Estrada?= Date: Fri, 10 Apr 2015 18:25:37 -0500 Subject: [PATCH] Fix extension name image file. --- .../src/main/java/com/github/sarxos/webcam/WebcamUtils.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/webcam-capture/src/main/java/com/github/sarxos/webcam/WebcamUtils.java b/webcam-capture/src/main/java/com/github/sarxos/webcam/WebcamUtils.java index b7a4ad88..c7024e42 100644 --- a/webcam-capture/src/main/java/com/github/sarxos/webcam/WebcamUtils.java +++ b/webcam-capture/src/main/java/com/github/sarxos/webcam/WebcamUtils.java @@ -37,7 +37,7 @@ public static final void capture(Webcam webcam, File file, String format) { } public static final void capture(Webcam webcam, String filename) { - if (filename.endsWith(".jpg")) { + if (!filename.endsWith(".jpg")) { filename = filename + ".jpg"; } capture(webcam, new File(filename)); @@ -45,7 +45,7 @@ public static final void capture(Webcam webcam, String filename) { public static final void capture(Webcam webcam, String filename, String format) { String ext = "." + format.toLowerCase(); - if (!filename.startsWith(ext)) { + if (!filename.endsWith(ext)) { filename = filename + ext; } capture(webcam, new File(filename), format);