summary refs log tree commit diff
path: root/extra/admin-api/Spacebar.Cdn/Services/DiscordImageResizeService.cs
blob: 2d887f1217cbdbc6fd7ec5eefd23221894d1bb92 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
using System.Runtime.Serialization;

namespace Spacebar.AdminApi.TestClient.Services.Services;

public class DiscordImageResizeParams {
    public uint? Size { get; set; }
    public DiscordImageResizeQuality Quality { get; set; } = DiscordImageResizeQuality.High;
    public bool KeepAspectRatio { get; set; } = true;
    public bool Passthrough { get; set; } = true;
    public bool Animated { get; set; } = true;

    public bool SpacebarAllowUpscale { get; set; } = false;
    public bool SpacebarOptimiseGif { get; set; } = true;
    public string Format { get; set; } = "webp";

    public string ToSerializedName() {
        return $"{(Animated ? "a_" : "")}{Size}px_{Quality.ToString()}_u.{SpacebarAllowUpscale}_o.{SpacebarOptimiseGif}.{Format}";
    }
}

public enum DiscordImageResizeQuality {
    [EnumMember(Value = "low")] Low,
    [EnumMember(Value = "high")] High,
    [EnumMember(Value = "lossless")] Lossless
}