Opened 4 years ago

Closed 4 years ago

#127 closed defect (fixed)

Error delivering a PNG raster layer

Reported by: Holger Albert Owned by: Jeff McKenna
Priority: major Milestone: 3.2.3 release
Component: MS4W - Base Version: 3.2.2
Keywords: Cc: oldbucsfan
Blocked By: Blocking:


Hello Mapserver-Team,

I have encountered an error with the current 3.2.2 release. I have a map file containing a layer with a png file as data. Whenever I try to request the layer to be drawn (either via WMS or directly with the mapserv.exe) I get a emtpy PNG result.

After digging further I have found the following error message:
drawGDAL(): Unable to access file. GDALDatasetRasterIO() failed: libpng: bad parameters to zlib

I build a test case to reproduce the error.
The test case consists of a "test.bat", the epsg-file and the map-file (with data).
In the test folder (next to the test.bat), I copied the whole cgi-bin folder of your release.
Then executing the "test.bat" generates a png-file and a test.log as result.

The paths within the "test.bat" and the map-file refer to "C:\test". I was not sure, how to make them relative.

My OS is Windows 7.

Because I could not solve the error, I tried previous versions. The error seems to be connected to the 3.2.X release.

The 3.1.4 release worked. You can test it with the same test case.

Hope that helps finding the problem.

Best regards,
Holger Albert

Attachments (1) (3.7 KB ) - added by Jeff McKenna 4 years ago.
small test case

Download all attachments as: .zip

Change History (11)

comment:1 by Holger Albert, 4 years ago

Sadly I could not attach the test case. I got the following errors from trac:


Trac hat einen internen Fehler festgestellt:

IndexError: pop from empty list


Die Aktion, die den Fehler ausgelöst hat, war:

GET: /attachment/ticket/127/


comment:2 by Jeff McKenna, 4 years ago

@albert can you upload your test case to DropBox and provide the link here?

comment:3 by Jeff McKenna, 4 years ago

In your test case, no need to include cgi-bin copy, as this is for MS4W (which includes all of that); just include your mapfile and data, zip that together and provide me the link to that zipfile. Thanks,

comment:4 by Holger Albert, 4 years ago

Hello jmckenna,

thanks for your response.

I uploaded the test case to our server. You can download it here:

I did not intend to include the "cgi-bin" folder :-). Sorry for that misunderstanding.

To execute the test case, please copy the contents of the "cgi-bin" folder to the "test" folder, contained in the zip file. Then execute the "test.bat". As mentioned the paths within the bat and the map file are absolute and refer to "C:\test".

Best regards,
Holger Albert

Last edited 4 years ago by Holger Albert (previous) (diff)

by Jeff McKenna, 4 years ago

Attachment: added

small test case

comment:5 by Jeff McKenna, 4 years ago

Thanks. For the record, I used your test case to create an even more simple test (without copying anything, as MS4W has all parts included). Attached.

comment:6 by oldbucsfan, 4 years ago

I had the same problem with receiving a png WMS result. When I switched to jpeg, it worked fine. PNG won't though. (Wonder if this is at all related to #130 that I posted.)

Edit: To clarify... I was trying to receive WMS layers from two other server. Those servers were serving png layers just fine (worked properly when pasting link directly in browser). However, when placing the WMS layers (image/png) in the mapfile, they would show up as blank layers. When I changed the layers to image/jpeg, they worked fine.

Last edited 4 years ago by oldbucsfan (previous) (diff)

comment:7 by Jeff McKenna, 4 years ago

Cc: oldbucsfan added

Update: this was a difficult issue. The PNG support uses the zlib library, and there was a conflict between GDAL's internal zlib, and the external zlib used in the MS4W builds. To avoid this I now dump/delete the /frmts/zlib/ folder before compiling GDAL.

Please test a new beta with this fix, and report here if successful or not:

comment:8 by Holger Albert, 4 years ago

Hello jmckenna,

thanks for your work. I was not able to get the beta version running on my system.

Either in my test (using mapserv.exe) and after setting all paths in your simplyfied one (using shp2img.exe) I get the error message:

Der Prozedureinsprungpunkt "CreateFile2" wurde in der DLL "KERNEL32.dll" nicht gefunden.

Translated that means:

The procedure entry point "CreateFile2" could not be located in dll "KERNEL32.dll".

My System is Windows 7 Professional 64 Bit.

Holger Albert

Last edited 4 years ago by Holger Albert (previous) (diff)

comment:9 by Jeff McKenna, 4 years ago

Thanks for your feedback Holger, I can reproduce that issue here on older systems.

comment:10 by Jeff McKenna, 4 years ago

Resolution: fixed
Status: newclosed

Today's MS4W 3.2.3 release solves the issue with Windows 7.

Note: See TracTickets for help on using tickets.