disintegration / imaging

Imaging is a simple image processing package for Go
MIT License
5.3k stars 443 forks source link

What's the difference between thumbnail and fill? #99

Closed danqing closed 5 years ago

danqing commented 5 years ago

Thanks for the great library!

I wonder what's the difference between fill and thumbnail? Both seem to resize and crop the image to fill a space; am I missing something here?

disintegration commented 5 years ago

The difference between these two functions is that Fill allows the caller to pass the anchor parameter while the Thumbnail always uses the Center anchor point.

Thumbnail was implemented first, Fill was added later. Thumbnail now uses Fill under the hood:

func Thumbnail(img image.Image, width, height int, filter ResampleFilter) *image.NRGBA {
    return Fill(img, width, height, Center, filter)
}
danqing commented 5 years ago

Thanks for the explanation!