bricelam / ImageResizer

Moved to Microsoft PowerToys
https://github.com/microsoft/PowerToys
1.03k stars 118 forks source link

JPEG Quality 75 produces a result that is actually 90 #80

Closed IgitBuh closed 6 years ago

IgitBuh commented 6 years ago

There seems to be a bug with the JPEG quality setting. The default value in ImageResizer is 75. This value however produces exactly the same result as a value of 90. Other values seem to work correctly.

Example: Original file: 6000 KB 50: 171 KB 74: 234 KB 75: 377 KB 76: 240 KB 90: 377 KB 95: 535 KB

I assume that ImageResizer treats the default value 75 incorrectly, so in result it works with the value 0 internally (maybe because the default value isn't written or read correctly from the settings file). The value 0 then produces a result with a default compression rate (probably defined in Windows somewhere) which is 90. So if you set the quality value to 0 or 75 or 90, you will get a result of quality 90.

I consider this to be a major bug, because the result is different from what was configured.

bricelam commented 6 years ago

Image Resizer leverages the Windows Imaging Component (WIC). What you're observing is just the default behavior of Microsoft's build-in JPEG WIC codec. You could try finding and installing a more sophisticated codec...

IgitBuh commented 6 years ago

I'm actually speechless, that you don't see this as a bug and marked this as invalid...

bricelam commented 6 years ago

I'll double check that it actually passes 75 to the codec, but beyond that it's outside of my control.

bricelam commented 6 years ago

And I'm sorry if you feel like you're not getting your money's worth. I'd be happy to provide a refund.

bricelam commented 6 years ago

Here's your bug buried deep inside the Microsoft's .NET Framework: https://referencesource.microsoft.com/#PresentationCore/Core/CSharp/System/Windows/Media/Imaging/JpegBitmapEncoder.cs,242 It treats 75 (the default) as unset which causes the codec's default (90) to be used. It's most likely by design to provide a higher-quality default, but feel free to provide feedback to Microsoft.

bricelam commented 6 years ago

Where should I send the support bill? It totals the same price as the software: free.

IgitBuh commented 6 years ago

Thank you for looking into this issue after all. Why do you get so cynical? I'm only trying to improve this software, so other users don't run into this problem. As I am aware of this bug, I can avoid it. Other users will run into it if you don't include a workaround, even if the bug is not in your code but the component you're using. For example, if someone tries to increase the quality by setting a value of 80, they will actually get a quality that's worse than the default setting of 75.

JNavas2 commented 6 years ago

Possible solution is to only offer choices that exclude 75; e.g.,: 50, 60, 70, 80, 90, 100.

IgitBuh commented 6 years ago

... or to use 76 internally if 75 is configured.

JNavas2 commented 6 years ago

@IgitBuh The point is that Brice cannot fix a Microsoft problem. Even my workaround may not help if (when) Microsoft makes further changes.

JNavas2 commented 6 years ago

@IgitBuh

... or to use 76 internally if 75 is configured.

Nope: That would be a deliberate bug that could lead to even more confusion. My workaround addresses the issue by avoiding it.

IgitBuh commented 6 years ago

Try to see this issue from the point of view of a normal user. They don't care about the background reasons. They just want the software to work as configured.

JNavas2 commented 6 years ago

@IgitBuh Brice and I do understand the issue. Why insult us? As i wrote, Brice cannot fix the Microsoft problem. The best he can do is avoid it; e.g., by not allowing a value of 75. Or any value other than the default. Is that what you want? "Be careful what you wish for!"

IgitBuh commented 6 years ago

Why insult us?

Pardon me? How exactly did I insult you?

JNavas2 commented 6 years ago
bricelam commented 6 years ago

Sorry to be cynical. After explaining as best I could that that the issue was outside of my control and just the behavior of something I build on top of, you're response was:

I'm actually speechless, that you don't see this as a bug and marked this as invalid...

This struck me as unappreciative and entitled--taking for granted all the hard work I invest into this project.

My apologies, I probably overreacted.

bricelam commented 6 years ago

I think updating Image Resizer's default to 90 would be good. This solves the problem of people trying to achieve a higher quality, but ending up with a lower one.