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

Improve background colour rendering #3

Open
Synchro opened this issue Nov 4, 2020 · 0 comments
Open

Improve background colour rendering #3

Synchro opened this issue Nov 4, 2020 · 0 comments

Comments

@Synchro
Copy link
Owner

Synchro commented Nov 4, 2020

The current process for creating the waveform image is not ideal.

FFMpeg saves the waveform image as a transparent PNG file. We that read that file back in, and use the Spatie Image package to fill in the background before optimising and resaving back into the same PNG file. This background filling process isn't quite the right operation, and the waveform ends up with some white fringing against the background colour, though it doesn't look too terrible.

A better approach would be to generate an image filled with the background colour, then overlay the waveform on top if it, all in memory without having to save to an intermediate file. This would also eliminate the fringing.

We are missing two things though:

  • The PHP FFMpeg package doesn't have the ability to extract a GD or Imagick image instance, only to save to a file
  • The Spatie Image library isn't much use for creating images from scratch

So fixing this will probably also involve PRs on FFMPeg, and probably using some other image library to do the compositing.

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

1 participant