-
-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathdng.go
40 lines (34 loc) · 823 Bytes
/
dng.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
package main
import (
"context"
"log"
"strconv"
"github.com/ncruces/rethinkraw/pkg/dngconv"
"golang.org/x/sync/semaphore"
)
var semDNGConverter = semaphore.NewWeighted(3)
func runDNGConverter(ctx context.Context, input, output string, side int, exp *exportSettings) error {
args := []string{}
if exp != nil && exp.DNG {
if exp.Preview != "" {
args = append(args, "-"+exp.Preview)
}
if exp.Lossy {
args = append(args, "-lossy")
}
if exp.Embed {
args = append(args, "-e")
}
} else {
if side > 0 {
args = append(args, "-lossy", "-side", strconv.Itoa(side))
}
args = append(args, "-p2")
}
if err := semDNGConverter.Acquire(ctx, 1); err != nil {
return err
}
defer semDNGConverter.Release(1)
log.Print("dng converter...")
return dngconv.Convert(ctx, input, output, args...)
}