[wp-trac] [WordPress Trac] #62285: HDR AVIF is corrupt in the media library (encoded as SDR)

WordPress Trac noreply at wordpress.org
Sat Nov 30 16:40:29 UTC 2024


#62285: HDR AVIF is corrupt in the media library (encoded as SDR)
--------------------------+------------------------------
 Reporter:  gregbenz      |       Owner:  adamsilverstein
     Type:  defect (bug)  |      Status:  assigned
 Priority:  normal        |   Milestone:  6.8
Component:  Media         |     Version:
 Severity:  normal        |  Resolution:
 Keywords:                |     Focuses:
--------------------------+------------------------------
Changes (by adamsilverstein):

 * milestone:  Awaiting Review => 6.8


Comment:

 @gregbenz the 10-bit to 8bit was a good clue and I found we may actually
 be able to fix this for Imagick: I noticed we have some depth limiting
 functionality that might be the cause of what you are seeing. We currently
 have a hard coded maximum bit depth of 8 - anything higher and Imagick
 will reduce the output image depth to 8.

 I assume this limit was introduced to ensure users weren't getting
 unnecessarily large / high bit depth images when the website users
 probably couldn't see these extra colors anyway. This assumption may no
 longer be true, what do you think?

 For now, I feel adding a filter so users who explicitly want HDR
 photography can use it would be a safe and effective change.

 I am proposing a filter in https://github.com/WordPress/wordpress-
 develop/pull/7923/files.

 You can test this filter by adding this bit of code - raising the max bit
 depth to 10 - to your functions.php and trying your upload again:


 {{{
 add_filter( 'imagick_resized_image_max_bit_depth', function() { return 10;
 } );
 }}}

 I noticed we don't have any unit tests for `getImageDepth` so it would be
 nice to add some of those here as well.

 cc: @kirasong  who added the original depth limiting code.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/62285#comment:3>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list