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

Create an image-conversion module #490

Open
8 tasks
maxime-rainville opened this issue May 3, 2022 · 6 comments
Open
8 tasks

Create an image-conversion module #490

maxime-rainville opened this issue May 3, 2022 · 6 comments

Comments

@maxime-rainville
Copy link
Contributor

maxime-rainville commented May 3, 2022

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

Acceptance criteria

  • Any image format can be converted to JPEG
  • Any image format can be converted to PNG
  • Any image format can be converted to WEBP
  • Any image format can be converted to GIF (Maybe not this one)
  • Transparency is retained when converting between formats that both support it
  • When trying to convert a transparent image to a format that does not support transparency, fall back to a suitable background
  • Animations are retained when converting between formats that support it, with a suitable fallback for formats that don't (e.g. the first frame only).
  • This functionality ships in an optional unsupported module.

Notes

  • We might run into problems later on if we don't have a way of saying "this image has a transparent background so don't try to provide a fallback to JPEG". Or "this image contains animations, so don't try to fall back to something that doesn't support animation". Might be worth deciding what we do in those scenarios before we go too far down this card.
  • Not sure if we should care about APNG.

Excludes

  • AVIF support
@GuySartorelli
Copy link
Member

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
Copy link
Member

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
Copy link
Contributor Author

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
Copy link
Member

GuySartorelli commented May 5, 2022

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
Copy link
Member

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
Copy link
Contributor Author

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.

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

No branches or pull requests

2 participants