From dbb93e2f73eaf476594cd76002434745702da0a3 Mon Sep 17 00:00:00 2001 From: celogeek <65178+celogeek@users.noreply.github.com> Date: Sun, 15 Jan 2023 14:36:09 +0100 Subject: [PATCH] use pixel filter --- internal/epub/image_filters.go | 1 + internal/epub/image_processing.go | 7 +------ 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/internal/epub/image_filters.go b/internal/epub/image_filters.go index c2ec6e5..4839dba 100644 --- a/internal/epub/image_filters.go +++ b/internal/epub/image_filters.go @@ -20,6 +20,7 @@ func NewGift(options *ImageOptions) *gift.GIFT { } g.Add( gift.ResizeToFit(options.ViewWidth, options.ViewHeight, gift.LanczosResampling), + filters.Pixel(), ) return g } diff --git a/internal/epub/image_processing.go b/internal/epub/image_processing.go index 4d9d338..0e4be29 100644 --- a/internal/epub/image_processing.go +++ b/internal/epub/image_processing.go @@ -144,12 +144,7 @@ func LoadImages(path string, options *ImageOptions) ([]*Image, error) { // Convert image dst := image.NewPaletted(g.Bounds(src.Bounds()), options.Palette) - if dst.Bounds().Dx() == 0 || dst.Bounds().Dy() == 0 { - dst = image.NewPaletted(image.Rect(0, 0, 1, 1), dst.Palette) - dst.Set(0, 0, color.White) - } else { - g.Draw(dst, src) - } + g.Draw(dst, src) imageOutput <- &Image{ img.Id,