{"record":{"id":"79c5ee2f6c7f4f00","repo":"gohugoio/hugo","slug":"quality-ranges-from-1-to-100-inclusive","errorCode":null,"errorMessage":"quality ranges from 1 to 100 inclusive","messagePattern":"quality ranges from 1 to 100 inclusive","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"resources/images/config.go","lineNumber":285,"sourceCode":"\t\t\tc.Filter = filter\n\t\t} else if _, ok := hints[part]; ok {\n\t\t\tc.Hint = part\n\t\t} else if _, ok := compressionMethods[part]; ok {\n\t\t\tc.Compression = part\n\t\t} else if f, ok := ImageFormatFromExt(\".\" + part); ok {\n\t\t\tc.TargetFormat = f\n\t\t} else if part[0] == '#' {\n\t\t\tc.BgColor, err = hexStringToColorGo(part[1:])\n\t\t\tif err != nil {\n\t\t\t\treturn c, err\n\t\t\t}\n\t\t} else if part[0] == 'q' {\n\t\t\tc.Quality, err = strconv.Atoi(part[1:])\n\t\t\tif err != nil {\n\t\t\t\treturn c, err\n\t\t\t}\n\t\t\tif c.Quality < 1 || c.Quality > 100 {\n\t\t\t\treturn c, errors.New(\"quality ranges from 1 to 100 inclusive\")\n\t\t\t}\n\t\t} else if part[0] == 'r' {\n\t\t\tc.Rotate, err = strconv.Atoi(part[1:])\n\t\t\tif err != nil {\n\t\t\t\treturn c, err\n\t\t\t}\n\t\t} else if strings.Contains(part, \"x\") {\n\t\t\twidthHeight := strings.Split(part, \"x\")\n\t\t\tif len(widthHeight) <= 2 {\n\t\t\t\tfirst := widthHeight[0]\n\t\t\t\tif first != \"\" {\n\t\t\t\t\tc.Width, err = strconv.Atoi(first)\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\treturn c, err\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif len(widthHeight) == 2 {","sourceCodeStart":267,"sourceCodeEnd":303,"githubUrl":"https://github.com/gohugoio/hugo/blob/52c9bd7908b4d02d4d0ff8f82a888834d6ee10d2/resources/images/config.go#L267-L303","documentation":"`DecodeImageConfig` parses the image processing option string (e.g. \"200x100 q80 jpg\"). When a token starts with `q`, the rest is parsed as the JPEG/WEBP quality. Quality must be between 1 and 100 inclusive; anything outside that is rejected at config.go:285.","triggerScenarios":"Using `q0`, `q101`, `q-5`, or any `qNNN` outside 1-100 in a template image action like `{{ $img.Resize \"q120 jpg\" }}` or `.Fill`/`.Fit`/`.Crop`.","commonSituations":"Typing `q0` thinking it disables quality; using a percentage like `q0.8`; copy-paste from a doc that used 0-1 floats; confusion with other tools' quality scales.","solutions":["Use an integer quality from 1 to 100, e.g. `q75` (the default).","If you wanted default quality, just omit the `q` token.","Double-check the option string ordering — `q` must be followed immediately by digits."],"exampleFix":"{{/* before */}}\n{{ $img.Resize \"300x q0 jpg\" }}\n\n{{/* after */}}\n{{ $img.Resize \"300x q75 jpg\" }}","handlingStrategy":"validation","validationCode":"if q < 1 || q > 100 { return fmt.Errorf(\"quality must be 1-100, got %d\", q) }","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Quality is an integer 1-100 (default 75), not a 0-1 float.","Omit q for the default.","Build option strings from validated integers."],"tags":["hugo","image-processing","templates","validation"],"backgroundTag":null,"analyzedSha":"52c9bd7908b4d02d4d0ff8f82a888834d6ee10d2","analyzedAt":"2026-08-09T21:49:36.660Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}