Improved quality for low DPI screens

This commit is contained in:
Eduard Urbach 2017-11-10 10:29:42 +01:00
parent 44369cb916
commit 6aa10bfb6b
2 changed files with 15 additions and 6 deletions

View File

@ -48,6 +48,11 @@ func configureAssets(app *aero.Application) {
return ctx.File("images/brand/" + ctx.Get("file")) return ctx.File("images/brand/" + ctx.Get("file"))
}) })
// Anime images
app.Get("/images/anime/*file", func(ctx *aero.Context) string {
return ctx.File("images/anime/" + ctx.Get("file"))
})
// Cover image // Cover image
app.Get("/images/cover/:file", func(ctx *aero.Context) string { app.Get("/images/cover/:file", func(ctx *aero.Context) string {
file := strings.TrimSuffix(ctx.Get("file"), ".webp") file := strings.TrimSuffix(ctx.Get("file"), ".webp")

View File

@ -72,6 +72,10 @@ func work(anime *arn.Anime) error {
webpQuality := 70 webpQuality := 70
jpegQuality := 70 jpegQuality := 70
qualityBonusLowDPI := 10
qualityBonusMedium := 10
qualityBonusSmall := 10
kitsuOriginal := fmt.Sprintf("https://media.kitsu.io/anime/poster_images/%s/original", anime.ID) kitsuOriginal := fmt.Sprintf("https://media.kitsu.io/anime/poster_images/%s/original", anime.ID)
system := ipo.System{ system := ipo.System{
@ -113,7 +117,7 @@ func work(anime *arn.Anime) error {
Directory: large, Directory: large,
BaseName: anime.ID, BaseName: anime.ID,
Size: largeSize, Size: largeSize,
Quality: jpegQuality, Quality: jpegQuality + qualityBonusLowDPI,
}, },
&outputs.ImageFile{ &outputs.ImageFile{
Directory: large, Directory: large,
@ -126,7 +130,7 @@ func work(anime *arn.Anime) error {
BaseName: anime.ID, BaseName: anime.ID,
Size: largeSize, Size: largeSize,
Format: "webp", Format: "webp",
Quality: webpQuality, Quality: webpQuality + qualityBonusLowDPI,
}, },
&outputs.ImageFile{ &outputs.ImageFile{
Directory: large, Directory: large,
@ -141,7 +145,7 @@ func work(anime *arn.Anime) error {
Directory: medium, Directory: medium,
BaseName: anime.ID, BaseName: anime.ID,
Size: mediumSize, Size: mediumSize,
Quality: jpegQuality, Quality: jpegQuality + qualityBonusLowDPI + qualityBonusMedium,
}, },
&outputs.ImageFile{ &outputs.ImageFile{
Directory: medium, Directory: medium,
@ -154,7 +158,7 @@ func work(anime *arn.Anime) error {
BaseName: anime.ID, BaseName: anime.ID,
Size: mediumSize, Size: mediumSize,
Format: "webp", Format: "webp",
Quality: webpQuality, Quality: webpQuality + qualityBonusLowDPI + qualityBonusMedium,
}, },
&outputs.ImageFile{ &outputs.ImageFile{
Directory: medium, Directory: medium,
@ -169,7 +173,7 @@ func work(anime *arn.Anime) error {
Directory: small, Directory: small,
BaseName: anime.ID, BaseName: anime.ID,
Size: smallSize, Size: smallSize,
Quality: jpegQuality, Quality: jpegQuality + qualityBonusLowDPI + qualityBonusSmall,
}, },
&outputs.ImageFile{ &outputs.ImageFile{
Directory: small, Directory: small,
@ -182,7 +186,7 @@ func work(anime *arn.Anime) error {
BaseName: anime.ID, BaseName: anime.ID,
Size: smallSize, Size: smallSize,
Format: "webp", Format: "webp",
Quality: webpQuality, Quality: webpQuality + qualityBonusLowDPI + qualityBonusSmall,
}, },
&outputs.ImageFile{ &outputs.ImageFile{
Directory: small, Directory: small,