From 62fc520ebb2463391b39121acd873f8a303ef3c4 Mon Sep 17 00:00:00 2001 From: celogeek <65178+celogeek@users.noreply.github.com> Date: Thu, 9 May 2024 12:28:48 +0200 Subject: [PATCH] cut more each side of doublepage split in portrait only --- internal/epub/imageprocessor/epub_image_processor.go | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/internal/epub/imageprocessor/epub_image_processor.go b/internal/epub/imageprocessor/epub_image_processor.go index 4dd811c..46ae5cf 100644 --- a/internal/epub/imageprocessor/epub_image_processor.go +++ b/internal/epub/imageprocessor/epub_image_processor.go @@ -178,6 +178,12 @@ func (e *EPUBImageProcessor) transformImage(input *task, part int, right bool) * src := input.Image srcBounds := src.Bounds() + // In portrait only, we don't need to keep aspect ratio between each split. + // We first cut, the crop. + if part > 0 && e.Image.View.PortraitOnly { + 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( @@ -201,7 +207,9 @@ func (e *EPUBImageProcessor) transformImage(input *task, part int, right bool) * } } - if part > 0 { + // With landscape support, we need to keep aspect ratio between each split + // We first crop, then cut + if part > 0 && !e.Image.View.PortraitOnly { g.Add(epubimagefilters.CropSplitDoublePage(right)) }