缩略图生成器支持 LibRaw (#2109)
* feat: 增加 LibRaw 缩略图生成器。 * feat: 生成 RAW 图像的缩略图时,旋转缩略图的方向。 * update: RAW 缩略图支持镜像方向。
This commit is contained in:
@@ -23,6 +23,8 @@ func TestGenerator(ctx context.Context, name, executable string) (string, error)
|
||||
return testFfmpegGenerator(ctx, executable)
|
||||
case "libreOffice":
|
||||
return testLibreOfficeGenerator(ctx, executable)
|
||||
case "libRaw":
|
||||
return testLibRawGenerator(ctx, executable)
|
||||
default:
|
||||
return "", ErrUnknownGenerator
|
||||
}
|
||||
@@ -72,3 +74,18 @@ func testLibreOfficeGenerator(ctx context.Context, executable string) (string, e
|
||||
|
||||
return output.String(), nil
|
||||
}
|
||||
|
||||
func testLibRawGenerator(ctx context.Context, executable string) (string, error) {
|
||||
cmd := exec.CommandContext(ctx, executable)
|
||||
var output bytes.Buffer
|
||||
cmd.Stdout = &output
|
||||
if err := cmd.Run(); err != nil {
|
||||
return "", fmt.Errorf("failed to invoke libraw executable: %w", err)
|
||||
}
|
||||
|
||||
if !strings.Contains(output.String(), "LibRaw") {
|
||||
return "", ErrUnknownOutput
|
||||
}
|
||||
|
||||
return output.String(), nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user