mirror of
https://github.com/celogeek/go-comic-converter.git
synced 2025-05-25 08:12:36 +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
|
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
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -57,16 +57,16 @@ func (p *coverTitle) Draw(dst draw.Image, src image.Image, options *gift.Options
|
|||||||
dst,
|
dst,
|
||||||
borderArea,
|
borderArea,
|
||||||
image.Black,
|
image.Black,
|
||||||
image.Point{},
|
borderArea.Min,
|
||||||
draw.Over,
|
draw.Src,
|
||||||
)
|
)
|
||||||
|
|
||||||
draw.Draw(
|
draw.Draw(
|
||||||
dst,
|
dst,
|
||||||
textArea,
|
textArea,
|
||||||
image.White,
|
image.White,
|
||||||
image.Point{},
|
textArea.Min,
|
||||||
draw.Over,
|
draw.Src,
|
||||||
)
|
)
|
||||||
|
|
||||||
// Draw text
|
// Draw text
|
||||||
|
@ -116,11 +116,11 @@ func LoadImages(o *Options) ([]*epubimage.Image, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// create a title page with the cover
|
// 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
|
// Create a blur version of the cover
|
||||||
g := gift.New(epubimagefilters.CoverTitle(title))
|
g := gift.New(epubimagefilters.CoverTitle(title))
|
||||||
dst := image.NewGray(g.Bounds(img.Raw.Bounds()))
|
dst := image.NewGray(g.Bounds(img.Bounds()))
|
||||||
g.Draw(dst, img.Raw)
|
g.Draw(dst, img)
|
||||||
|
|
||||||
return epubimagedata.NewRaw("OEBPS/Images/title.jpg", dst, quality)
|
return epubimagedata.NewRaw("OEBPS/Images/title.jpg", dst, quality)
|
||||||
}
|
}
|
||||||
|
@ -51,6 +51,7 @@ func (o *Options) WorkersRatio(pct int) (nbWorkers int) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Load images from input
|
||||||
func (o *Options) Load() (totalImages int, output chan *tasks, err error) {
|
func (o *Options) Load() (totalImages int, output chan *tasks, err error) {
|
||||||
fi, err := os.Stat(o.Input)
|
fi, err := os.Stat(o.Input)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user