Skip to content

Commit

Permalink
changed some uses of ThumbPhoto to ThumbPixels.
Browse files Browse the repository at this point in the history
  • Loading branch information
bengarrett committed Sep 29, 2024
1 parent c0a4339 commit 30c4367
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions internal/command/images.go
Original file line number Diff line number Diff line change
Expand Up @@ -461,7 +461,7 @@ func (dir Dirs) textImagers(debug *zap.SugaredLogger, unid, tmp string) error {
}()
go func() { // Thumbnail of the ansilove PNG image
defer wg.Done()
if err := dir.ThumbPhoto(tmp, unid); err != nil {
if err := dir.ThumbPixels(tmp, unid); err != nil {
mu.Lock()
errs = errors.Join(errs, fmt.Errorf("ansilove thumbnail %w", err))
mu.Unlock()
Expand Down Expand Up @@ -584,7 +584,7 @@ func (dir Dirs) PreviewGIF(debug *zap.SugaredLogger, src, unid string) error {
wg.Add(1)
go func() {
defer wg.Done()
err = dir.ThumbPhoto(tmp, unid)
err = dir.ThumbPixels(tmp, unid)
}()
wg.Wait()
defer os.Remove(tmp)
Expand Down Expand Up @@ -617,7 +617,7 @@ func (dir Dirs) PreviewPNG(debug *zap.SugaredLogger, src, unid string) error {
}()
go func() {
defer wg.Done()
err := dir.ThumbPhoto(src, unid)
err := dir.ThumbPixels(src, unid)
if err != nil {
mu.Lock()
errs = errors.Join(errs, fmt.Errorf("thumbnail png %w", err))
Expand Down Expand Up @@ -889,6 +889,8 @@ func (a *Args) GWebp() {

// ThumbPixels converts the src image to a 400x400 pixel, webp image in the thumbnail directory.
// The conversion is done using a temporary, lossless PNG image.
//
// This is used for text and pixel art images and increases the image file size.
func (dir Dirs) ThumbPixels(src, unid string) error {
tmp := filepath.Join(dir.Thumbnail, unid+png)
args := Args{}
Expand Down Expand Up @@ -916,6 +918,8 @@ func (dir Dirs) ThumbPixels(src, unid string) error {

// ThumbPhoto converts the src image to a 400x400 pixel, webp image in the thumbnail directory.
// The conversion is done using a temporary, lossy PNG image.
//
// This is used for photographs and images that are not text or pixel art.
func (dir Dirs) ThumbPhoto(src, unid string) error {
tmp := BaseNamePath(src) + jpg
args := Args{}
Expand Down

0 comments on commit 30c4367

Please sign in to comment.