Skip to content

Commit

Permalink
Quality as float
Browse files Browse the repository at this point in the history
  • Loading branch information
dhcgn committed Jun 23, 2022
1 parent f560221 commit e43c97b
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
4 changes: 2 additions & 2 deletions jxlgui.converter/Config.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ public class Config
// Quality setting (is remapped to --distance). Range: -inf .. 100.
// 100 = mathematically lossless. Default for already-lossy input (JPEG/GIF).
// Positive quality values roughly match libjpeg quality.
public int Quality { get; set; }
public double Quality { get; set; }

// Encoder effort setting. Range: 1 .. 9.
// Default: 7. Higher number is more effort (slower)
Expand All @@ -17,7 +17,7 @@ public static Config CreateEmpty()
{
return new Config
{
Quality = 99,
Quality = 99.9,
Effort = 7
};
}
Expand Down
3 changes: 2 additions & 1 deletion jxlgui.converter/JobManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,8 @@ private static string GetArguments(Job job)
switch (job.Operation)
{
case Job.OperationEnum.Encode:
return $"-q {job.Config.Quality} -e {job.Config.Effort} \"{job.FilePath}\" \"{job.TargetFilePath}\"";
var quality = job.Config.Quality.ToString("N3", System.Globalization.CultureInfo.InvariantCulture);
return $"-q {quality} -e {job.Config.Effort} \"{job.FilePath}\" \"{job.TargetFilePath}\"";
case Job.OperationEnum.Decode:
return $" \"{job.FilePath}\" \"{job.TargetFilePath}\"";
default:
Expand Down
2 changes: 1 addition & 1 deletion jxlgui.wpf/Views/MainWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@
</StackPanel>
<StackPanel Orientation="Horizontal"
Visibility="{Binding Config, Converter={StaticResource VisibilityNullConverter}}">
<TextBlock FontSize="8" Text="{Binding Config.Quality, StringFormat=Quality: {0}}" />
<TextBlock FontSize="8" Text="{Binding Config.Quality, StringFormat=Quality: {0:N3}}" />
<Border Width="5"></Border>
<TextBlock FontSize="8" Text="{Binding Config.Effort, StringFormat=Effort: {0}}" />
</StackPanel>
Expand Down

0 comments on commit e43c97b

Please sign in to comment.