kopaka1822 / ImageViewer

HDR, PFM, DDS, KTX, EXR, PNG, JPG, BMP image viewer and manipulator
MIT License
331 stars 37 forks source link

ImageConsole.exe using float as a filterparam #27

Closed clanfreak1988 closed 1 year ago

clanfreak1988 commented 1 year ago

Describe the bug When you try to use a filter parameter with a dot number, the tool will try to convert in to a int.

To Reproduce .\ImageConsole.exe -open .\\ -addfilter .\Filter\gamma.hlsl -filterparam 0 Gamma 0.5 -export .\\.png RGBA8_SRGB

Expected behavior I expected thats i can use float as a filter param

Screenshots Error message: could not convert "0.5" at index 2 to integer

Desktop (please complete the following information): Windows 10

Additional context The problem is in the file FilterParameterCommand.cs in the line 31. You try to read in as int not as a float. I fix it locally and test it. Problemcode block

case ParameterType.Float:
  fp.GetFloatModel().Value = reader.ReadInt("value");
  break;

Fixedcode Block

case ParameterType.Float:
  fp.GetFloatModel().Value = reader.ReadFloat("value");
  break;
kopaka1822 commented 1 year ago

Thank you for your contribution. I fixed it in the latest commit