Save To Jpg/ compressed Png (not freeImage)
Blitz3D Forums/Blitz3D Programming/Save To Jpg/ compressed Png (not freeImage)
| ||
Hi, Does anyone know of some source or lib that alows you to save in some image format WITH compression; like JPG, PNG or even BMP with RLE compression? So far I've only found references to FreeImage.dll but am hoping there's something (legally) simpler and compacter than that... Thanks in advance, Danny |
| ||
FreeImage is completely legal to use, even in comercial projects. The clue's in the name. ;) |
| ||
sure, but i was hoping for something with a little less overhead. All I want is SaveJpg() - I have no need for the other functions, or the additional dll('s) to my package.. |
| ||
Well, the FreeImage dll I used was only 128k (dunno what size the latest version is). I also try and avoid adding too many DLLs to projects but FreeImage was one I was only too pleased to use, considering the enormous hassle it saved me. [edit]Considering Blitz3D itself uses FreeImage, I've never understood why blitz images can only be saved in BMP format. |
| ||
Blitz3D uses freeimage itself? errr. ok! Yes that's silly then that it doesn't support all the other formats and options... Thanks dude, already hacking freeimage into my source now ;) d. |
| ||
Ok, got freeimage working... then discover what looks like a bug in the RLE compression for BMP files! GREAT! Arhgk! :) |
| ||
Hmmm... where can you find freeimage.dll? |
| ||
Here's the last version of the dll (v3.9.3) http://freeimage.sourceforge.net/index.html This is the latest & most complete decls I could find in some of the other threads (was for FreeImage 3.8) you might also need: D. |
| ||
Ok, got freeimage working... then discover what looks like a bug in the RLE compression for BMP files! GREAT! Arhgk! You mean you can't get BMP images to load and/or save properly? |
| ||
No I can load/save them perfectly. Unless I use the BMP_SAVE_RLE setting on freeimage_save - to force RLE compression on an 8bit image. then the rle compression (i'm guessing it's got a bug) screws it up. The saved image will have large chuncks or corrupeted image in it, and any image viewer suddenly identifies it as being 32 bit! So I'm guessing some of the header or body information is corrupted. But without that BMP_SAVE_RLE flag, the image saves perfectly, 8 bit, etc. Albeit without compression of course.. And this RLE compresion is an absolute MUST for me :( And since I need it quick, there's a good chance i'll have to try and write my own tomorrow :/ d. |
| ||
That's a pain. It does surprise me a bug of this nature exists in FreeImage, though - it's been around for yonks and is widely used. Would have thought someone would've spotted and fixed that one, by now. Maybe it's just broken in the latest version. Giving an older version a try might be worth a go? |
| ||
I can imagine few (if anyone) would still be interested in 8bit images these days. I might be doing something wrong, but will all the demos and stuff I found I got a good feeling I'm doing it right.. Couldn't find any older versions of the dll itself. All the links I could find in old blitz threads are dead... Also posted a report on the freeImage forum but no response yet... [EDIT by the way, the RLE problem is only when using a 'transparent' background - that I want to use in blitz to overlay the image. So perhaps a different approach can bypass the problem.] d. |
| ||
Ok, I did figure out that the problem I'm having has to do with my background. It's mostly (90%) just purple (used as mask to later overlay on a something else). But Freeimage treats it as a transparent background I believe! Nonetheless, the images shows different in 3 different viewers! Only photoshop shows the image properly, whilst windows preview & acdsee screw up, show bars or chunks of black... keep diggin'... d. |
| ||
For the record, There WAS a bug in FreeImage's RLE compression for 8bit BMP's... This bug has been fixed, and the open sourcode updated (specifically PluginBMP.cpp). The distributed dll hasn't been updated/released yet, so you'll have to download the complete source code and compile a new FreeImage.dll yourself. See http://freeimage.sourceforge.net D. |