Compare commits
7 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| bd09f93af1 | |||
| f76b46a0d1 | |||
| 6b2240f56e | |||
| 9a1d999cbd | |||
| db7e21a63c | |||
| 5603cdd393 | |||
| f0fe3685c2 |
4
.hgtags
4
.hgtags
@@ -1 +1,5 @@
|
|||||||
efd7b407177086c57e8c086605c2c8d1cee23840 release-1.0
|
efd7b407177086c57e8c086605c2c8d1cee23840 release-1.0
|
||||||
|
292439a79182796c2f6277ef13ca179379b0fb88 v0.2.0
|
||||||
|
efd7b407177086c57e8c086605c2c8d1cee23840 v0.1.0
|
||||||
|
efd7b407177086c57e8c086605c2c8d1cee23840 release-1.0
|
||||||
|
0000000000000000000000000000000000000000 release-1.0
|
||||||
|
|||||||
@@ -14,10 +14,14 @@ A standalone binary `mkthumb` is provided as a sample utility.
|
|||||||
|
|
||||||
=CHANGELOG=
|
=CHANGELOG=
|
||||||
|
|
||||||
|
2018-05-04 0.2.1
|
||||||
|
- Add `disableimagecrush` build tag option to exclude cgo library dependency
|
||||||
|
|
||||||
2017-11-18 0.2.0
|
2017-11-18 0.2.0
|
||||||
- Initial standalone release
|
- Initial standalone release
|
||||||
- Feature: Decode input with specified mime type
|
- Feature: Decode input with specified mime type
|
||||||
- Feature: Allow passing zero as thumbnail cache size
|
- Feature: Allow passing zero as thumbnail cache size
|
||||||
|
|
||||||
2017-01-03 webdir-1.0
|
2017-01-03 0.1.0
|
||||||
- Version of `thumbnail` vendored with `webdir` 1.0
|
- Version of `thumbnail` vendored with `webdir` 1.0 (previously tagged as `release-1.0`)
|
||||||
|
|
||||||
|
|||||||
4
image.go
4
image.go
@@ -4,8 +4,6 @@ import (
|
|||||||
"bytes"
|
"bytes"
|
||||||
"image"
|
"image"
|
||||||
"image/jpeg"
|
"image/jpeg"
|
||||||
|
|
||||||
"code.ivysaur.me/imagequant"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func (this *Thumbnailer) RenderScaledImage(src image.Image) ([]byte, error) {
|
func (this *Thumbnailer) RenderScaledImage(src image.Image) ([]byte, error) {
|
||||||
@@ -60,7 +58,7 @@ func (this *Thumbnailer) RenderScaledImage(src image.Image) ([]byte, error) {
|
|||||||
|
|
||||||
switch this.ofmt {
|
switch this.ofmt {
|
||||||
case OUTPUT_PNG_CRUSH:
|
case OUTPUT_PNG_CRUSH:
|
||||||
return crush(dest, imagequant.SPEED_FASTEST)
|
return crushFast(dest)
|
||||||
|
|
||||||
case OUTPUT_JPG:
|
case OUTPUT_JPG:
|
||||||
buff := bytes.Buffer{}
|
buff := bytes.Buffer{}
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
//+build !disableimagecrush
|
||||||
|
|
||||||
package thumbnail
|
package thumbnail
|
||||||
|
|
||||||
import (
|
import (
|
||||||
@@ -51,6 +53,10 @@ func rgb8PaletteToGoImage(w, h int, rgb8data []byte, pal color.Palette) image.Im
|
|||||||
return ret
|
return ret
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func crushFast(img image.Image) ([]byte, error) {
|
||||||
|
return crush(img, imagequant.SPEED_FASTEST)
|
||||||
|
}
|
||||||
|
|
||||||
func crush(img image.Image, speed int) ([]byte, error) {
|
func crush(img image.Image, speed int) ([]byte, error) {
|
||||||
|
|
||||||
width := img.Bounds().Max.X
|
width := img.Bounds().Max.X
|
||||||
|
|||||||
12
imagecrush_disabled.go
Normal file
12
imagecrush_disabled.go
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
// +build disableimagecrush
|
||||||
|
|
||||||
|
package thumbnail
|
||||||
|
|
||||||
|
import (
|
||||||
|
"errors"
|
||||||
|
"image"
|
||||||
|
)
|
||||||
|
|
||||||
|
func crushFast(img image.Image) ([]byte, error) {
|
||||||
|
return nil, errors.New("Pngquant not compiled in")
|
||||||
|
}
|
||||||
1
make_archive.sh
Executable file
1
make_archive.sh
Executable file
@@ -0,0 +1 @@
|
|||||||
|
hg archive out.zip
|
||||||
Reference in New Issue
Block a user