Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re^2: About GD Image Data Output Methods

by karlgoethebier (Abbot)
on Jun 07, 2015 at 19:01 UTC ( [id://1129366]=note: print w/replies, xml ) Need Help??


in reply to Re: About GD Image Data Output Methods
in thread About GD Image Data Output Methods [SOLVED]

Pure magic, especially this line:

my $bmp = pack 'a2 V V V l< l< l< v v V V l< l< V V', 'BM', $len + 54, 0, 54, 40, $attrs[1], $attrs[2], 1, 24, $len, 0, +0, 0, 0;

I tried it immediately but i can't view the file with various image processing software. In some it is simply black, some other reject it.

Examining the file i get:

karls-mac-mini:monks karl$ file mandelbrot.bmp mandelbrot.bmp: PC bitmap, Windows 3.x format, 1280 x 1024 x 24

This looks good, but:

karls-mac-mini:monks karl$ identify mandelbrot.bmp identify: unrecognized compression `mandelbrot.bmp'.

Or something is wrong with my GD installation. But i don't think so because the script would complain if something went wrong.

Thank you very much for advice. Perhaps you have a hint how to continue.

Best regards, Karl

«The Crux of the Biscuit is the Apostrophe»

Replies are listed 'Best First'.
Re^3: About GD Image Data Output Methods
by BrowserUk (Patriarch) on Jun 07, 2015 at 19:33 UTC

    Try this version:

    my $gd = $image->gd; my( undef, $width, $height, undef, undef ) = unpack 'nnnCV', substr( $ +gd, 0, 11, '' ); my $len = length( $gd ) / 4 * 3; my $bmp = pack 'a2 V V V l< l< l< v v V V l< l< V V', 'BM', $len + 54, 0, 54, 40, $width, -$height, 1, 24, 0, $len, 0, 0 +, 0; $bmp .= join'', unpack '(xaaa)*', $gd;

    Looks like I had two fields transposed; even though my image viewer didn't notice (or just didn't look).


    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

      Now i get: identify: Insufficient image data in file `mandelbrot.bmp'.

      «The Crux of the Biscuit is the Apostrophe»

        Hm. Both versions work with my image viewer. Can you make a copy of your image available to me in .gd & the converted format? Or attach them to an email to me?

        Are you using truecolor images?


        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

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1129366]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others romping around the Monastery: (4)
As of 2024-04-24 21:19 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found