From f9ebe71b9e4d97d540f71ddb010d9aad6f73be87 Mon Sep 17 00:00:00 2001 From: celogeek <65178+celogeek@users.noreply.github.com> Date: Tue, 7 May 2024 08:55:42 +0200 Subject: [PATCH] crop double page after autocrop fix landscape display when each side can be cut differently. A doublepage is 1 big image, and should be cut as one. --- internal/epub/imageprocessor/epub_image_processor.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/internal/epub/imageprocessor/epub_image_processor.go b/internal/epub/imageprocessor/epub_image_processor.go index 3f40d38..4dd811c 100644 --- a/internal/epub/imageprocessor/epub_image_processor.go +++ b/internal/epub/imageprocessor/epub_image_processor.go @@ -178,10 +178,6 @@ func (e *EPUBImageProcessor) transformImage(input *task, part int, right bool) * src := input.Image srcBounds := src.Bounds() - if part > 0 { - g.Add(epubimagefilters.CropSplitDoublePage(right)) - } - // Lookup for margin if crop is enable or if we want to remove blank image if e.Image.Crop.Enabled || e.Image.NoBlankImage { f := epubimagefilters.AutoCrop( @@ -205,6 +201,10 @@ func (e *EPUBImageProcessor) transformImage(input *task, part int, right bool) * } } + if part > 0 { + g.Add(epubimagefilters.CropSplitDoublePage(right)) + } + dstBounds := g.Bounds(src.Bounds()) // Original && Cropped version need to landscape oriented // Only part 0 can be a double page