Skip to content

Commit

Permalink
Fix Errors in scale example
Browse files Browse the repository at this point in the history
  • Loading branch information
Cacsjep authored Jan 23, 2024
1 parent a9ae08f commit 08aa9f2
Showing 1 changed file with 10 additions and 12 deletions.
22 changes: 10 additions & 12 deletions examples/scaling/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,21 +56,19 @@ func main() {
defer swsCtx.Free()

err = swsCtx.Scale(srcFrame, dstFrame)

if err != nil {
log.Fatalf("Unable to scale: %w", err)
}
log.Fatalf("Unable to scale: %s", err.Error())
}

img, err := dstFrame.Data().Image()
img, err := dstFrame.Data().Image()
if err != nil {
log.Fatalf("Unable to get image: %s", err.Error())
}

if err != nil {
log.Fatalf("Unable to get image: %w", err)
}

err = png.Encode(dstFile, img)
if err != nil {
log.Fatalf("Unable to encode image to png: %w", err)
}
err = png.Encode(dstFile, img)
if err != nil {
log.Fatalf("Unable to encode image to png: %s", err.Error())
}

log.Printf("Successfully scale to %dx%d and write image to: %s", dstWidth, dstHeight, dstFilename)
}

0 comments on commit 08aa9f2

Please sign in to comment.