Skip to content

Commit

Permalink
Use github.com/bamiaux/rez
Browse files Browse the repository at this point in the history
  • Loading branch information
Wikidepia committed Jul 2, 2024
1 parent dfd78d9 commit 8ba0c0d
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ require (
github.com/PurpleSec/escape v1.0.0
github.com/RyanCarrier/dijkstra/v2 v2.0.2
github.com/ansrivas/fiberprometheus/v2 v2.6.1
github.com/bamiaux/rez v0.0.0-20170731184118-29f4463c688b
github.com/cockroachdb/pebble v1.1.1
github.com/gofiber/fiber/v2 v2.52.4
github.com/kelindar/binary v1.0.19
github.com/nfnt/resize v0.0.0-20180221191011-83c6a9932646
github.com/rs/zerolog v1.33.0
github.com/tdewolff/parse/v2 v2.7.15
github.com/tidwall/gjson v1.17.1
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ github.com/andybalholm/cascadia v1.3.2 h1:3Xi6Dw5lHF15JtdcmAHD3i1+T8plmv7BQ/nsVi
github.com/andybalholm/cascadia v1.3.2/go.mod h1:7gtRlve5FxPPgIgX36uWBX58OdBsSS6lUvCFb+h7KvU=
github.com/ansrivas/fiberprometheus/v2 v2.6.1 h1:wac3pXaE6BYYTF04AC6K0ktk6vCD+MnDOJZ3SK66kXM=
github.com/ansrivas/fiberprometheus/v2 v2.6.1/go.mod h1:MloIKvy4yN6hVqlRpJ/jDiR244YnWJaQC0FIqS8A+MY=
github.com/bamiaux/rez v0.0.0-20170731184118-29f4463c688b h1:5Ci5wpOL75rYF6RQGRoqhEAU6xLJ6n/D4SckXX1yB74=
github.com/bamiaux/rez v0.0.0-20170731184118-29f4463c688b/go.mod h1:obBQGGIFbbv9KWg92Qu9UHeD94JXmHD1jovY/z6I3O8=
github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM=
github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw=
github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UFvs=
Expand Down Expand Up @@ -69,8 +71,6 @@ github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWE
github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
github.com/mattn/go-runewidth v0.0.15 h1:UNAjwbU9l54TA3KzvqLGxwWjHmMgBUVhBiTjelZgg3U=
github.com/mattn/go-runewidth v0.0.15/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w=
github.com/nfnt/resize v0.0.0-20180221191011-83c6a9932646 h1:zYyBkD/k9seD2A7fsi6Oo2LfFZAehjjQMERAvZLEDnQ=
github.com/nfnt/resize v0.0.0-20180221191011-83c6a9932646/go.mod h1:jpp1/29i3P1S/RLdc7JQKbRpFeM1dOBd8T9ki5s+AY8=
github.com/pingcap/errors v0.11.4 h1:lFuQV/oaUMGcD2tqt+01ROSmJs75VG1ToEOkZIZ4nE4=
github.com/pingcap/errors v0.11.4/go.mod h1:Oi8TUi2kEtXXLMJk9l1cGmz20kV3TaQ0usTwv5KuLY8=
github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA=
Expand Down
10 changes: 7 additions & 3 deletions handlers/grid.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ import (
scraper "instafix/handlers/scraper"

"github.com/RyanCarrier/dijkstra/v2"
"github.com/bamiaux/rez"
"github.com/gofiber/fiber/v2"
"github.com/nfnt/resize"
)

var transport = &http.Transport{
Expand Down Expand Up @@ -119,8 +119,12 @@ func GenerateGrid(images []image.Image) (image.Image, error) {
oldImWidth := 0
for _, imageOne := range inRow {
newWidth := float64(heightRows[i-1]) * float64(imageOne.Bounds().Dx()) / float64(imageOne.Bounds().Dy())
imageOne = resize.Resize(uint(newWidth), uint(heightRows[i-1]), imageOne, resize.MitchellNetravali)
draw.Draw(canvas, image.Rect(oldImWidth, oldRowHeight, oldImWidth+imageOne.Bounds().Dx(), oldRowHeight+imageOne.Bounds().Dy()), imageOne, imageOne.Bounds().Min, draw.Src)
newImage := image.NewYCbCr(image.Rect(0, 0, int(newWidth), int(heightRows[i-1])), image.YCbCrSubsampleRatio420)
// imageOne = resize.Resize(uint(newWidth), uint(heightRows[i-1]), imageOne, resize.MitchellNetravali)
if err := rez.Convert(newImage, imageOne, rez.NewBicubicFilter()); err != nil {
return nil, err
}
draw.Draw(canvas, image.Rect(oldImWidth, oldRowHeight, oldImWidth+newImage.Bounds().Dx(), oldRowHeight+newImage.Bounds().Dy()), newImage, newImage.Bounds().Min, draw.Src)
oldImWidth += int(newWidth)
}
oldRowHeight += heightRows[i-1]
Expand Down

0 comments on commit 8ba0c0d

Please sign in to comment.