Make WordPress Core

Opened 3 months ago

Last modified 3 months ago

#61926 new defect (bug)

Imagick breaks default image progressive/interlace when converted to a mime type that doesn't support interlace

Reported by: kkmuffme's profile kkmuffme Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version:
Component: Media Keywords: reporter-feedback
Focuses: Cc:

Description

if the new format the instance is set to in https://github.com/WordPress/WordPress/blame/master/wp-includes/class-wp-image-editor-imagick.php#L818 does not support interlace, imagick will remove the interlace information (set it to "none")

Therefore retrieveing it here https://github.com/WordPress/WordPress/blame/master/wp-includes/class-wp-image-editor-imagick.php#L827 is too late. It must be retrieved before setImageFormat is called

Change History (2)

#1 follow-up: @adamsilverstein
3 months ago

  • Keywords reporter-feedback added

Hi @kkmuffme - thanks for the ticket.

when converted to a mime type that doesn't support interlace

If you upload a JPEG interlaced and have image_editor_output_format set to transform that to WebP, I would expect a non interlaced output since WebP doesn't support interlace. Isn't that how it works currently?

retrieveing it here https://github.com/WordPress/WordPress/blame/master/wp-includes/class-wp-image-editor-imagick.php#L827 is too late

Are you sure that it is too late at that point, I would expect $this->image to be the original uploaded image, not the transformed mime type image here. Is that not the case?

Can you please provide some steps to reproduce? what filters do you have in place? what type of image are you uploading? what are you expecting for output/what actually happens.

#2 in reply to: ↑ 1 @kkmuffme
3 months ago

Replying to adamsilverstein:

If you upload a JPEG interlaced and have image_editor_output_format set to transform that to WebP, I would expect a non interlaced output since WebP doesn't support interlace. Isn't that how it works currently?

This class is not limited to uploads but can be used outside of it too.

retrieveing it here https://github.com/WordPress/WordPress/blame/master/wp-includes/class-wp-image-editor-imagick.php#L827 is too late

Are you sure that it is too late at that point, I would expect $this->image to be the original uploaded image, not the transformed mime type image here. Is that not the case?

Can you please provide some steps to reproduce? what filters do you have in place? what type of image are you uploading? what are you expecting for output/what actually happens.

Yes, it's not. The reason being it uses $this->image instance to set format instead of the passed param $image https://github.com/WordPress/WordPress/blame/master/wp-includes/class-wp-image-editor-imagick.php#L818

EDIT: which is that same $this->image too. Afaik this needs a handling like there is already in >thumbnail_image that it stores the original image instance and then clears() it after _save() and assigns the original instance.

Last edited 3 months ago by kkmuffme (previous) (diff)
Note: See TracTickets for help on using tickets.