Skip to content

Commit

Permalink
bump dither plugin add options for dvt option sets
Browse files Browse the repository at this point in the history
  • Loading branch information
jtomson committed Jun 11, 2024
1 parent d3f6424 commit a618afd
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 5 deletions.
11 changes: 10 additions & 1 deletion options/processing_options.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,11 @@ type DitherOptions struct {
SaturationScale float64
NormalizeContrast bool
CLAHESize int
OptionsSet01 bool // shorthand for a set of options starting with the 20240506 release
OptionsSet01 bool // shorthand sets
OptionsSet02 bool
OptionsSetCam16 bool
OptionsSetHpminde bool
OptionsSetScam bool
}

type WatermarkOptions struct {
Expand Down Expand Up @@ -769,6 +772,12 @@ func applyDitherOption(po *ProcessingOptions, args []string) error {
po.Dither.OptionsSet01 = true // shorthand for a set of options starting with the 20240506 release
case "opts02":
po.Dither.OptionsSet02 = true // shorthand for a set of options starting with the 20240510 release
case "optscam16":
po.Dither.OptionsSetCam16 = true
case "optshpminde":
po.Dither.OptionsSetHpminde = true
case "optsscam":
po.Dither.OptionsSetScam = true
default:
if err := maybeParseNumericDitherOptions(po, arg); err != nil {
return err
Expand Down
2 changes: 1 addition & 1 deletion plugins/pushd-dither
31 changes: 28 additions & 3 deletions processing/dither.go
Original file line number Diff line number Diff line change
Expand Up @@ -154,9 +154,7 @@ func shellOutDither(inFile string, po *options.ProcessingOptions) error {
cmdArgs = append(cmdArgs, "--pal-meter-13-hack")
cmdArgs = append(cmdArgs, "--contrast")
cmdArgs = append(cmdArgs, "--shrink-gamut", "1.5")
}

if po.Dither.OptionsSet02 {
} else if po.Dither.OptionsSet02 {
cmdArgs = append(cmdArgs, "--cam16")
cmdArgs = append(cmdArgs, "--chroma-lightness")
cmdArgs = append(cmdArgs, "--saturation-scale", "1.0")
Expand All @@ -165,6 +163,33 @@ func shellOutDither(inFile string, po *options.ProcessingOptions) error {
cmdArgs = append(cmdArgs, "--contrast")
cmdArgs = append(cmdArgs, "--shrink-gamut", "1.5")
cmdArgs = append(cmdArgs, "--clip-error")
} else if po.Dither.OptionsSetCam16 {
cmdArgs = append(cmdArgs, "--cam16")
cmdArgs = append(cmdArgs, "--chroma-lightness")
cmdArgs = append(cmdArgs, "--saturation-scale", "1.0")
cmdArgs = append(cmdArgs, "--hull-project")
cmdArgs = append(cmdArgs, "--pal-meter-13")
cmdArgs = append(cmdArgs, "--contrast")
cmdArgs = append(cmdArgs, "--shrink-gamut", "1.5")
cmdArgs = append(cmdArgs, "--clip-error")
} else if po.Dither.OptionsSetHpminde {
cmdArgs = append(cmdArgs, "--contrast")
cmdArgs = append(cmdArgs, "--hull-project")
cmdArgs = append(cmdArgs, "--lut-blue")
cmdArgs = append(cmdArgs, "--lut", "lut_dither/hpminde_rgb.npy")
cmdArgs = append(cmdArgs, "--lut-hue-sat", "lut_dither/hpminde_rgb.hue_sat")
cmdArgs = append(cmdArgs, "--saturation-scale", "1.0")
cmdArgs = append(cmdArgs, "--pal-meter-13")
} else if po.Dither.OptionsSetScam {
cmdArgs = append(cmdArgs, "--scam")
cmdArgs = append(cmdArgs, "--chroma-lightness")
cmdArgs = append(cmdArgs, "--saturation-scale", "1.0")
cmdArgs = append(cmdArgs, "--hull-project")
cmdArgs = append(cmdArgs, "--pal-meter-13")
cmdArgs = append(cmdArgs, "--contrast")
cmdArgs = append(cmdArgs, "--shrink-gamut", "1.5")
cmdArgs = append(cmdArgs, "--clip-error")
cmdArgs = append(cmdArgs, "--project-3d")
}

cmd := exec.Command("python3", cmdArgs...)
Expand Down

0 comments on commit a618afd

Please sign in to comment.