[wp-trac] [WordPress Trac] #40415: Imagick resize filter hook
WordPress Trac
noreply at wordpress.org
Mon Jun 18 18:03:21 UTC 2018
#40415: Imagick resize filter hook
-------------------------------------+---------------------
Reporter: virgodesign | Owner: (none)
Type: enhancement | Status: new
Priority: normal | Milestone: 5.0
Component: Media | Version: 4.7.3
Severity: normal | Resolution:
Keywords: has-patch needs-testing | Focuses:
-------------------------------------+---------------------
Changes (by audrasjb):
* keywords: has-patch => has-patch needs-testing
* milestone: Awaiting Review => 5.0
Old description:
> As of ticket #33642, Wordpress 4.5 introduces the `thumbnail_image()`
> function within the `WP_Image_Editor_Imagick` class.
> This function uses the default imagick filter `FILTER_TRIANGLE` to
> assists the image resizing process.
> Within the `thumbnail_image()` is even declared a list of allowed filters
> that actually are absolute unsued due to the fact that wordpress uses
> only the default filter `FILTER_TRIANGLE`. The filter list is
>
> {{{
> 'FILTER_POINT'
> 'FILTER_BOX'
> 'FILTER_TRIANGLE'
> 'FILTER_HERMITE'
> 'FILTER_HANNING'
> 'FILTER_HAMMING'
> 'FILTER_BLACKMAN'
> 'FILTER_GAUSSIAN'
> 'FILTER_QUADRATIC'
> 'FILTER_CUBIC'
> 'FILTER_CATROM'
> 'FILTER_MITCHELL'
> 'FILTER_LANCZOS'
> 'FILTER_BESSEL'
> 'FILTER_SINC'
> }}}
>
> Resizing image using the default filter often gives as a result a softly
> blurry thumbnail image. this blur effect became more visible as the
> thumbnail size increase.
>
> Using filter like `FILTER_HAMMING` or `FILTER_SINC` the blur effect
> disappear, giving a great resizing result.
>
> To better improve the use of the resizing process and to give any users
> the ability to choose which type of filter to use, I think that could be
> implemented the following filter hook:
>
> {{{
> $filter_name = apply_filters('image_resize_filter', $filter_name);
> }}}
>
> that will give an opportunity to change this filter before the resizing
> process will perform.
> This filter should be implemented at the beginning (line 1) of the
> `thumbnail_image()` function.
> This way everyone can, optionally, change the imagick resize filter
> easily.
New description:
As of ticket #33642, WordPress 4.5 introduces the `thumbnail_image()`
function within the `WP_Image_Editor_Imagick` class.
This function uses the default imagick filter `FILTER_TRIANGLE` to assists
the image resizing process.
Within the `thumbnail_image()` is even declared a list of allowed filters
that actually are absolute unsued due to the fact that wordpress uses only
the default filter `FILTER_TRIANGLE`. The filter list is
{{{
'FILTER_POINT'
'FILTER_BOX'
'FILTER_TRIANGLE'
'FILTER_HERMITE'
'FILTER_HANNING'
'FILTER_HAMMING'
'FILTER_BLACKMAN'
'FILTER_GAUSSIAN'
'FILTER_QUADRATIC'
'FILTER_CUBIC'
'FILTER_CATROM'
'FILTER_MITCHELL'
'FILTER_LANCZOS'
'FILTER_BESSEL'
'FILTER_SINC'
}}}
Resizing image using the default filter often gives as a result a softly
blurry thumbnail image. this blur effect became more visible as the
thumbnail size increase.
Using filter like `FILTER_HAMMING` or `FILTER_SINC` the blur effect
disappear, giving a great resizing result.
To better improve the use of the resizing process and to give any users
the ability to choose which type of filter to use, I think that could be
implemented the following filter hook:
{{{
$filter_name = apply_filters('image_resize_filter', $filter_name);
}}}
that will give an opportunity to change this filter before the resizing
process will perform.
This filter should be implemented at the beginning (line 1) of the
`thumbnail_image()` function.
This way everyone can, optionally, change the imagick resize filter
easily.
--
Comment:
Hi!
I'd say we also need to add `FILTER_HAMMING` to default filter fallback :)
Cheers,
Jb
--
Ticket URL: <https://core.trac.wordpress.org/ticket/40415#comment:3>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list