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

Convert AVIF to webp/jpeg if not supported by the browser #369

Open
grobitto opened this issue Dec 18, 2024 · 4 comments
Open

Convert AVIF to webp/jpeg if not supported by the browser #369

grobitto opened this issue Dec 18, 2024 · 4 comments
Assignees

Comments

@grobitto
Copy link

grobitto commented Dec 18, 2024

Is your feature request related to a problem? Please describe.
I would like to use AVIF files directly as a source in my CMS with webp server go, providing fallback for older browsers, but webp server does not convert AVIF to another format, even if browser is not supporting it.

Describe the solution you'd like
Webp server would convert AVIF to another format if not supported by the browser.

@grobitto
Copy link
Author

Actually the server will convert AVIF image to WEBP if webp is first in CONVERT_TYPES, but if avif is first - the image will be served as is even if the client does not support avif

@n0vad3v
Copy link
Member

n0vad3v commented Dec 18, 2024

Thanks for feedback, for this part:

Actually the server will convert AVIF image to WEBP if webp is first in CONVERT_TYPES, but if avif is first - the image will be served as is even if the client does not support avif

Seems like a bug to me, could you please share your configuration with me?

We're developing a new version that will handle issues like this(Original image cannot be used by visitor's browser, for example original image is AVIF/HEIC while the user's browser only supports WebP/JPG/PNG), there is a PR for this: #367.

@grobitto
Copy link
Author

Nice to hear about a new version, what is your time estimate?

Here is my config. If I put "webp" in front of "avif" in CONVERT_TYPES - my banner gets converted. But I want it to convert to webp only if user browser does not support avif

{
  "HOST": "0.0.0.0",
  "PORT": "3333",
  "QUALITY": "90",
  "IMG_PATH": "./pics",
  "EXHAUST_PATH": "./exhaust",
  "IMG_MAP": {},
  "ALLOWED_TYPES": ["jpg", "png", "jpeg", "bmp", "gif", "svg", "heic", "nef", "webp", "avif"],
  "CONVERT_TYPES": ["avif","webp"],
  "STRIP_METADATA": true,
  "ENABLE_EXTRA_PARAMS": false,
  "EXTRA_PARAMS_CROP_INTERESTING": "InterestingAttention",
  "READ_BUFFER_SIZE": 4096,
  "CONCURRENCY": 262144,
  "DISABLE_KEEPALIVE": false,
  "CACHE_TTL": 259200,
  "MAX_CACHE_SIZE": 0
}

@n0vad3v
Copy link
Member

n0vad3v commented Dec 27, 2024

@grobitto Thanks for more details, got it, seems like a bug.

This PR should be done in the following weeks, stay tuned. 😎

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

No branches or pull requests

2 participants