Skip to content

Instantly share code, notes, and snippets.

@NickSablukov
Created August 1, 2022 05:31
Show Gist options
  • Save NickSablukov/be1f09a7cbf2ea553df58bff07527f22 to your computer and use it in GitHub Desktop.
Save NickSablukov/be1f09a7cbf2ea553df58bff07527f22 to your computer and use it in GitHub Desktop.
func (b *MosaicBuilder) loadImage(path string) (image.Image, error) {
infile, err := os.Open(path)
defer func(infile *os.File) {
_ = infile.Close()
}(infile)
if err != nil {
return nil, err
}
src, err := tga.Decode(infile)
if err != nil {
return nil, err
}
return resize.Resize(b.partSize, b.partSize, src, resize.Lanczos3), nil
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment