Skip to content
This repository has been archived by the owner on Oct 2, 2023. It is now read-only.

update go and swap to graphicsmagic #108

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
FROM golang:1.5
RUN apt-get update && apt-get install -yqq aspell aspell-en libaspell-dev tesseract-ocr tesseract-ocr-eng imagemagick optipng exiftool libjpeg-progs webp
FROM golang:1.7
RUN apt-get update && apt-get install -yqq aspell aspell-en libaspell-dev tesseract-ocr tesseract-ocr-eng graphicsmagick optipng exiftool libjpeg-progs webp
ADD docker/meme.traineddata /usr/share/tesseract-ocr/tessdata/meme.traineddata
ADD docker/imagemagick_policy.xml /etc/ImageMagick-6/policy.xml
RUN mkdir -p /etc/mandible /tmp/imagestore
ENV MANDIBLE_CONF /etc/mandible/conf.json
ENV GO15VENDOREXPERIMENT 1
ADD . /go/src/github.com/Imgur/mandible
WORKDIR /go/src/github.com/Imgur/mandible
RUN go get github.com/mattn/goveralls
Expand Down
56 changes: 0 additions & 56 deletions docker/imagemagick_policy.xml

This file was deleted.

11 changes: 10 additions & 1 deletion imageprocessor/processorcommand/gm.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,13 @@ import (
"github.com/Imgur/mandible/imageprocessor/thumbType"
)

const GM_COMMAND = "convert"
const GM_COMMAND = "gm"

func ConvertToJpeg(filename string) (string, error) {
outfile := fmt.Sprintf("%s_jpg", filename)

args := []string{
"convert",
filename,
"-flatten",
"JPEG:" + outfile,
Expand All @@ -29,6 +30,7 @@ func FixOrientation(filename string) (string, error) {
outfile := fmt.Sprintf("%s_ort", filename)

args := []string{
"convert",
filename,
"-auto-orient",
outfile,
Expand All @@ -46,6 +48,7 @@ func Quality(filename string, quality int) (string, error) {
outfile := fmt.Sprintf("%s_q", filename)

args := []string{
"convert",
filename,
"-quality",
fmt.Sprintf("%d", quality),
Expand All @@ -66,6 +69,7 @@ func ResizePercent(filename string, percent int) (string, error) {
outfile := fmt.Sprintf("%s_rp", filename)

args := []string{
"convert",
filename,
"-resize",
fmt.Sprintf("%d%%", percent),
Expand All @@ -84,6 +88,7 @@ func SquareThumb(filename, name string, size int, quality int, format thumbType.
outfile := fmt.Sprintf("%s_%s", filename, name)

args := []string{
"convert",
fmt.Sprintf("%s[0]", filename),
"-resize",
fmt.Sprintf("%dx%d^", size, size),
Expand Down Expand Up @@ -118,6 +123,7 @@ func Thumb(filename, name string, width, height int, quality int, format thumbTy
outfile := fmt.Sprintf("%s_%s", filename, name)

args := []string{
"convert",
fmt.Sprintf("%s[0]", filename),
"-resize",
fmt.Sprintf("%dx%d>", width, height),
Expand Down Expand Up @@ -151,6 +157,7 @@ func CircleThumb(filename, name string, width int, quality int, format thumbType
}

args := []string{
"convert",
"-size",
fmt.Sprintf("%dx%d", width, width),
"xc:none",
Expand Down Expand Up @@ -185,6 +192,7 @@ func CustomThumb(filename, name string, width, height int, cropGravity string, c
outfile := fmt.Sprintf("%s_%s", filename, name)

args := []string{
"convert",
fmt.Sprintf("%s[0]", filename),
"-resize",
fmt.Sprintf("%dx%d^", width, height),
Expand Down Expand Up @@ -221,6 +229,7 @@ func Full(filename string, name string, quality int, format thumbType.ThumbType)
outfile := fmt.Sprintf("%s_%s", filename, name)

args := []string{
"convert",
fmt.Sprintf("%s[0]", filename),
"-density",
"72x72",
Expand Down