GD is an open source code library for the dynamic creation of images by programmers. GD is written in C, and “wrappers” are available for Perl, PHP and other languages. GD creates PNG, JPEG and GIF images, among other formats. GD is commonly used to generate charts, graphics, thumbnails, and most anything else, on the fly. While not restricted to use on the web, the most common applications of GD involve web site development.
See the GD website for more informations.
FS#61 — Add BMP support (Read/write)
Opened by D.Morph (dimorph) - Tuesday, 20 March 2007, 16:14 GMT+2
Last edited by Pierre Joye (Pierre) - Thursday, 28 February 2008, 00:29 GMT+2
|
DetailsFirst: sorry for the bad english! Bitmap can’t load correctly. PNG-Picture same as BMP-Picture (Create with GIMP and saved as .png and .bmp) PNG: working fine: gdImageSX=0×03; gdImageSY=0×02; BMP: gdImageSX=0×36; gdImageSY=0×00; BMP-SizeValue is wrong (examine with gdb/ddd/eclipse-cdt). The c++-code: [...]
FILE *in;
[...]
gdImagePtr im;
im = gdImageCreateFromPng(in);
if(im == NULL) im = gdImageCreateFromWBMP(in);
if(im == NULL)
{
cerr<<"No suitable Fileformat!"<<endl;
fclose(in);
exit(5);
}
[...]
|
test-bw-3x2.bmp
Hi,
Don’t worry :)
It looks like (yet) another WMBP variation. As far as I can see, type 78. GD does not support it.
I move this bug to a feature request and see what can be done to support this format.
Hi Pierre, from what I see the wmbp stuff is related to 'Wireless Bitmap' which is not Windows Bitmap as many folks think all the time (me too before I further checked). Although I found a pure PHP solution to read a Windows *.bmp bitmap and return a GD: http://www.jpexs.com/eng/default/php.html I'm not happy with this because its terrible slow....; therefore I digged again and looked into bmp2png C source: http://pmt.sourceforge.net/bmp2png/ since the code is free I think it might be a good candidate (and the only one I found so far) for inclusion into libgd; the BMP2PNG.C file contains a function 'static char *read_bmp( char *fn, FILE *fp, IMAGE *img )' which I think could probably be adapted easily...; the counterpart 'static char *write_bmp( char *fn, FILE *fp, IMAGE *img )' can be found in PNG2BMP.C... would be very great if you could take a look into that - I'm sure you would make many many users happy with including this feature into libgd, and finally into the php_gd extension !!
greetz, Guenter.
assing to Scott, he will work on a codec. The plan is to include BMP support in 2.1.0
By the way, FreeImage (dual license, BSD-like and GPL) provides many import/export filters, including BMP filters. The Source/FreeImage/PluginBMP.cpp filter could be adapted to libgd (it is a C++ file, but it does not use any C++-specific code, actually) - it seems to handle all BMP formats (with RLE decompression routines).
More generally, maybe other filters could be shared between FreeImage and GD ? FreeImage has plenty of import/export features, but is rather limited for drawing.
"By the way, FreeImage (dual license, BSD-like and GPL) provides many import/export filters, including BMP filters."
Not really, it is GPL and a commercial license. It is not acceptable for GD which has a true BSD-like license only.
" The Source/FreeImage/PluginBMP.cpp filter could be adapted to libgd (it is a C++ file, but it does not use any C++-specific code, actually) - it seems to handle all BMP formats (with RLE decompression routines)."
Scott is working on the BMP reader and writer, some come will be commited as soon as he thinks it is good enough. If you can help in one way or another, please contact him (it would be nice to discuss that on the mailing lists). However, please don't use other library codes, not if the license is (l)gpl-like or other limited license :)
Yes, true, but in many cases it is possible to ask for a relicensing or a dual licensing for specific libraries (in this case, the plugin was written by individuals that might accept relicensing under BSD-style). And if the relicensing is refused, then a rewrite is necessary.
Just a suggestion - rewriting from scratcn is possibly faster and simpler.
Set of BMP images (requested by Scott):
http://wvnvaxa.wvnet.edu/vmswww/bmp.html
Initial BMP support has been commited in gd/playground/gdbmp
thanks to Scott for his work!
Write support for uncompressed BMP has been added.
thanks again to Scott for his work!
This will be merged in shortly, it has been ready for a while now.
sorry, I have seen that I dont have send any feedback... It works!, Thank you very much.