fiddly widdly imagey wimagey

This commit is contained in:
tsmethurst 2021-05-17 12:13:39 +02:00
commit 3868803ff1
3 changed files with 6 additions and 2 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 293 KiB

After

Width:  |  Height:  |  Size: 753 KiB

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.6 KiB

After

Width:  |  Height:  |  Size: 29 KiB

Before After
Before After

View file

@ -206,7 +206,9 @@ func deriveImage(b []byte, contentType string) (*imageAndMeta, error) {
} }
out := &bytes.Buffer{} out := &bytes.Buffer{}
if err := jpeg.Encode(out, i, nil); err != nil { if err := jpeg.Encode(out, i, &jpeg.Options{
Quality: 100,
}); err != nil {
return nil, err return nil, err
} }
@ -256,7 +258,9 @@ func deriveThumbnail(b []byte, contentType string, x uint, y uint) (*imageAndMet
aspect := float64(width) / float64(height) aspect := float64(width) / float64(height)
out := &bytes.Buffer{} out := &bytes.Buffer{}
if err := jpeg.Encode(out, thumb, nil); err != nil { if err := jpeg.Encode(out, thumb, &jpeg.Options{
Quality: 100,
}); err != nil {
return nil, err return nil, err
} }
return &imageAndMeta{ return &imageAndMeta{