fix autosplit double page

only check source width > height
This commit is contained in:
Celogeek 2023-04-25 20:07:55 +02:00
parent 07e04e514b
commit 7eebd18538
Signed by: celogeek
SSH Key Fingerprint: SHA256:njNJLzoLQdbV9PC6ehcruRb0QnEgxABoCYZ+0+aUIYc

View File

@ -114,18 +114,16 @@ func LoadImages(o *Options) ([]*epubimage.Image, error) {
} }
imageOutput <- &epubimage.Image{ imageOutput <- &epubimage.Image{
Id: img.Id, Id: img.Id,
Part: 0, Part: 0,
Raw: raw, Raw: raw,
Data: epubimagedata.New(img.Id, 0, dst, o.Image.Quality), Data: epubimagedata.New(img.Id, 0, dst, o.Image.Quality),
Width: dst.Bounds().Dx(), Width: dst.Bounds().Dx(),
Height: dst.Bounds().Dy(), Height: dst.Bounds().Dy(),
IsCover: img.Id == 0, IsCover: img.Id == 0,
DoublePage: src.Bounds().Dx() > src.Bounds().Dy() && DoublePage: src.Bounds().Dx() > src.Bounds().Dy(),
src.Bounds().Dx() > o.Image.ViewHeight && Path: img.Path,
src.Bounds().Dy() > o.Image.ViewWidth, Name: img.Name,
Path: img.Path,
Name: img.Name,
} }
// Auto split double page // Auto split double page
@ -133,9 +131,7 @@ func LoadImages(o *Options) ([]*epubimage.Image, error) {
// Only if the src image have width > height and is bigger than the view // Only if the src image have width > height and is bigger than the view
if (!o.Image.HasCover || img.Id > 0) && if (!o.Image.HasCover || img.Id > 0) &&
o.Image.AutoSplitDoublePage && o.Image.AutoSplitDoublePage &&
src.Bounds().Dx() > src.Bounds().Dy() && src.Bounds().Dx() > src.Bounds().Dy() {
src.Bounds().Dx() > o.Image.ViewHeight &&
src.Bounds().Dy() > o.Image.ViewWidth {
gifts := epubimage.NewGiftSplitDoublePage(o.Image) gifts := epubimage.NewGiftSplitDoublePage(o.Image)
for i, g := range gifts { for i, g := range gifts {
part := i + 1 part := i + 1