Background
I have an interesting problem where I would like to be able to work with an image in Imagick, do some processing in GD, and then pass the image back to IMagick before finally writing it to disk. I know this sounds a bit indirect, but there is a reason: GD supports direct palette manipulation, making it possible to very quickly apply a color table to an 8-bit grayscale image. ImageMagick does support applying a color table to an image (, but instead of applying the color table directly to the image's palette, the image is converting into a 24-bit RGB image first, which is slow (viewtopic.php?f=1&t=13327).
To complicate things further, GD cannot read any of the formats that the images can be made to being with (RAW, TIFF, BMP and PGM), so I first have to read the image into IMagick and convert it to a PNG image, which GD can read.
In a nut-shell the process looks something like :
Code: Select all
PGM -> IMagick -> GD -> IMagick -> JPG
So what I would like to be able to do is to read the file in once and then just pass around something like a base-64 encoding string between GD and FFmpeg. So far though I haven't been able to find a way to do that. IMagick supports reading a binary string in (http://www.php.net/manual/en/function.i ... geblob.php), but how can I write one out? Is is possible use PHP output buffering to capture the image as a binary string?
Does anyone know if this is possible, or have any suggestions?
Any help would be appreciated
Thanks,
Keith