mirror of
https://github.com/celogeek/go-comic-converter.git
synced 2025-05-25 16:22:37 +02:00
Compare commits
3 Commits
56917987ae
...
cd73416a5c
Author | SHA1 | Date | |
---|---|---|---|
cd73416a5c | |||
21cbde14bc | |||
7ea9b9f86e |
10
README.md
10
README.md
@ -16,6 +16,7 @@ EPUB is now support by Amazon through [SendToKindle](https://www.amazon.com/gp/s
|
|||||||
- Auto contrast
|
- Auto contrast
|
||||||
- Auto rotate (if reader mainly read on portrait)
|
- Auto rotate (if reader mainly read on portrait)
|
||||||
- Auto split double page (for easy read on portrait)
|
- Auto split double page (for easy read on portrait)
|
||||||
|
- Keep double page if splitted
|
||||||
- Remove blank image (empty image is removed)
|
- Remove blank image (empty image is removed)
|
||||||
- Manga or Normal mode
|
- Manga or Normal mode
|
||||||
- Support cover page or not (first page will be taken in that case)
|
- Support cover page or not (first page will be taken in that case)
|
||||||
@ -149,6 +150,7 @@ Options:
|
|||||||
AutoContrast : true
|
AutoContrast : true
|
||||||
AutoRotate : false
|
AutoRotate : false
|
||||||
AutoSplitDoublePage : false
|
AutoSplitDoublePage : false
|
||||||
|
KeepDoublePageIfSplitted : true
|
||||||
NoBlankImage : true
|
NoBlankImage : true
|
||||||
Manga : true
|
Manga : true
|
||||||
HasCover : true
|
HasCover : true
|
||||||
@ -195,6 +197,7 @@ Options:
|
|||||||
AutoContrast : true
|
AutoContrast : true
|
||||||
AutoRotate : false
|
AutoRotate : false
|
||||||
AutoSplitDoublePage : false
|
AutoSplitDoublePage : false
|
||||||
|
KeepDoublePageIfSplitted : true
|
||||||
NoBlankImage : true
|
NoBlankImage : true
|
||||||
Manga : true
|
Manga : true
|
||||||
HasCover : true
|
HasCover : true
|
||||||
@ -251,6 +254,7 @@ Options:
|
|||||||
AutoContrast : false
|
AutoContrast : false
|
||||||
AutoRotate : false
|
AutoRotate : false
|
||||||
AutoSplitDoublePage : false
|
AutoSplitDoublePage : false
|
||||||
|
KeepDoublePageIfSplitted : true
|
||||||
NoBlankImage : true
|
NoBlankImage : true
|
||||||
Manga : false
|
Manga : false
|
||||||
HasCover : true
|
HasCover : true
|
||||||
@ -281,6 +285,7 @@ Options:
|
|||||||
AutoContrast : true
|
AutoContrast : true
|
||||||
AutoRotate : true
|
AutoRotate : true
|
||||||
AutoSplitDoublePage : true
|
AutoSplitDoublePage : true
|
||||||
|
KeepDoublePageIfSplitted : true
|
||||||
NoBlankImage : true
|
NoBlankImage : true
|
||||||
Manga : true
|
Manga : true
|
||||||
HasCover : true
|
HasCover : true
|
||||||
@ -312,6 +317,7 @@ Options:
|
|||||||
AutoContrast : true
|
AutoContrast : true
|
||||||
AutoRotate : true
|
AutoRotate : true
|
||||||
AutoSplitDoublePage : true
|
AutoSplitDoublePage : true
|
||||||
|
KeepDoublePageIfSplitted : true
|
||||||
NoBlankImage : true
|
NoBlankImage : true
|
||||||
Manga : false
|
Manga : false
|
||||||
HasCover : true
|
HasCover : true
|
||||||
@ -346,6 +352,7 @@ Options:
|
|||||||
AutoContrast : false
|
AutoContrast : false
|
||||||
AutoRotate : false
|
AutoRotate : false
|
||||||
AutoSplitDoublePage : false
|
AutoSplitDoublePage : false
|
||||||
|
KeepDoublePageIfSplitted : true
|
||||||
NoBlankImage : true
|
NoBlankImage : true
|
||||||
Manga : false
|
Manga : false
|
||||||
HasCover : true
|
HasCover : true
|
||||||
@ -380,6 +387,7 @@ Options:
|
|||||||
AutoContrast : true
|
AutoContrast : true
|
||||||
AutoRotate : false
|
AutoRotate : false
|
||||||
AutoSplitDoublePage : false
|
AutoSplitDoublePage : false
|
||||||
|
KeepDoublePageIfSplitted : true
|
||||||
NoBlankImage : true
|
NoBlankImage : true
|
||||||
Manga : true
|
Manga : true
|
||||||
HasCover : true
|
HasCover : true
|
||||||
@ -480,6 +488,8 @@ Config:
|
|||||||
Auto Rotate page when width > height
|
Auto Rotate page when width > height
|
||||||
-autosplitdoublepage
|
-autosplitdoublepage
|
||||||
Auto Split double page when width > height
|
Auto Split double page when width > height
|
||||||
|
-keepdoublepageifsplitted (default true)
|
||||||
|
Keep the double page if splitted
|
||||||
-noblankimage (default true)
|
-noblankimage (default true)
|
||||||
Remove blank image
|
Remove blank image
|
||||||
-manga
|
-manga
|
||||||
|
8
go.mod
8
go.mod
@ -12,7 +12,7 @@ require (
|
|||||||
github.com/raff/pdfreader v0.0.0-20220308062436-033e8ac577f0
|
github.com/raff/pdfreader v0.0.0-20220308062436-033e8ac577f0
|
||||||
github.com/schollz/progressbar/v3 v3.13.1
|
github.com/schollz/progressbar/v3 v3.13.1
|
||||||
github.com/tcnksm/go-latest v0.0.0-20170313132115-e3007ae9052e
|
github.com/tcnksm/go-latest v0.0.0-20170313132115-e3007ae9052e
|
||||||
golang.org/x/image v0.11.0
|
golang.org/x/image v0.12.0
|
||||||
gopkg.in/yaml.v3 v3.0.1
|
gopkg.in/yaml.v3 v3.0.1
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -24,7 +24,7 @@ require (
|
|||||||
github.com/mitchellh/colorstring v0.0.0-20190213212951-d06e56a500db // indirect
|
github.com/mitchellh/colorstring v0.0.0-20190213212951-d06e56a500db // indirect
|
||||||
github.com/rivo/uniseg v0.4.4 // indirect
|
github.com/rivo/uniseg v0.4.4 // indirect
|
||||||
github.com/stretchr/testify v1.8.4 // indirect
|
github.com/stretchr/testify v1.8.4 // indirect
|
||||||
golang.org/x/net v0.14.0 // indirect
|
golang.org/x/net v0.15.0 // indirect
|
||||||
golang.org/x/sys v0.11.0 // indirect
|
golang.org/x/sys v0.12.0 // indirect
|
||||||
golang.org/x/term v0.11.0 // indirect
|
golang.org/x/term v0.12.0 // indirect
|
||||||
)
|
)
|
||||||
|
18
go.sum
18
go.sum
@ -46,16 +46,16 @@ github.com/tcnksm/go-latest v0.0.0-20170313132115-e3007ae9052e/go.mod h1:d7u6HkT
|
|||||||
github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY=
|
github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY=
|
||||||
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
|
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
|
||||||
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
|
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
|
||||||
golang.org/x/image v0.11.0 h1:ds2RoQvBvYTiJkwpSFDwCcDFNX7DqjL2WsUgTNk0Ooo=
|
golang.org/x/image v0.12.0 h1:w13vZbU4o5rKOFFR8y7M+c4A5jXDC0uXTdHYRP8X2DQ=
|
||||||
golang.org/x/image v0.11.0/go.mod h1:bglhjqbqVuEb9e9+eNR45Jfu7D+T4Qan+NhQk8Ck2P8=
|
golang.org/x/image v0.12.0/go.mod h1:Lu90jvHG7GfemOIcldsh9A2hS01ocl6oNO7ype5mEnk=
|
||||||
golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4=
|
golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4=
|
||||||
golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs=
|
golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs=
|
||||||
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
||||||
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
|
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
|
||||||
golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c=
|
golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c=
|
||||||
golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs=
|
golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs=
|
||||||
golang.org/x/net v0.14.0 h1:BONx9s002vGdD9umnlX1Po8vOZmrgH34qlHcD1MfK14=
|
golang.org/x/net v0.15.0 h1:ugBLEUaxABaB5AJqW9enI0ACdci2RUd4eP51NTBvuJ8=
|
||||||
golang.org/x/net v0.14.0/go.mod h1:PpSgVXXLK0OxS0F31C1/tv6XNguvCrnXIDrFMspZIUI=
|
golang.org/x/net v0.15.0/go.mod h1:idbUs1IY1+zTqbi8yxTbhexhEEk5ur9LInksu6HrEpk=
|
||||||
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||||
golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||||
golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||||
@ -67,19 +67,19 @@ golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBc
|
|||||||
golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||||
golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||||
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||||
golang.org/x/sys v0.11.0 h1:eG7RXZHdqOJ1i+0lgLgCpSXAp6M3LYlAo6osgSi0xOM=
|
golang.org/x/sys v0.12.0 h1:CM0HF96J0hcLAwsHPJZjfdNzs0gftsLfgKt57wWHJ0o=
|
||||||
golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||||
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
|
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
|
||||||
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
|
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
|
||||||
golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k=
|
golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k=
|
||||||
golang.org/x/term v0.6.0/go.mod h1:m6U89DPEgQRMq3DNkDClhWw02AUbt2daBVO4cn4Hv9U=
|
golang.org/x/term v0.6.0/go.mod h1:m6U89DPEgQRMq3DNkDClhWw02AUbt2daBVO4cn4Hv9U=
|
||||||
golang.org/x/term v0.11.0 h1:F9tnn/DA/Im8nCwm+fX+1/eBwi4qFjRT++MhtVC4ZX0=
|
golang.org/x/term v0.12.0 h1:/ZfYdc3zq+q02Rv9vGqTeSItdzZTSNDmfTi0mBAuidU=
|
||||||
golang.org/x/term v0.11.0/go.mod h1:zC9APTIj3jG3FdV/Ons+XE1riIZXG4aZ4GTHiPZJPIU=
|
golang.org/x/term v0.12.0/go.mod h1:owVbMEjm3cBLCHdkQu9b1opXd4ETQWc3BhuQGKgXgvU=
|
||||||
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||||
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
|
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
|
||||||
golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
|
golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
|
||||||
golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
|
golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
|
||||||
golang.org/x/text v0.12.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE=
|
golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE=
|
||||||
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
|
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
|
||||||
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
|
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
|
||||||
golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc=
|
golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc=
|
||||||
|
@ -119,6 +119,7 @@ func (c *Converter) InitParse() {
|
|||||||
c.AddBoolParam(&c.Options.AutoContrast, "autocontrast", c.Options.AutoContrast, "Improve contrast automatically")
|
c.AddBoolParam(&c.Options.AutoContrast, "autocontrast", c.Options.AutoContrast, "Improve contrast automatically")
|
||||||
c.AddBoolParam(&c.Options.AutoRotate, "autorotate", c.Options.AutoRotate, "Auto Rotate page when width > height")
|
c.AddBoolParam(&c.Options.AutoRotate, "autorotate", c.Options.AutoRotate, "Auto Rotate page when width > height")
|
||||||
c.AddBoolParam(&c.Options.AutoSplitDoublePage, "autosplitdoublepage", c.Options.AutoSplitDoublePage, "Auto Split double page when width > height")
|
c.AddBoolParam(&c.Options.AutoSplitDoublePage, "autosplitdoublepage", c.Options.AutoSplitDoublePage, "Auto Split double page when width > height")
|
||||||
|
c.AddBoolParam(&c.Options.KeepDoublePageIfSplitted, "keepdoublepageifsplitted", c.Options.KeepDoublePageIfSplitted, "Keep the double page if splitted")
|
||||||
c.AddBoolParam(&c.Options.NoBlankImage, "noblankimage", c.Options.NoBlankImage, "Remove blank image")
|
c.AddBoolParam(&c.Options.NoBlankImage, "noblankimage", c.Options.NoBlankImage, "Remove blank image")
|
||||||
c.AddBoolParam(&c.Options.Manga, "manga", c.Options.Manga, "Manga mode (right to left)")
|
c.AddBoolParam(&c.Options.Manga, "manga", c.Options.Manga, "Manga mode (right to left)")
|
||||||
c.AddBoolParam(&c.Options.HasCover, "hascover", c.Options.HasCover, "Has cover. Indicate if your comic have a cover. The first page will be used as a cover and include after the title.")
|
c.AddBoolParam(&c.Options.HasCover, "hascover", c.Options.HasCover, "Has cover. Indicate if your comic have a cover. The first page will be used as a cover and include after the title.")
|
||||||
|
@ -35,6 +35,7 @@ type Options struct {
|
|||||||
AutoContrast bool `yaml:"auto_contrast"`
|
AutoContrast bool `yaml:"auto_contrast"`
|
||||||
AutoRotate bool `yaml:"auto_rotate"`
|
AutoRotate bool `yaml:"auto_rotate"`
|
||||||
AutoSplitDoublePage bool `yaml:"auto_split_double_page"`
|
AutoSplitDoublePage bool `yaml:"auto_split_double_page"`
|
||||||
|
KeepDoublePageIfSplitted bool `yaml:"keep_double_page_if_splitted"`
|
||||||
NoBlankImage bool `yaml:"no_blank_image"`
|
NoBlankImage bool `yaml:"no_blank_image"`
|
||||||
Manga bool `yaml:"manga"`
|
Manga bool `yaml:"manga"`
|
||||||
HasCover bool `yaml:"has_cover"`
|
HasCover bool `yaml:"has_cover"`
|
||||||
@ -77,22 +78,23 @@ type Options struct {
|
|||||||
// Initialize default options.
|
// Initialize default options.
|
||||||
func New() *Options {
|
func New() *Options {
|
||||||
return &Options{
|
return &Options{
|
||||||
Profile: "SR",
|
Profile: "SR",
|
||||||
Quality: 85,
|
Quality: 85,
|
||||||
Grayscale: true,
|
Grayscale: true,
|
||||||
Crop: true,
|
Crop: true,
|
||||||
CropRatioLeft: 1,
|
CropRatioLeft: 1,
|
||||||
CropRatioUp: 1,
|
CropRatioUp: 1,
|
||||||
CropRatioRight: 1,
|
CropRatioRight: 1,
|
||||||
CropRatioBottom: 3,
|
CropRatioBottom: 3,
|
||||||
NoBlankImage: true,
|
NoBlankImage: true,
|
||||||
HasCover: true,
|
HasCover: true,
|
||||||
SortPathMode: 1,
|
KeepDoublePageIfSplitted: true,
|
||||||
ForegroundColor: "000",
|
SortPathMode: 1,
|
||||||
BackgroundColor: "FFF",
|
ForegroundColor: "000",
|
||||||
Format: "jpeg",
|
BackgroundColor: "FFF",
|
||||||
TitlePage: 1,
|
Format: "jpeg",
|
||||||
profiles: profiles.New(),
|
TitlePage: 1,
|
||||||
|
profiles: profiles.New(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -208,6 +210,7 @@ func (o *Options) ShowConfig() string {
|
|||||||
{"AutoContrast", o.AutoContrast, true},
|
{"AutoContrast", o.AutoContrast, true},
|
||||||
{"AutoRotate", o.AutoRotate, true},
|
{"AutoRotate", o.AutoRotate, true},
|
||||||
{"AutoSplitDoublePage", o.AutoSplitDoublePage, true},
|
{"AutoSplitDoublePage", o.AutoSplitDoublePage, true},
|
||||||
|
{"KeepDoublePageIfSplitted", o.KeepDoublePageIfSplitted, o.AutoSplitDoublePage},
|
||||||
{"NoBlankImage", o.NoBlankImage, true},
|
{"NoBlankImage", o.NoBlankImage, true},
|
||||||
{"Manga", o.Manga, true},
|
{"Manga", o.Manga, true},
|
||||||
{"HasCover", o.HasCover, true},
|
{"HasCover", o.HasCover, true},
|
||||||
|
@ -442,7 +442,10 @@ func (e *ePub) Write() error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Double Page or Last Image that is not a double page
|
// Double Page or Last Image that is not a double page
|
||||||
if !e.Image.View.PortraitOnly && (img.DoublePage || (img.Part == 0 && img == lastImage)) {
|
if !e.Image.View.PortraitOnly &&
|
||||||
|
(img.DoublePage ||
|
||||||
|
(!e.Image.KeepDoublePageIfSplitted && img.Part == 1) ||
|
||||||
|
(img.Part == 0 && img == lastImage)) {
|
||||||
if err := e.writeBlank(wz, img); err != nil {
|
if err := e.writeBlank(wz, img); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
@ -101,6 +101,14 @@ func (e *EPUBImageProcessor) Load() (images []*epubimage.Image, err error) {
|
|||||||
Error: input.Error,
|
Error: input.Error,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// do not keep double page if requested
|
||||||
|
if !img.IsCover &&
|
||||||
|
img.DoublePage &&
|
||||||
|
e.Options.Image.AutoSplitDoublePage &&
|
||||||
|
!e.Options.Image.KeepDoublePageIfSplitted {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
if err = imgStorage.Add(img.EPUBImgPath(), dst, e.Image.Quality); err != nil {
|
if err = imgStorage.Add(img.EPUBImgPath(), dst, e.Image.Quality); err != nil {
|
||||||
bar.Close()
|
bar.Close()
|
||||||
fmt.Fprintf(os.Stderr, "error with %s: %s", input.Name, err)
|
fmt.Fprintf(os.Stderr, "error with %s: %s", input.Name, err)
|
||||||
|
@ -22,21 +22,22 @@ type View struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type Image struct {
|
type Image struct {
|
||||||
Crop *Crop
|
Crop *Crop
|
||||||
Quality int
|
Quality int
|
||||||
Brightness int
|
Brightness int
|
||||||
Contrast int
|
Contrast int
|
||||||
AutoContrast bool
|
AutoContrast bool
|
||||||
AutoRotate bool
|
AutoRotate bool
|
||||||
AutoSplitDoublePage bool
|
AutoSplitDoublePage bool
|
||||||
NoBlankImage bool
|
KeepDoublePageIfSplitted bool
|
||||||
Manga bool
|
NoBlankImage bool
|
||||||
HasCover bool
|
Manga bool
|
||||||
View *View
|
HasCover bool
|
||||||
GrayScale bool
|
View *View
|
||||||
GrayScaleMode int
|
GrayScale bool
|
||||||
Resize bool
|
GrayScaleMode int
|
||||||
Format string
|
Resize bool
|
||||||
|
Format string
|
||||||
}
|
}
|
||||||
|
|
||||||
type Options struct {
|
type Options struct {
|
||||||
|
@ -174,7 +174,12 @@ func getManifest(o *ContentOptions) []tag {
|
|||||||
|
|
||||||
lastImage := o.Images[len(o.Images)-1]
|
lastImage := o.Images[len(o.Images)-1]
|
||||||
for _, img := range o.Images {
|
for _, img := range o.Images {
|
||||||
addTag(img, !o.ImageOptions.View.PortraitOnly && (img.DoublePage || (img.Part == 0 && img == lastImage)))
|
addTag(
|
||||||
|
img,
|
||||||
|
!o.ImageOptions.View.PortraitOnly &&
|
||||||
|
(img.DoublePage ||
|
||||||
|
(!o.ImageOptions.KeepDoublePageIfSplitted && img.Part == 1) ||
|
||||||
|
(img.Part == 0 && img == lastImage)))
|
||||||
}
|
}
|
||||||
|
|
||||||
items = append(items, imageTags...)
|
items = append(items, imageTags...)
|
||||||
@ -212,7 +217,7 @@ func getSpineAuto(o *ContentOptions) []tag {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
for _, img := range o.Images {
|
for _, img := range o.Images {
|
||||||
if img.DoublePage && o.ImageOptions.Manga == isOnTheRight {
|
if (img.DoublePage || img.Part == 1) && o.ImageOptions.Manga == isOnTheRight {
|
||||||
spine = append(spine, tag{
|
spine = append(spine, tag{
|
||||||
"itemref",
|
"itemref",
|
||||||
tagAttrs{"idref": img.SpaceKey(), "properties": getSpreadBlank()},
|
tagAttrs{"idref": img.SpaceKey(), "properties": getSpreadBlank()},
|
||||||
|
31
main.go
31
main.go
@ -114,21 +114,22 @@ $ go install github.com/celogeek/go-comic-converter/v%d@%s
|
|||||||
DryVerbose: cmd.Options.DryVerbose,
|
DryVerbose: cmd.Options.DryVerbose,
|
||||||
Quiet: cmd.Options.Quiet,
|
Quiet: cmd.Options.Quiet,
|
||||||
Image: &epuboptions.Image{
|
Image: &epuboptions.Image{
|
||||||
Crop: &epuboptions.Crop{Enabled: cmd.Options.Crop, Left: cmd.Options.CropRatioLeft, Up: cmd.Options.CropRatioUp, Right: cmd.Options.CropRatioRight, Bottom: cmd.Options.CropRatioBottom},
|
Crop: &epuboptions.Crop{Enabled: cmd.Options.Crop, Left: cmd.Options.CropRatioLeft, Up: cmd.Options.CropRatioUp, Right: cmd.Options.CropRatioRight, Bottom: cmd.Options.CropRatioBottom},
|
||||||
Quality: cmd.Options.Quality,
|
Quality: cmd.Options.Quality,
|
||||||
Brightness: cmd.Options.Brightness,
|
Brightness: cmd.Options.Brightness,
|
||||||
Contrast: cmd.Options.Contrast,
|
Contrast: cmd.Options.Contrast,
|
||||||
AutoContrast: cmd.Options.AutoContrast,
|
AutoContrast: cmd.Options.AutoContrast,
|
||||||
AutoRotate: cmd.Options.AutoRotate,
|
AutoRotate: cmd.Options.AutoRotate,
|
||||||
AutoSplitDoublePage: cmd.Options.AutoSplitDoublePage,
|
AutoSplitDoublePage: cmd.Options.AutoSplitDoublePage,
|
||||||
NoBlankImage: cmd.Options.NoBlankImage,
|
KeepDoublePageIfSplitted: cmd.Options.KeepDoublePageIfSplitted,
|
||||||
Manga: cmd.Options.Manga,
|
NoBlankImage: cmd.Options.NoBlankImage,
|
||||||
HasCover: cmd.Options.HasCover,
|
Manga: cmd.Options.Manga,
|
||||||
View: &epuboptions.View{Width: profile.Width, Height: profile.Height, AspectRatio: cmd.Options.AspectRatio, PortraitOnly: cmd.Options.PortraitOnly, Color: epuboptions.Color{Foreground: cmd.Options.ForegroundColor, Background: cmd.Options.BackgroundColor}},
|
HasCover: cmd.Options.HasCover,
|
||||||
GrayScale: cmd.Options.Grayscale,
|
View: &epuboptions.View{Width: profile.Width, Height: profile.Height, AspectRatio: cmd.Options.AspectRatio, PortraitOnly: cmd.Options.PortraitOnly, Color: epuboptions.Color{Foreground: cmd.Options.ForegroundColor, Background: cmd.Options.BackgroundColor}},
|
||||||
GrayScaleMode: cmd.Options.GrayscaleMode,
|
GrayScale: cmd.Options.Grayscale,
|
||||||
Resize: !cmd.Options.NoResize,
|
GrayScaleMode: cmd.Options.GrayscaleMode,
|
||||||
Format: cmd.Options.Format,
|
Resize: !cmd.Options.NoResize,
|
||||||
|
Format: cmd.Options.Format,
|
||||||
},
|
},
|
||||||
}).Write(); err != nil {
|
}).Write(); err != nil {
|
||||||
fmt.Fprintf(os.Stderr, "Error: %v\n", err)
|
fmt.Fprintf(os.Stderr, "Error: %v\n", err)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user