diff --git a/assets b/assets index e47a708..a827cc6 160000 --- a/assets +++ b/assets @@ -1 +1 @@ -Subproject commit e47a708f727bf5243512ddd6d9c6eabd5bf61751 +Subproject commit a827cc60f232ed8fb95afa6d3d434ef1c41ed251 diff --git a/pkg/thumb/ffmpeg.go b/pkg/thumb/ffmpeg.go index c94a829..c89371c 100644 --- a/pkg/thumb/ffmpeg.go +++ b/pkg/thumb/ffmpeg.go @@ -41,7 +41,7 @@ func (f *FfmpegGenerator) Generate(ctx context.Context, es entitysource.EntitySo tempOutputPath := filepath.Join( util.DataPath(f.settings.TempPath(ctx)), thumbTempFolder, - fmt.Sprintf("thumb_%s.%s", uuid.Must(uuid.NewV4()).String(), f.settings.ThumbEncode(ctx).Format), + fmt.Sprintf("thumb_%s.png", uuid.Must(uuid.NewV4()).String()), ) if err := util.CreatNestedFolder(filepath.Dir(tempOutputPath)); err != nil { diff --git a/pkg/thumb/libreoffice.go b/pkg/thumb/libreoffice.go index dfdfe18..e062626 100644 --- a/pkg/thumb/libreoffice.go +++ b/pkg/thumb/libreoffice.go @@ -69,10 +69,9 @@ func (l *LibreOfficeGenerator) Generate(ctx context.Context, es entitysource.Ent } // Convert the document to an image - encode := l.settings.ThumbEncode(ctx) cmd := exec.CommandContext(ctx, l.settings.LibreOfficePath(ctx), "--headless", "--nologo", "--nofirststartwizard", "--invisible", "--norestore", "--convert-to", - encode.Format, "--outdir", tempOutputPath, tempInputPath) + "png", "--outdir", tempOutputPath, tempInputPath) // Redirect IO var stdErr bytes.Buffer @@ -86,7 +85,7 @@ func (l *LibreOfficeGenerator) Generate(ctx context.Context, es entitysource.Ent return &Result{ Path: filepath.Join( tempOutputPath, - strings.TrimSuffix(filepath.Base(tempInputPath), filepath.Ext(tempInputPath))+"."+encode.Format, + strings.TrimSuffix(filepath.Base(tempInputPath), filepath.Ext(tempInputPath))+".png", ), Continue: true, Cleanup: []func(){func() { _ = os.RemoveAll(tempOutputPath) }}, diff --git a/pkg/thumb/vips.go b/pkg/thumb/vips.go index 2e1001e..ee854d6 100644 --- a/pkg/thumb/vips.go +++ b/pkg/thumb/vips.go @@ -38,8 +38,8 @@ func (v *VipsGenerator) Generate(ctx context.Context, es entitysource.EntitySour outputOpt := ".png" encode := v.settings.ThumbEncode(ctx) - if encode.Format == "jpg" { - outputOpt = fmt.Sprintf(".jpg[Q=%d]", encode.Quality) + if encode.Format == "jpg" || encode.Format == "webp" { + outputOpt = fmt.Sprintf(".%s[Q=%d]", encode.Format, encode.Quality) } input := "[descriptor=0]"