-
-
Notifications
You must be signed in to change notification settings - Fork 181
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ISSUE-281 Add NEF support by convert to jpg (#284)
Co-authored-by: Langel <[email protected]>
- Loading branch information
Showing
4 changed files
with
39 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package encoder | ||
|
||
import ( | ||
"github.com/jeremytorres/rawparser" | ||
"path/filepath" | ||
"strings" | ||
) | ||
|
||
func ConvertRawToJPG(rawPath, optimizedPath string) string { | ||
if !strings.HasSuffix(strings.ToLower(rawPath), ".nef") { | ||
// Maybe can use rawParser to convert other raw files to jpg, but I haven't tested it | ||
return rawPath | ||
} | ||
parser, _ := rawparser.NewNefParser(true) | ||
info := &rawparser.RawFileInfo{ | ||
File: rawPath, | ||
Quality: 100, | ||
DestDir: optimizedPath, | ||
} | ||
_, err := parser.ProcessFile(info) | ||
if err == nil { | ||
_, file := filepath.Split(rawPath) | ||
return optimizedPath + file + "_extracted.jpg" | ||
} | ||
return rawPath | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters