SimpleImage icon indicating copy to clipboard operation
SimpleImage copied to clipboard

Add compression for BMP

Open fflnvb opened this issue 2 years ago • 1 comments

Hi, while using SimpleImage for creating BMP Files for my E-Paper Display I noticed that all BMP Files are being compressed by default with this class. While most file formats are offering a quality param, imagebmp() does not have that param but instead a boolean for compression. I guess adding a bool inside the param Quality would work regarding the result, but it would not really stick to the documentation and described data type, being an int.

Therefore I suggest making the following change for the SimpleImage Class seen below. Feel free to accept, modify wording etc. or reject it. I already work with that modified class locally :smile:

Here's the doc for imagebmp(): https://www.php.net/manual/de/function.imagebmp.php

fflnvb avatar Oct 21 '21 13:10 fflnvb

Following up on my answer to your comment: I guess my commit for the class can be purged. Instead we will need to update the README.md on lines 149, 159, 168, 177 as well as 186. As of now they all have the following description:

- $quality (int) - Image quality as a percentage (default 100). This argument has no effect on PNG images, since the format is lossless.

I would suggest the following addition at the end of these lines: Set to 0 for disabling compression on BMP images 0 instead of false because this is how we could keep the data type.

Would that be a good idea?

Edit: just saw your comment up there, so there needs to be also a change for describing the data type like: (int|bool) and then suggesting with Set to false...

fflnvb avatar Oct 26 '21 21:10 fflnvb

I should have replied here instead of using reactions since those don't send out notifications. Yes, the updated proposal seems like a good idea to me. Thanks!

claviska avatar Dec 05 '22 14:12 claviska

@claviska this PR can be closed and not merged since its solved in v4

bnomei avatar Mar 19 '23 19:03 bnomei

Thanks, @bnomei. Indeed, it looks like this has been resolved in 4.0.

claviska avatar Mar 20 '23 17:03 claviska