->gd is libgd's own internal format. It is unlikely to be recognised by any other graphics libraries or image converters.

It is a very simple format that consists of a 11 byte header (for truecolor) and the X-width * 4 * Y-height bytes of uncompressed image data.

A simple 10x10 (truecolor) image with a diagonal line of colored pixels constructed like this:

$i = GD::Image->new( 10, 10, 1 );; $i->setPixel( $_, $_, $_ ) for 0 .. 9;;

And then output as ->gd and unpacked as bytes :

$x = $i->gd;; print unpack 'C*', $x;;

looks like this (manully formatted):

255 254 ## (A sig of sorts) Low bit of second byte means tr +ue color 0 10 ## Width in pixels 0 10 ## height in pixels 1 ## Indicates no color table (Ie. a non-palette imag +e) 255 255 255 255 ## Seems to be a trailer block 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 ## X x Y x 4 bytes +(U32s) of rgba pixel data 0000 0001 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0002 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0003 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0004 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0005 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0006 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0007 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0008 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0009

It should not be hard to knock up Perl script that converts that to one of the ASCII image formats prevalent on *nix, and then convert that to png.

Note:Palleted images have two extra bytes in the header (not sure about the purpose); a 256 * 4-byte color table following the trailer block; and then width * 1-byte * height image data, where each byte value is an index into the color table.


With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority". I'm with torvalds on this
In the absence of evidence, opinion is indistinguishable from prejudice. Agile (and TDD) debunked

In reply to Re: About GD Image Data Output Methods by BrowserUk
in thread About GD Image Data Output Methods [SOLVED] by karlgoethebier

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.