Home: Perl Programming Help: Win32 Programming Help:
Windows GD module creates corrupt png files



ulysses31
New User

Feb 6, 2008, 7:17 AM


Views: 8402
Windows GD module creates corrupt png files

Hi,

I'm pulling my hair out trying to find out what I'm doing wrong so any help would be appreciated. I am running WindowsXP and I've installed<span> Perl v5.8.8, built for MSWin32-x86-multi-thread. Binary build 822 [280952] provided by ActiveState. </span>

My problem is i want to use the GD::Simple module. I got the GD module for windows from ppm install http://theoryx5.uwinnipeg.ca/ppms/GD.ppd

Everything looked fine. I copied an example script from http://search.cpan.org/dist/GD/GD/Simple.pm and did a syntax check and everything was fine. When I run the script all I get is nonsense though. I tried outputting to *.png file instead, but the file is corrupt. I then tried creating a GIF and a JPEG but I have the same problems.

This is driving me bonkers. What am I doing wrong here? Any help would be much appreciated.


KevinR
Veteran


Feb 6, 2008, 11:48 AM


Views: 8401
Re: [ulysses31] Windows GD module creates corrupt png files

post the code you have been using. It may be that you need to use binmode() on the filehandle the image file gets printed to.
-------------------------------------------------


ulysses31
New User

Feb 6, 2008, 2:40 PM


Views: 8399
Re: [KevinR] Windows GD module creates corrupt png files

Hi Kevin,
Thanks a million for the fast reply and the solution, you're a legend, binmode() did the trick, works perfectly :)

B.


KevinR
Veteran


Feb 6, 2008, 2:43 PM


Views: 8397
Re: [ulysses31] Windows GD module creates corrupt png files

good old binmode to the rescue Smile
-------------------------------------------------