diff --git a/image.go b/image.go index a1648ba..33238cc 100644 --- a/image.go +++ b/image.go @@ -4,8 +4,6 @@ import ( "bytes" "image" "image/jpeg" - - "code.ivysaur.me/imagequant" ) 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 { case OUTPUT_PNG_CRUSH: - return crush(dest, imagequant.SPEED_FASTEST) + return crushFast(dest) case OUTPUT_JPG: buff := bytes.Buffer{} diff --git a/imagecrush.go b/imagecrush.go index f387192..2254af7 100644 --- a/imagecrush.go +++ b/imagecrush.go @@ -1,3 +1,5 @@ +//+build !disableimagecrush + package thumbnail import ( @@ -51,6 +53,10 @@ func rgb8PaletteToGoImage(w, h int, rgb8data []byte, pal color.Palette) image.Im return ret } +func crushFast(img image.Image) ([]byte, error) { + return crush(img, imagequant.SPEED_FASTEST) +} + func crush(img image.Image, speed int) ([]byte, error) { width := img.Bounds().Max.X diff --git a/imagecrush_disabled.go b/imagecrush_disabled.go new file mode 100644 index 0000000..970aeb5 --- /dev/null +++ b/imagecrush_disabled.go @@ -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") +}