www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - PNG Lib?

reply dsimcha <dsimcha yahoo.com> writes:
Is there any simple PNG lib that's:

1.  Written in pure D.

2.  Licensed under the Boost or zlib/libpng license, or some other license
that is open-source, non-copyleft and doesn't require binary attribution.

3.  Small enough that I could just copy/paste it into my Plot2Kill lib and
give credit, thus avoiding dependency hell?

4.  Doesn't necessarily have the best features or compression ratio in the
world.  The compression ratio just has to be decent and the features just have
to include writing an array of pixels to a PNG file.  I don't need anything
fancy.

I've got extracting pixels saving to .bmp files working in the DFL version of
Plot2Kill and, though GDI is inherently raster based and vector formats will
likely never be supported under DFL, I think the DFL version could be
considered decent if it at least supported PNG out of the box, instead of just
horribly wasteful BMP.  However, I don't want to force users to install yet
another dependency in addition to DFL and Plot2Kill, possibly one that
requires having a C compiler conveniently available.
Jul 24 2010
next sibling parent reply Adam Ruppe <destructionator gmail.com> writes:
Try mine.... but ahhhh! My computer died on my last Wednesday, and it
hosts my dcode too!

It is a few hundred lines of D that takes a pixel array and puts out a
simple png file. Does the bare minimum I needed to get the job done,
but sounds like that's exactly what you want.

My code sounds like it will work for you, but I might not be able to
get at it until the parts arrive to fix my main computer. That'll be
middle of next week. I'll look around on other servers I have access
to and see if I can't find an old version somewhere.

On 7/24/10, dsimcha <dsimcha yahoo.com> wrote:
 Is there any simple PNG lib that's:

 1.  Written in pure D.

 2.  Licensed under the Boost or zlib/libpng license, or some other license
 that is open-source, non-copyleft and doesn't require binary attribution.

 3.  Small enough that I could just copy/paste it into my Plot2Kill lib and
 give credit, thus avoiding dependency hell?

 4.  Doesn't necessarily have the best features or compression ratio in the
 world.  The compression ratio just has to be decent and the features just
 have
 to include writing an array of pixels to a PNG file.  I don't need anything
 fancy.

 I've got extracting pixels saving to .bmp files working in the DFL version
 of
 Plot2Kill and, though GDI is inherently raster based and vector formats will
 likely never be supported under DFL, I think the DFL version could be
 considered decent if it at least supported PNG out of the box, instead of
 just
 horribly wasteful BMP.  However, I don't want to force users to install yet
 another dependency in addition to DFL and Plot2Kill, possibly one that
 requires having a C compiler conveniently available.
Jul 24 2010
parent dsimcha <dsimcha yahoo.com> writes:
If you could send this stuff to me whenever your computer is working again, or
better yet post it to some repository for everyone, that'd be great.  My email
address that I actually check frequently but avoid giving out in places were
spambots may be present is name domain.com, where name = dsimcha and domain =
gmail.

== Quote from Adam Ruppe (destructionator gmail.com)'s article
 Try mine.... but ahhhh! My computer died on my last Wednesday, and it
 hosts my dcode too!
 It is a few hundred lines of D that takes a pixel array and puts out a
 simple png file. Does the bare minimum I needed to get the job done,
 but sounds like that's exactly what you want.
 My code sounds like it will work for you, but I might not be able to
 get at it until the parts arrive to fix my main computer. That'll be
 middle of next week. I'll look around on other servers I have access
 to and see if I can't find an old version somewhere.
 On 7/24/10, dsimcha <dsimcha yahoo.com> wrote:
 Is there any simple PNG lib that's:

 1.  Written in pure D.

 2.  Licensed under the Boost or zlib/libpng license, or some other license
 that is open-source, non-copyleft and doesn't require binary attribution.

 3.  Small enough that I could just copy/paste it into my Plot2Kill lib and
 give credit, thus avoiding dependency hell?

 4.  Doesn't necessarily have the best features or compression ratio in the
 world.  The compression ratio just has to be decent and the features just
 have
 to include writing an array of pixels to a PNG file.  I don't need anything
 fancy.

 I've got extracting pixels saving to .bmp files working in the DFL version
 of
 Plot2Kill and, though GDI is inherently raster based and vector formats will
 likely never be supported under DFL, I think the DFL version could be
 considered decent if it at least supported PNG out of the box, instead of
 just
 horribly wasteful BMP.  However, I don't want to force users to install yet
 another dependency in addition to DFL and Plot2Kill, possibly one that
 requires having a C compiler conveniently available.
Jul 24 2010
prev sibling parent reply BCS <none anon.com> writes:
Hello dsimcha,

 Is there any simple PNG lib that's:
 
http://www.dsource.org/projects/scrapple/wiki/LodePngLibrary
 1.  Written in pure D.
 
I think so.
 2.  Licensed under the Boost or zlib/libpng license, or some other
 license that is open-source, non-copyleft and doesn't require binary
 attribution.
Don't know.
 
 3.  Small enough that I could just copy/paste it into my Plot2Kill lib
 and give credit, thus avoiding dependency hell?
 
Depends on how small is small enought. -- ... <IXOYE><
Jul 24 2010
parent reply Eric Poggel <dnewsgroup yage3d.net> writes:
On 7/25/2010 12:26 AM, BCS wrote:
 Hello dsimcha,

 Is there any simple PNG lib that's:
http://www.dsource.org/projects/scrapple/wiki/LodePngLibrary
 1. Written in pure D.
I think so.
 2. Licensed under the Boost or zlib/libpng license, or some other
 license that is open-source, non-copyleft and doesn't require binary
 attribution.
Don't know.
 3. Small enough that I could just copy/paste it into my Plot2Kill lib
 and give credit, thus avoiding dependency hell?
Depends on how small is small enought.
If LodePng doesn't work, there's this actionscript library (http://code.google.com/p/as3corelib/source/browse/trunk/src/com/adobe/i ages/PNGEncoder.as) which probably wouldn't be too bad to port (~100 lines). It uses a gzip compress function (line 88) that's part of the standard actionscript library (http://www.adobe.com/livedocs/flash/9.0/ActionScriptLangRefV3/flash/utils/ByteArray.h ml#compress())--I'm not sure what's available in D.
Jul 25 2010
parent dsimcha <dsimcha yahoo.com> writes:
== Quote from Eric Poggel (dnewsgroup yage3d.net)'s article
 On 7/25/2010 12:26 AM, BCS wrote:
 Hello dsimcha,

 Is there any simple PNG lib that's:
http://www.dsource.org/projects/scrapple/wiki/LodePngLibrary
 1. Written in pure D.
I think so.
 2. Licensed under the Boost or zlib/libpng license, or some other
 license that is open-source, non-copyleft and doesn't require binary
 attribution.
Don't know.
 3. Small enough that I could just copy/paste it into my Plot2Kill lib
 and give credit, thus avoiding dependency hell?
Depends on how small is small enought.
If LodePng doesn't work, there's this actionscript library
(http://code.google.com/p/as3corelib/source/browse/trunk/src/com/adobe/images/PNGEncoder.as)
 which probably wouldn't be too bad to port (~100 lines).  It uses a gzip
 compress function (line 88) that's part of the standard actionscript
 library
(http://www.adobe.com/livedocs/flash/9.0/ActionScriptLangRefV3/flash/utils/ByteArray.html#compress())--I'm
 not sure what's available in D.
Thanks, but Adam Ruppe's code seems to do what I need and has already been integrated into Plot2Kill and checked in. (This means Plot2Kill now supports PNG on DFL.)
Jul 25 2010