Cat Feeder  1.0.0
The Cat feeder project
Loading...
Searching...
No Matches
image_reducer_constants.py
Go to the documentation of this file.
1"""
2# +==== BEGIN CatFeeder =================+
3# LOGO:
4# ..............(..../\\
5# ...............)..(.')
6# ..............(../..)
7# ...............\\(__)|
8# Inspired by Joan Stark
9# source https://www.asciiart.eu/
10# animals/cats
11# /STOP
12# PROJECT: CatFeeder
13# FILE: image_reducer_constants.py
14# CREATION DATE: 05-01-2026
15# LAST Modified: 0:48:0 08-01-2026
16# DESCRIPTION:
17# This is the backend server in charge of making the actual website work.
18# /STOP
19# COPYRIGHT: (c) Cat Feeder
20# PURPOSE: The file in charge of containing the constants that will be used in the class.
21# // AR
22# +==== END CatFeeder =================+
23"""
24
25from typing import List, Dict
26from enum import Enum
27
28DEFAULT_OUTPUT_FORMAT: str = "PNG"
29ALLOWED_FORMATS: List[str] = [
30 "PNG",
31 "JPEG",
32 "WEBP",
33 "SVG",
34 "GIF",
35 "BMP",
36 "TIFF",
37 "ICO",
38 "AVIF"
39]
40ALLOWED_OUTPUT_FORMATS: List[str] = ["WEBP", "JPEG", "JPG", "PNG"]
41
42COMPRESSION_QUALITY: Dict[str, int] = {
43 "webp": 85, # Quality 0-100, perceptually lossless at 1080p
44 "png": 9, # Compression level 0-9 (lossless)
45 "jpeg": 90, # Quality 0-100, invisible quality loss at 1080p
46 "jpg": 90, # Quality 0-100, invisible quality loss at 1080p
47 "gif": 1, # Optimize flag (lossless)
48 "bmp": 0, # No compression (lossless, larger file)
49 "tiff": 0, # No compression (lossless, larger file)
50 "ico": 0, # No compression (lossless, smaller images)
51 "avif": 70, # Quality 0-100, perceptually lossless at 1080p
52}
53
54
55class FileFormat(Enum):
56 """Enumeration of supported image file formats.
57
58 Includes both raster and vector image formats that can be processed
59 by the ImageReducer. Supports common web-friendly formats as well as
60 traditional image formats.
61 """
62 # Vector formats
63 SVG = "svg"
64
65 # Raster formats - Modern/Web-optimized
66 WEBP = "webp"
67 AVIF = "avif"
68
69 # Raster formats - Traditional/Widely supported
70 PNG = "png"
71 JPEG = "jpeg"
72 JPG = "jpg"
73 GIF = "gif"
74
75 # Raster formats - Legacy/Specialized
76 BMP = "bmp"
77 TIFF = "tiff"
78 ICO = "ico"
79
80 # Unknown/Unsupported format
81 UNKNOWN = "unknown"