feat(webp): add partial success to conversion

So we only keep images that couldn't be optimized and return the chapter
This commit is contained in:
Antoine Aflalo
2024-08-28 13:49:14 -04:00
parent d7f55fa886
commit ad35e2655f
6 changed files with 117 additions and 30 deletions

View File

@@ -10,8 +10,10 @@ type PageContainer struct {
Image image.Image
// Format is a string representing the format of the image (e.g., "png", "jpeg", "webp").
Format string
// IsToBeConverted is a boolean flag indicating whether the image needs to be converted to another format.
IsToBeConverted bool
}
func NewContainer(Page *Page, img image.Image, format string) *PageContainer {
return &PageContainer{Page: Page, Image: img, Format: format}
func NewContainer(Page *Page, img image.Image, format string, isToBeConverted bool) *PageContainer {
return &PageContainer{Page: Page, Image: img, Format: format, IsToBeConverted: isToBeConverted}
}