Skip to content

Commit

Permalink
fix: CLI error in case of uppercased input or output file #60
Browse files Browse the repository at this point in the history
  • Loading branch information
esimov committed Sep 30, 2022
1 parent c5ba41e commit b07532c
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions cmd/pigo/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import (
"math"
"os"
"path/filepath"
"strings"
"time"

"github.com/disintegration/imaging"
Expand Down Expand Up @@ -160,7 +161,7 @@ func main() {
dst = os.Stdout
} else {
fileTypes := []string{".jpg", ".jpeg", ".png"}
ext := filepath.Ext(det.destination)
ext := filepath.Ext(strings.ToLower(det.destination))

if !inSlice(ext, fileTypes) {
log.Fatalf("Output file type not supported: %v", ext)
Expand Down Expand Up @@ -581,7 +582,7 @@ func (fd *faceDetector) encodeImage(dst io.Writer) error {

switch dst := dst.(type) {
case *os.File:
ext := filepath.Ext(dst.Name())
ext := filepath.Ext(strings.ToLower(dst.Name()))
switch ext {
case "", ".jpg", ".jpeg":
err = jpeg.Encode(dst, img, &jpeg.Options{Quality: 100})
Expand Down

0 comments on commit b07532c

Please sign in to comment.