go-pdfium
go-pdfium copied to clipboard
[Feature Request] Return image.Gray, when FPDF_RENDER_FLAG_GRAYSCALE is set
I'm using RenderPageInDPI() with the flag FPDF_RENDER_FLAG_GRAYSCALE, because I need a gray scale image.
The responses.RenderPageInDPI response returns an image.RGBA, which makes it necessary to convert to an image.Gray afterwards. This is a computationally intesive task.
Is it possible to return an image.Gray instead of an image.RGBA when FPDF_RENDER_FLAG_GRAYSCALE is set?
To me it seems like the main change is the creation of the image in renderPages. Here it needs to be image.NewGray(...) instead of image.NewRGBA(...).
Hi! It's sadly not that simple since the response struct expects an *image.RGBA, not image.Image, it does require a bit more work as well, but I think it can be done. Will look into it but it would probably require a new major version because of backwards incompatibility.