먼저 Go 내장된 "image"
image package - image - Go Packages
Documentation ¶ Package image implements a basic 2-D image library. The fundamental interface is called Image. An Image contains colors, which are described in the image/color package. Values of the Image interface are created either by calling functions
pkg.go.dev
처음에 내장된 image로 resize, crop 등의 thumbnail을 구현하려고 했는데
정말 잘 만들어 놓았지만 함수 명만 봐도 알 수 있듯이 이해 하기 힘들다.
이미지의 전문가가 아닌 이상..
그래서 여러가지를 찾아보았다.
첫 번째로 아마 검색하면 제일 많이 나오는.. nfnt
https://github.com/nfnt/resize
GitHub - nfnt/resize: Pure golang image resizing
Pure golang image resizing . Contribute to nfnt/resize development by creating an account on GitHub.
github.com
하지만..
This package is no longer being updated! Please look for alternatives if that bothers you.
더 이상 관리 안 한다. 그래서 pass
두번째로
GitHub - h2non/bimg: Go package for fast high-level image processing powered by libvips C library
Go package for fast high-level image processing powered by libvips C library - GitHub - h2non/bimg: Go package for fast high-level image processing powered by libvips C library
github.com
Go version 1.18 이상이면 사용하지 마시길 1.18 이하 버전은 모르겠지만
1.18에서 설치한 뒤 build 하면 package error 나면서 빌드가 되지 않는다.
그래서 pass
세번째로
https://github.com/disintegration/imaging
GitHub - disintegration/imaging: Imaging is a simple image processing package for Go
Imaging is a simple image processing package for Go - GitHub - disintegration/imaging: Imaging is a simple image processing package for Go
github.com
마지막 Release 가 좀 아쉽긴 한데
사용하는 사람들은 잘 사용하고 있고 사용법도 편하다.
Go에 내장된 "image"를 사용하여 이해할 수 있는 함수 명으로 쉽게 만들어 놓았다.
사용하려면 일단 이걸 사용하는 편이 좋을 것 같고..
그런데 찾아보면
Server에 괜찮은 이미지 프로세싱 데몬 하나 올려서 거기로 통신을 해서 resize, crop 등을 구현하는 것 같다.
1. https://github.com/imgproxy/imgproxy
GitHub - imgproxy/imgproxy: Fast and secure standalone server for resizing and converting remote images
Fast and secure standalone server for resizing and converting remote images - GitHub - imgproxy/imgproxy: Fast and secure standalone server for resizing and converting remote images
github.com
2. https://github.com/pierrre/imageserver
GitHub - pierrre/imageserver: Image server toolkit in Go
Image server toolkit in Go. Contribute to pierrre/imageserver development by creating an account on GitHub.
github.com
서버에 대한 제약이 없으면 이 방법이 제일 좋긴 한 것 같다. 마치 search engine처럼
'Language > Go' 카테고리의 다른 글
[Go] Convert byte slice to image (io.Reader) (0) | 2022.09.29 |
---|---|
[Go] Convert image.NRGBA to byte slice (0) | 2022.09.28 |
[Go] JWT token decode (0) | 2022.09.21 |
[Go] Contains method for a slice (go version 1.18) (0) | 2022.09.16 |
[Go] filetype (MIME type) (0) | 2022.09.16 |