-
Notifications
You must be signed in to change notification settings - Fork 762
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
Document imagebmp() bit depth #4339
Comments
On behalf of my employer, as a corporate officer with contract binding authority, I release the code in my preceding comment into the public domain. |
Makes generally sense to me (and thanks for the code :) I'm not sure whether the color depth should even be specified by the user; what happens if there are more colors in the palette (or in truecolor images). Anyhow, that would need first be addressed upstream, so please file an ticket there. |
Forwarded to libgd/libgd#911.
libgd uses a simple solution: truecolor images are stored as 24bit, palette images are stored as 8bit BMPs. I agree that this should be documented. |
I saw you opened the feature request upstream. Sorry, I've been out of the office for a trip. Is there anything else I can do to help with this? |
@mmellon, all good. I think I'll merge that PR in a while if there will be no further feedback. |
Description
We have a business case where we need PHP to return a 1-bit depth BMP image to the client. This is because the client is outputting the image to a thermal receipt printer which can only handle 1-bit or 4-bit depth images. The imagebmp() function does not currently have a parameter to specify the color depth; it probably should. The documentation did not specify what the color depth of the generated image was by default.
Ideally, it would be nice to have a function with the following signature:
imagebmp(GdImage $image, resource|string|null $file = null, bool $compressed = true, int $colorDepth = 24): bool
We worked around this issue by writing a user-defined function:
The text was updated successfully, but these errors were encountered: