Commit 64daf26 1 parent 0c7f1a4 commit 64daf26 Copy full SHA for 64daf26
File tree 1 file changed +19
-0
lines changed
1 file changed +19
-0
lines changed Original file line number Diff line number Diff line change @@ -68,6 +68,25 @@ const (
68
68
// SetToStandardValues' quality parameter. It matches libjpeg's default
69
69
// both in terms of numerical value and in behavior.
70
70
DefaultQuality = 75
71
+
72
+ // MinimumBaselineQuality is lowest quality level where both the cjpeg
73
+ // program (from the libjpeg C project) and this Go package will agree on
74
+ // the exact quantization factors.
75
+ //
76
+ // It's still valid to pass a SetToStandardValues quality parameter value
77
+ // below 24. But when doing so, passing the equivalent to cjpeg will print
78
+ // a JTRC_16BIT_TABLES warning: "quantization tables are too coarse for
79
+ // baseline JPEG". cjpeg will therefore produce extended (instead of
80
+ // baseline) JPEGs, using 2 bytes (instead of 1 byte) per quantization
81
+ // factor, allowing factors above 0xFF.
82
+ //
83
+ // This Go package will instead clamp such quantization factors to 0xFF.
84
+ //
85
+ // Both approaches are viable, producing valid JPEGs. This Go package, like
86
+ // the Go standard library's image/jpeg package, simply chooses to always
87
+ // produce baseline (instead of extended) JPEGs, for best compatibility
88
+ // with other JPEG decoders.
89
+ MinimumBaselineQuality = 24
71
90
)
72
91
73
92
// SetToStandardValues sets b to one of two standard quantization tables
You can’t perform that action at this time.
0 commit comments