Skip to content

Commit e2914f9

Browse files
committed
Merge pull request #330 from fcestrada/master
Fix extension name image file.
2 parents 0d41c59 + da8468b commit e2914f9

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

webcam-capture/src/main/java/com/github/sarxos/webcam/WebcamUtils.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,15 +37,15 @@ public static final void capture(Webcam webcam, File file, String format) {
3737
}
3838

3939
public static final void capture(Webcam webcam, String filename) {
40-
if (filename.endsWith(".jpg")) {
40+
if (!filename.endsWith(".jpg")) {
4141
filename = filename + ".jpg";
4242
}
4343
capture(webcam, new File(filename));
4444
}
4545

4646
public static final void capture(Webcam webcam, String filename, String format) {
4747
String ext = "." + format.toLowerCase();
48-
if (!filename.startsWith(ext)) {
48+
if (!filename.endsWith(ext)) {
4949
filename = filename + ext;
5050
}
5151
capture(webcam, new File(filename), format);

0 commit comments

Comments
 (0)