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

create Image from RGBA buffer #843

Open
Jeevhi opened this issue Aug 29, 2022 · 2 comments
Open

create Image from RGBA buffer #843

Jeevhi opened this issue Aug 29, 2022 · 2 comments

Comments

@Jeevhi
Copy link

Jeevhi commented Aug 29, 2022

Is there a way to create image from RGBA buffer and specifying parameters width, height, depth etc.

Currently I have modified gdImageCreateFromBmpPtr and gdImageCreateFromBmpCtx functions to take bmp_info_t as parameter. However would be nice if you can add a function, and export it.

Or am I overlooking something ?

@cmb69
Copy link
Contributor

cmb69 commented Aug 29, 2022

Is there a way to create image from RGBA buffer and specifying parameters width, height, depth etc.

No, because that specification isn't specfic enough. Is that really an RGBA buffer, or rather an ARGB buffer (or some other order)? What are the supported ranges for the color components (8bit for all of them; 16bit; or like libgd, i.e. 8bit for RGB and 7bit for A)? Is the layout row-first or column-first? Is there some specific padding? etc.

You can, however, write your own routine which creates a GdImage manually.

@vapier
Copy link
Member

vapier commented Aug 29, 2022

to put into concrete terms, if we started down the path of providing pixel converters, how many would we want to support? i don't know if there's a list somewhere that ranks "common" ones that we could use to decide when to stop.

ffmpeg supports a lot which leads to a ton of boilerplate.
https://github.com/FFmpeg/FFmpeg/blob/master/libavutil/pixfmt.h

at the very least, we could have an example program to convert RGBA of some bit depth and just point people to that to write their own.

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

3 participants