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.
This commit is contained in:
Celogeek 2024-05-07 08:55:42 +02:00
parent f7f8680eb3
commit f9ebe71b9e
Signed by: celogeek
SSH Key Fingerprint: SHA256:njNJLzoLQdbV9PC6ehcruRb0QnEgxABoCYZ+0+aUIYc

View File

@ -178,10 +178,6 @@ func (e *EPUBImageProcessor) transformImage(input *task, part int, right bool) *
src := input.Image src := input.Image
srcBounds := src.Bounds() 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 // Lookup for margin if crop is enable or if we want to remove blank image
if e.Image.Crop.Enabled || e.Image.NoBlankImage { if e.Image.Crop.Enabled || e.Image.NoBlankImage {
f := epubimagefilters.AutoCrop( 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()) dstBounds := g.Bounds(src.Bounds())
// Original && Cropped version need to landscape oriented // Original && Cropped version need to landscape oriented
// Only part 0 can be a double page // Only part 0 can be a double page