silverstripe / silverstripe-assets

Silverstripe Assets component
BSD 3-Clause "New" or "Revised" License
9 stars 66 forks source link

Create an image-conversion module #490

Open maxime-rainville opened 2 years ago

maxime-rainville commented 2 years ago

As a developer, I want the ability to seamlessly convert images between formats.

Acceptance criteria

Notes

Excludes

GuySartorelli commented 2 years ago

When trying to convert a transparent image to a format that does not support transparency, fall back to a suitable background

How is "suitable" defined? Can developers choose what is "suitable" for their project? e.g. maybe the default is white, but they have a primarily dark-mode website so they want to use some off-black instead?

GuySartorelli commented 2 years ago

This functionality ships in an optional module.

I don't understand the reasoning behind this? If we're defining the API for converters in core, it seems to make sense that some sensible default converters such as defined here should also ship in core?

maxime-rainville commented 2 years ago

Shipping it in an optional module, allows us to not worry about the API too much and to change it later. If we are super happy with the end results, maybe we fold it back into core later.

fall back to a suitable background

  • Maybe you have a configurable background define globally
  • Maybe you can define it on the spot in your conversion method

My main concern here, is what happens when a user uploads a WebP with some transparency? Does your system need to be smart enough do know that the fall back should be a PNG because of the transparency?

GuySartorelli commented 2 years ago

Shipping it in an optional module, allows us to not worry about the API too much

I thought the API is being defined in core via #489?

GuySartorelli commented 5 months ago

A lot of this is covered by #489 which adds a image-to-image converter powered by intervention image. The ACs that aren't captured by that aren't doable in 5 as that level of customisation isn't accessible in the version of intervention we're using. It looks like some of that might be more easily customisable in the next major release of intervention image, so could be worth looking into enhancing the converter for CMS 6.

maxime-rainville commented 5 months ago

I'll move this back to backlog. Let's live with the feature as implemented for now. If we find that the other things are needed, we can revisit.