mirror of
https://github.com/woodchen-ink/webp_server_go.git
synced 2025-07-18 13:42:02 +08:00
23 lines
467 B
Go
23 lines
467 B
Go
package encoder
|
|
|
|
import (
|
|
"path/filepath"
|
|
|
|
"github.com/jeremytorres/rawparser"
|
|
)
|
|
|
|
func ConvertRawToJPG(rawPath, optimizedPath string) (string, bool) {
|
|
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", true
|
|
}
|
|
return rawPath, false
|
|
}
|