Skip to content

Commit

Permalink
Prevent stdout spam when exporting DZI files
Browse files Browse the repository at this point in the history
  • Loading branch information
Dadido3 committed Dec 23, 2023
1 parent 88507af commit a964313
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
2 changes: 1 addition & 1 deletion bin/stitch/dzi.go
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ func (d DZI) ExportDZITiles(outputDir string) error {
rect = rect.Inset(-d.overlap)
img := stitchedImage.SubStitchedImage(rect)
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)
}

Expand Down
5 changes: 5 additions & 0 deletions bin/stitch/export-jpeg.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@ import (

func exportJPEG(stitchedImage image.Image, outputPath string) error {
log.Printf("Creating output file %q.", outputPath)

return exportJPEGSilent(stitchedImage, outputPath)
}

func exportJPEGSilent(stitchedImage image.Image, outputPath string) error {
f, err := os.Create(outputPath)
if err != nil {
return fmt.Errorf("failed to create file: %w", err)
Expand Down
5 changes: 5 additions & 0 deletions bin/stitch/export-png.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@ import (

func exportPNG(stitchedImage image.Image, outputPath string) error {
log.Printf("Creating output file %q.", outputPath)

return exportPNGSilent(stitchedImage, outputPath)
}

func exportPNGSilent(stitchedImage image.Image, outputPath string) error {
f, err := os.Create(outputPath)
if err != nil {
return fmt.Errorf("failed to create file: %w", err)
Expand Down

0 comments on commit a964313

Please sign in to comment.