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

Use highest quality for JPEG and PNG images #2317

Closed
MegaChriz opened this issue Oct 25, 2022 · 0 comments · Fixed by #2318
Closed

Use highest quality for JPEG and PNG images #2317

MegaChriz opened this issue Oct 25, 2022 · 0 comments · Fixed by #2318

Comments

@MegaChriz
Copy link
Contributor

Is your feature request related to a problem? Please describe.

When inserting images in a Word document I sometimes find the quality of these images poor. Especially for JPEG files. I discovered that in src/PhpWord/Element/Image.php the function imagejpeg() is used for creating an image in the document. That function has a parameter called $quality. According to https://www.php.net/imagejpeg, a quality of about 75 is used as default for generating the jpeg. I find this value to be too low.

Describe the solution you'd like

The functions imagejpeg() and imagepng() have a parameter called $quality. I'd like PHPWord to pass a value for that parameter and default it to the maximum quality.

  • For imagejpeg(), the value for the maximum quality is 100.
  • For imagepng(), the value for the maximum quality is 0 (see https://www.php.net/imagepng).

Describe alternatives you've considered

None.

Additional context

Before (JPEG quality of 75 in Word document):
jpeg-image-quality-75

After (JPEG quality of 100 in Word document):
jpeg-image-quality-100

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

Successfully merging a pull request may close this issue.

1 participant