digitalmars.D - bmp/png libs?
- Nick Sabalausky (2/2) May 13 2009 Can anyone suggest good up-to-date D libs or bindings for loading/saving...
- Stewart Gordon (11/13) May 14 2009 BMP - who in their right mind still uses this?
- Robert Fraser (2/3) May 14 2009 Yeah, zero-overhead; who needs that?
- BCS (3/9) May 14 2009 if you want zero overhead use PPM in binary mode: 32bit color and about ...
- Robert Fraser (2/13) May 14 2009 Yeah, but who's heard of that?
- Daniel Keep (7/11) May 14 2009 I've never seen BMP loading or saving code that didn't have to resort to
- Rainer Deyke (6/11) May 14 2009 BMP is the most popular uncompressed image format. Uncompressed file
- Nick Sabalausky (8/15) May 14 2009 Yea, this is pretty much the key. Even if nothing else, it's at least
- Rainer Deyke (7/13) May 14 2009 mp3 is the worst lossy lossy audio compression codec precisely because
- Nick Sabalausky (4/18) May 14 2009 Good point.
- Rainer Deyke (5/6) May 14 2009 Yes, to the extend that it was compressed at all. Each 16 bit sample
- Adam D. Ruppe (20/23) May 14 2009 I wrote a very minimal BMP class in D2 a while back. I didn't finish it
- Nick Sabalausky (8/30) May 14 2009 Thanks, I'll take a look. Although now that you mention it, I also have ...
- Adam D. Ruppe (37/37) May 16 2009 Well, I've been doing some more work on it today. The biggest new functi...
- div0 (5/9) May 14 2009 http://www.ssTk.co.uk/png.php
- Nick Sabalausky (7/16) May 14 2009 Ah, cool.
- Andrei Alexandrescu (3/26) May 14 2009 My enormous talent is exceeded only by my skill at creating one-liners.
- Daniel Keep (4/32) May 14 2009 Wouldn't that be "My enormous talent is exceeded only by my enormous
- Georg Wrede (2/32) May 16 2009 My enormous sarcasm is exceeded only by my enormous talent.
- div0 (6/39) May 16 2009 There should be some web comic that expresses the sinking feeling you
- div0 (4/27) May 14 2009 :) share and enjoy.
- div0 (7/20) May 14 2009 Thinking about it, if you do modify it for d1, send me the changed
- digited (2/6) May 16 2009 If you'll need more (formats for i/o or some processing), you can use De...
Can anyone suggest good up-to-date D libs or bindings for loading/saving bmp and png files?
May 13 2009
Nick Sabalausky wrote:Can anyone suggest good up-to-date D libs or bindings for loading/saving bmp and png files?BMP - who in their right mind still uses this? PNG - Lodepng is one http://www.dsource.org/projects/scrapple/wiki/LodePngLibrary but it depends on what you want to be able to do with PNGs. I'm not aware of any full-featured (beyond encoding/decoding of the actual image) PNG library yet. I'm sure there are also a handful of general image format libraries out there, but can't seem to find them at the moment. Maybe someone else can help.... Stewart.
May 14 2009
Stewart Gordon wrote:BMP - who in their right mind still uses this?Yeah, zero-overhead; who needs that?
May 14 2009
Reply to Robert,Stewart Gordon wrote:if you want zero overhead use PPM in binary mode: 32bit color and about ~16 bytes of non image data that can be output by printf.BMP - who in their right mind still uses this?Yeah, zero-overhead; who needs that?
May 14 2009
BCS wrote:Reply to Robert,Yeah, but who's heard of that?Stewart Gordon wrote:if you want zero overhead use PPM in binary mode: 32bit color and about ~16 bytes of non image data that can be output by printf.BMP - who in their right mind still uses this?Yeah, zero-overhead; who needs that?
May 14 2009
Robert Fraser wrote:Stewart Gordon wrote:I've never seen BMP loading or saving code that didn't have to resort to the Windows API. Even then, the code was horrible. TGA is a good format for when you just need to put pixels to disk. A single fixed-sized header out the front and then just dump the pixels. Think of it as the non-ass version of BMP that also supports 32-bit colour. -- DanielBMP - who in their right mind still uses this?Yeah, zero-overhead; who needs that?
May 14 2009
Stewart Gordon wrote:Nick Sabalausky wrote:BMP is the most popular uncompressed image format. Uncompressed file format + lzma compression leads to smaller file size than png + lzma compression. -- Rainer Deyke - rainerd eldwood.comCan anyone suggest good up-to-date D libs or bindings for loading/saving bmp and png files?BMP - who in their right mind still uses this?
May 14 2009
"Rainer Deyke" <rainerd eldwood.com> wrote in message news:guij2k$6sd$2 digitalmars.com...Stewart Gordon wrote:Yea, this is pretty much the key. Even if nothing else, it's at least useful *because* it's popular. In other words, the same reason why any audio app realisticlly needs to support MP3 even though MP3 is probably the single worst lossy audio codec out there (an assertion which, by the way, I would love to be proven wrong about, just you know, so I don't pop a vein every time I think about "average joe" and music players...).Nick Sabalausky wrote:BMP is the most popular uncompressed image format.Can anyone suggest good up-to-date D libs or bindings for loading/saving bmp and png files?BMP - who in their right mind still uses this?
May 14 2009
Nick Sabalausky wrote:Yea, this is pretty much the key. Even if nothing else, it's at least useful *because* it's popular. In other words, the same reason why any audio app realisticlly needs to support MP3 even though MP3 is probably the single worst lossy audio codec out there (an assertion which, by the way, I would love to be proven wrong about, just you know, so I don't pop a vein every time I think about "average joe" and music players...).mp3 is the worst lossy lossy audio compression codec precisely because it is so popular that it managed to kill off all of its competitors except those that have a strong advantage over mp3. You don't hear about au files or mp2 files anymore. -- Rainer Deyke - rainerd eldwood.com
May 14 2009
"Rainer Deyke" <rainerd eldwood.com> wrote in message news:guimbr$dem$1 digitalmars.com...Nick Sabalausky wrote:Good point. au was lossy?Yea, this is pretty much the key. Even if nothing else, it's at least useful *because* it's popular. In other words, the same reason why any audio app realisticlly needs to support MP3 even though MP3 is probably the single worst lossy audio codec out there (an assertion which, by the way, I would love to be proven wrong about, just you know, so I don't pop a vein every time I think about "average joe" and music players...).mp3 is the worst lossy lossy audio compression codec precisely because it is so popular that it managed to kill off all of its competitors except those that have a strong advantage over mp3. You don't hear about au files or mp2 files anymore.
May 14 2009
Nick Sabalausky wrote:au was lossy?Yes, to the extend that it was compressed at all. Each 16 bit sample was independently reduced to 8 bits using a logarithmic scale. -- Rainer Deyke - rainerd eldwood.com
May 14 2009
On Wed, May 13, 2009 at 11:35:03PM -0400, Nick Sabalausky wrote:Can anyone suggest good up-to-date D libs or bindings for loading/saving bmp and png files?I wrote a very minimal BMP class in D2 a while back. I didn't finish it so IIRC it only supports 24 and maybe 8 bit bitmaps, but it worked for what I needed it for - Paint can read and write those formats too. Looking at the code, oh foo, it saves but doesn't load. I have C code that can load 8 and 24 bit though. Probably not super useful, but it is simple, so maybe it will help. Here's a link. Includes both the D and C files. Look at the bottom of each file for an example main(). Other than that, there are no docs, but the function names should be fairly self-explanatory. http://arsdnet.net/bmpstuff.zip I didn't put a copyright notice in the files, but I release them into the public domain, so do whatever you want with it. With the weekend coming up, I'll hopefully have the time to go back and finish / improve / document that code and I'll update the zip and post another message to the group then if anyone is interested. Let me know if it is at all useful. -- Adam D. Ruppe http://arsdnet.net
May 14 2009
"Adam D. Ruppe" <destructionator gmail.com> wrote in message news:mailman.70.1242352289.13405.digitalmars-d puremagic.com...On Wed, May 13, 2009 at 11:35:03PM -0400, Nick Sabalausky wrote:Thanks, I'll take a look. Although now that you mention it, I also have some old C code somewhere that handles BMP (at least loading anyway, and PCX too, in fact (remember that?) ). But I have a suspicion that reading/understanding/adapting yours, even if it's not cleaned up, will probably be easier than digging out and porting my old stuff :) Also, thanks for eveyone else's advice.Can anyone suggest good up-to-date D libs or bindings for loading/saving bmp and png files?I wrote a very minimal BMP class in D2 a while back. I didn't finish it so IIRC it only supports 24 and maybe 8 bit bitmaps, but it worked for what I needed it for - Paint can read and write those formats too. Looking at the code, oh foo, it saves but doesn't load. I have C code that can load 8 and 24 bit though. Probably not super useful, but it is simple, so maybe it will help. Here's a link. Includes both the D and C files. Look at the bottom of each file for an example main(). Other than that, there are no docs, but the function names should be fairly self-explanatory. http://arsdnet.net/bmpstuff.zip I didn't put a copyright notice in the files, but I release them into the public domain, so do whatever you want with it. With the weekend coming up, I'll hopefully have the time to go back and finish / improve / document that code and I'll update the zip and post another message to the group then if anyone is interested. Let me know if it is at all useful.
May 14 2009
Well, I've been doing some more work on it today. The biggest new function is BMP.display(), which pops up a window displaying the bmp on the screen. I also cleaned up the code a little, put in a preliminary load from file function, and added some ddocs. Download here: http://arsdnet.net/bmpstuff.zip DDoc here: http://arsdnet.net/bmp.html See also the bottom of bmp.d for some examples (also see the commented code in that main function). A short example program: ---- import bmp; void main() { auto i = new BMP("picture.bmp"); // note this MUST be a 24 bit bmp i.display(); // show it on screen! i.setPixel(10, 10, Color(255,255,255)); // add a white pixel at 10,10 i.save("hacked.bmp"); // save it back to a file } ------- Writing to a file is useful, but showing it right there is really cool. The display function I've written is still somewhat buggy and is very slow on X11, but works reasonably well on Windows. (I really need to brush up on my xlib.) But what I imagine this being useful for is whipping up quick graphs and such. Saving to a bmp is fun, but this seems useful too. I also had to read the PNG spec yesterday for work, and am starting on adding basic png read/write support too. I already have the chunks read into D structs for easy processing (not in that zip), but haven't coded the compression, so it can't actually work with the image data. I probably won't get around to finishing this until at least next weekend. Off topic: I also have some D + C code for playing and doing light work with .wav and .mid files too. As I have the time, I'll see about posting that somewhere too. These basic file formats are nice things to have. -- Adam D. Ruppe http://arsdnet.net
May 16 2009
Nick Sabalausky wrote:Can anyone suggest good up-to-date D libs or bindings for loading/saving bmp and png files?http://www.ssTk.co.uk/png.php Import is for d2, but changing it for d1 would be trivial. -- My enormous talent is exceeded only by my outrageous laziness.
May 14 2009
"div0" <div0 users.sourceforge.net> wrote in message news:guirpq$m70$1 digitalmars.com...Nick Sabalausky wrote:Ah, cool.Can anyone suggest good up-to-date D libs or bindings for loading/saving bmp and png files?http://www.ssTk.co.uk/png.php Import is for d2, but changing it for d1 would be trivial.-- My enormous talent is exceeded only by my outrageous laziness.Heh, I'm gonna have to steal that line, but slightly changed (disclaimer: this is not intended as an insult to you (only an insult to me ;) )): "My enormous talent is exceeded only by my sheer arrogance." (Again, that's not intended as a jab at you, I just think that line would be hilarious :) )
May 14 2009
Nick Sabalausky wrote:"div0" <div0 users.sourceforge.net> wrote in message news:guirpq$m70$1 digitalmars.com...My enormous talent is exceeded only by my skill at creating one-liners. Andrei (succumbing to infinite recursion)Nick Sabalausky wrote:Ah, cool.Can anyone suggest good up-to-date D libs or bindings for loading/saving bmp and png files?http://www.ssTk.co.uk/png.php Import is for d2, but changing it for d1 would be trivial.-- My enormous talent is exceeded only by my outrageous laziness.Heh, I'm gonna have to steal that line, but slightly changed (disclaimer: this is not intended as an insult to you (only an insult to me ;) )): "My enormous talent is exceeded only by my sheer arrogance." (Again, that's not intended as a jab at you, I just think that line would be hilarious :) )
May 14 2009
Andrei Alexandrescu wrote:Nick Sabalausky wrote:Wouldn't that be "My enormous talent is exceeded only by my enormous talent."? -- Daniel"div0" <div0 users.sourceforge.net> wrote in message news:guirpq$m70$1 digitalmars.com...My enormous talent is exceeded only by my skill at creating one-liners. Andrei (succumbing to infinite recursion)Nick Sabalausky wrote:Ah, cool.Can anyone suggest good up-to-date D libs or bindings for loading/saving bmp and png files?http://www.ssTk.co.uk/png.php Import is for d2, but changing it for d1 would be trivial.-- My enormous talent is exceeded only by my outrageous laziness.Heh, I'm gonna have to steal that line, but slightly changed (disclaimer: this is not intended as an insult to you (only an insult to me ;) )): "My enormous talent is exceeded only by my sheer arrogance." (Again, that's not intended as a jab at you, I just think that line would be hilarious :) )
May 14 2009
Daniel Keep wrote:Andrei Alexandrescu wrote:My enormous sarcasm is exceeded only by my enormous talent.Nick Sabalausky wrote:Wouldn't that be "My enormous talent is exceeded only by my enormous talent."?"div0" <div0 users.sourceforge.net> wrote in message news:guirpq$m70$1 digitalmars.com...My enormous talent is exceeded only by my skill at creating one-liners. Andrei (succumbing to infinite recursion)Nick Sabalausky wrote:Ah, cool.Can anyone suggest good up-to-date D libs or bindings for loading/saving bmp and png files?http://www.ssTk.co.uk/png.php Import is for d2, but changing it for d1 would be trivial.-- My enormous talent is exceeded only by my outrageous laziness.Heh, I'm gonna have to steal that line, but slightly changed (disclaimer: this is not intended as an insult to you (only an insult to me ;) )): "My enormous talent is exceeded only by my sheer arrogance." (Again, that's not intended as a jab at you, I just think that line would be hilarious :) )
May 16 2009
Georg Wrede wrote:Daniel Keep wrote:There should be some web comic that expresses the sinking feeling you get went you come to suspect that your usenet sig will be the most important contribution you make to the world. :P -- My enormous talent is exceeded only by my outrageous laziness.Andrei Alexandrescu wrote:My enormous sarcasm is exceeded only by my enormous talent.Nick Sabalausky wrote:Wouldn't that be "My enormous talent is exceeded only by my enormous talent."?"div0" <div0 users.sourceforge.net> wrote in message news:guirpq$m70$1 digitalmars.com...My enormous talent is exceeded only by my skill at creating one-liners. Andrei (succumbing to infinite recursion)Nick Sabalausky wrote:Ah, cool.Can anyone suggest good up-to-date D libs or bindings for loading/saving bmp and png files?http://www.ssTk.co.uk/png.php Import is for d2, but changing it for d1 would be trivial.-- My enormous talent is exceeded only by my outrageous laziness.Heh, I'm gonna have to steal that line, but slightly changed (disclaimer: this is not intended as an insult to you (only an insult to me ;) )): "My enormous talent is exceeded only by my sheer arrogance." (Again, that's not intended as a jab at you, I just think that line would be hilarious :) )
May 16 2009
Nick Sabalausky wrote:"div0" <div0 users.sourceforge.net> wrote in message news:guirpq$m70$1 digitalmars.com...:) share and enjoy. -- My enormous talent is exceeded only by my outrageous laziness.Nick Sabalausky wrote:Ah, cool.Can anyone suggest good up-to-date D libs or bindings for loading/saving bmp and png files?http://www.ssTk.co.uk/png.php Import is for d2, but changing it for d1 would be trivial.-- My enormous talent is exceeded only by my outrageous laziness.Heh, I'm gonna have to steal that line, but slightly changed (disclaimer: this is not intended as an insult to you (only an insult to me ;) )): "My enormous talent is exceeded only by my sheer arrogance." (Again, that's not intended as a jab at you, I just think that line would be hilarious :) )
May 14 2009
Nick Sabalausky wrote:"div0" <div0 users.sourceforge.net> wrote in message news:guirpq$m70$1 digitalmars.com...Thinking about it, if you do modify it for d1, send me the changed version and I'll merge it with a version block. Got a version of jpeg6b & freeType as well. I'll upload them later once ftp access stops being a pig. -- My enormous talent is exceeded only by my outrageous laziness.Nick Sabalausky wrote:Ah, cool.Can anyone suggest good up-to-date D libs or bindings for loading/saving bmp and png files?http://www.ssTk.co.uk/png.php Import is for d2, but changing it for d1 would be trivial.
May 14 2009
Nick Sabalausky Wrote:Can anyone suggest good up-to-date D libs or bindings for loading/saving bmp and png files?If you'll need more (formats for i/o or some processing), you can use DerelictIL/ILU bindings + DevIL free lib. This lib seems to be the best bicycle of that sort, you actually don't have to write image io *again*.
May 16 2009