diff --git a/internal/epub/filters/crop.go b/internal/epub/filters/crop.go index 59fa577..140dbc0 100644 --- a/internal/epub/filters/crop.go +++ b/internal/epub/filters/crop.go @@ -17,15 +17,15 @@ type cropSplitDoublePage struct { func (p *cropSplitDoublePage) Bounds(srcBounds image.Rectangle) (dstBounds image.Rectangle) { if p.right { - dstBounds = image.Rectangle{ - Min: image.Point{srcBounds.Max.X / 2, srcBounds.Min.Y}, - Max: srcBounds.Max, - } + dstBounds = image.Rect( + srcBounds.Max.X/2, srcBounds.Min.Y, + srcBounds.Max.X, srcBounds.Max.Y, + ) } else { - dstBounds = image.Rectangle{ - Min: srcBounds.Min, - Max: image.Point{srcBounds.Max.X / 2, srcBounds.Max.Y}, - } + dstBounds = image.Rect( + srcBounds.Min.X, srcBounds.Min.Y, + srcBounds.Max.X/2, srcBounds.Max.Y, + ) } return } diff --git a/internal/epub/image_processing.go b/internal/epub/image_processing.go index 9421703..4d9d338 100644 --- a/internal/epub/image_processing.go +++ b/internal/epub/image_processing.go @@ -145,10 +145,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.Rectangle{ - Min: image.Point{0, 0}, - Max: image.Point{1, 1}, - }, dst.Palette) + dst = image.NewPaletted(image.Rect(0, 0, 1, 1), dst.Palette) dst.Set(0, 0, color.White) } else { g.Draw(dst, src)