Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow sharpening amount in sharpen parameter #3

Open
Toutouwai opened this issue Sep 11, 2014 · 3 comments
Open

Allow sharpening amount in sharpen parameter #3

Toutouwai opened this issue Sep 11, 2014 · 3 comments

Comments

@Toutouwai
Copy link

As with TimThumb, the sharpening parameter is a binary on-off affair. And as with TimThumb, I find the default level of sharpening to be too strong. Adjusting the level of sharpening in TimThumb requires tweaking the values in the sharpening matrix - thankfully it's much easier in ImThumb and just requires a simple adjustment to the blur value in resizeImage(). I found 0.8 was about right to my eye.

The amount of sharpening needed is a matter of taste, and can vary according to the size of the generated image. So my request is instead of "s=1"/"s=0" to enable/disable sharpening, could the amount of sharpening be passed in the parameter, e.g. "s=0.8"?

Note: I realise that part of the intention behind the ImThumb project is provide a drop-in replacement for TimThumb. However, TimThumb has certain shortcomings (IMO) so perhaps there's an argument for deviating from the TimThumb approach?

@pospi
Copy link
Owner

pospi commented Sep 11, 2014

Absolutely. So long as the library is compatible with TimThumb's approach out of the box (or can be configured to be) then I am more than happy to add in any other diverging and enhanced functionality.

In this case I think we can add this in either of the following ways:

  • add another new parameter for controlling the sharpen level
  • strictly interpret a 1 / 0 for the parameter to act as the current boolean toggle, and interpret any floating point values as directly defining the sharpen level

My preference leans toward the second approach as then we're reusing current parameters and enhancing them a bit rather than adding further variables to the mix. If you had a reason to explicitly pass a 1 or a 0 as the sharpen level then you could just pass it as 1.0 or 0.0.

@Toutouwai
Copy link
Author

Yes, the second approach sounds perfect.

pospi added a commit that referenced this issue Jul 2, 2015
@pospi
Copy link
Owner

pospi commented Jul 2, 2015

can you test out the sharpen-param-enhance branch for me and let me know if it breaks any of your existing images? I've noticed some weird artifacts when you set it to low values..

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants