Prevent stdout spam when exporting DZI files

This commit is contained in:
David Vogel 2023-12-23 01:23:53 +01:00
parent 88507af167
commit a96431361f
3 changed files with 11 additions and 1 deletions

View File

@ -123,7 +123,7 @@ func (d DZI) ExportDZITiles(outputDir string) error {
rect = rect.Inset(-d.overlap) rect = rect.Inset(-d.overlap)
img := stitchedImage.SubStitchedImage(rect) img := stitchedImage.SubStitchedImage(rect)
filePath := filepath.Join(levelBasePath, fmt.Sprintf("%d_%d%s", iX, iY, d.fileExtension)) filePath := filepath.Join(levelBasePath, fmt.Sprintf("%d_%d%s", iX, iY, d.fileExtension))
if err := exportPNG(img, filePath); err != nil { if err := exportPNGSilent(img, filePath); err != nil {
return fmt.Errorf("failed to export PNG: %w", err) return fmt.Errorf("failed to export PNG: %w", err)
} }

View File

@ -15,6 +15,11 @@ import (
func exportJPEG(stitchedImage image.Image, outputPath string) error { func exportJPEG(stitchedImage image.Image, outputPath string) error {
log.Printf("Creating output file %q.", outputPath) log.Printf("Creating output file %q.", outputPath)
return exportJPEGSilent(stitchedImage, outputPath)
}
func exportJPEGSilent(stitchedImage image.Image, outputPath string) error {
f, err := os.Create(outputPath) f, err := os.Create(outputPath)
if err != nil { if err != nil {
return fmt.Errorf("failed to create file: %w", err) return fmt.Errorf("failed to create file: %w", err)

View File

@ -15,6 +15,11 @@ import (
func exportPNG(stitchedImage image.Image, outputPath string) error { func exportPNG(stitchedImage image.Image, outputPath string) error {
log.Printf("Creating output file %q.", outputPath) log.Printf("Creating output file %q.", outputPath)
return exportPNGSilent(stitchedImage, outputPath)
}
func exportPNGSilent(stitchedImage image.Image, outputPath string) error {
f, err := os.Create(outputPath) f, err := os.Create(outputPath)
if err != nil { if err != nil {
return fmt.Errorf("failed to create file: %w", err) return fmt.Errorf("failed to create file: %w", err)