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

Split getSupportedFormats into getSupportedInputFormats and getSupportedOutputFormats #815

Open
alexander-schranz opened this issue Jan 27, 2022 · 2 comments

Comments

@alexander-schranz
Copy link
Contributor

alexander-schranz commented Jan 27, 2022

Description

I did see a new getSupportedFormats was added. Which I think is a great addition. I'm not sure if we should go with a general supportedFormats. As from my point of view there are 2 supportedFormats methods needed. One for inputFormats so which format I can in general read with that adapter and on for outputFormats which formats I can output. Example depending on the installed imagemagick libraries I can also read adobe files but can not output them, same for other vector files like svg can be read but not outputted

Example Interface changes:

/** @return string[] */
public function getSupportedInputFormats(): array;

/** @return string[] */
public function getSupportedOutputFormats(string $inputFormat = null): array;

Why?

Why we should implement something like this. As example I have the imagine imagick and imagine vips adapter installed. For all things I want to use the vips adapter aslong as the vips adapter support the specific inputFormat -> outputFormat if not I will fallback to the imagick adapter which supports more formats.

Another usecase is I want to use SVGImagine adapter to convert resize svg -> svg but when I need to convert svg->png I want to use the Imagick adapter.

@mlocati
Copy link
Collaborator

mlocati commented Jan 27, 2022

Yep, that'd be nice, but I don't think it's possible. For example, we know the formats supported by Imagick by using the Imagick::queryFormats() method, which doesn't give details about encoding/decoding capabilities...

@ausi
Copy link
Contributor

ausi commented Jan 27, 2022

which doesn't give details about encoding/decoding capabilities

But we could report them then for both, intput and output formats. And in the future we could add better checks if possible.

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

No branches or pull requests

3 participants