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

Change color depth in png images after saving #65

Open
degorych opened this issue May 5, 2020 · 2 comments
Open

Change color depth in png images after saving #65

degorych opened this issue May 5, 2020 · 2 comments
Labels
status:ready for adoption Feel free to implement this issue. type:enhancement Enhancement

Comments

@degorych
Copy link

degorych commented May 5, 2020

When I upload a png picture, it has a color depth of 8 bits and a size of 0.3 mb. After saving, the color depth becomes 32 bits, and the size with a maximum compression of 0.7 mb.

What steps will reproduce the problem?

  1. Create upload image form
  2. Add image saving code in the controller action
$file = UploadedFile::getInstanceByName('file');
Image::getImagine()->open($file->tempName)
    ->save('path/to/destination/image.png', ['png_compression_level' => 9]);
  1. Upload any phg image with 8 bit color depth and save it.

What's expected?

Expected png image with 8 bit color depth and it will be compressing

What do you get instead?

Get png image with 32 bit color depth and it has more size then first image.

Additional info

Q A
Yii version 2.0.15.1
Imagine version 2.2.0
PHP version 7.2
Operating system ubuntu 18.04
@samdark
Copy link
Member

samdark commented May 7, 2020

Any idea on how to fix it?

@samdark samdark added the type:enhancement Enhancement label May 7, 2020
@degorych
Copy link
Author

degorych commented May 7, 2020

Solution for Imagick may be here here

@samdark samdark added the status:ready for adoption Feel free to implement this issue. label May 10, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status:ready for adoption Feel free to implement this issue. type:enhancement Enhancement
Projects
None yet
Development

No branches or pull requests

2 participants