mirror of
https://github.com/celogeek/go-comic-converter.git
synced 2025-05-24 15:52:38 +02:00
improve cover title
This commit is contained in:
parent
6295fefa02
commit
66d6c22e55
@ -296,7 +296,7 @@ func (e *ePub) Write() error {
|
||||
return err
|
||||
}
|
||||
}
|
||||
if err := wz.WriteImage(epubimageprocessing.LoadCoverTitleData(part.Cover, title, e.Image.Quality)); err != nil {
|
||||
if err := wz.WriteImage(epubimageprocessing.CoverTitleData(part.Cover.Raw, title, e.Image.Quality)); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
|
@ -57,16 +57,16 @@ func (p *coverTitle) Draw(dst draw.Image, src image.Image, options *gift.Options
|
||||
dst,
|
||||
borderArea,
|
||||
image.Black,
|
||||
image.Point{},
|
||||
draw.Over,
|
||||
borderArea.Min,
|
||||
draw.Src,
|
||||
)
|
||||
|
||||
draw.Draw(
|
||||
dst,
|
||||
textArea,
|
||||
image.White,
|
||||
image.Point{},
|
||||
draw.Over,
|
||||
textArea.Min,
|
||||
draw.Src,
|
||||
)
|
||||
|
||||
// Draw text
|
||||
|
@ -116,11 +116,11 @@ func LoadImages(o *Options) ([]*epubimage.Image, error) {
|
||||
}
|
||||
|
||||
// create a title page with the cover
|
||||
func LoadCoverTitleData(img *epubimage.Image, title string, quality int) *epubimagedata.ImageData {
|
||||
func CoverTitleData(img image.Image, title string, quality int) *epubimagedata.ImageData {
|
||||
// Create a blur version of the cover
|
||||
g := gift.New(epubimagefilters.CoverTitle(title))
|
||||
dst := image.NewGray(g.Bounds(img.Raw.Bounds()))
|
||||
g.Draw(dst, img.Raw)
|
||||
dst := image.NewGray(g.Bounds(img.Bounds()))
|
||||
g.Draw(dst, img)
|
||||
|
||||
return epubimagedata.NewRaw("OEBPS/Images/title.jpg", dst, quality)
|
||||
}
|
||||
|
@ -51,6 +51,7 @@ func (o *Options) WorkersRatio(pct int) (nbWorkers int) {
|
||||
return
|
||||
}
|
||||
|
||||
// Load images from input
|
||||
func (o *Options) Load() (totalImages int, output chan *tasks, err error) {
|
||||
fi, err := os.Stat(o.Input)
|
||||
if err != nil {
|
||||
|
Loading…
x
Reference in New Issue
Block a user