Discussion:
libpng error: image size exceeds user limits in IHDR
Alessandro Pasotti
2012-10-23 17:49:19 UTC
Permalink
hi All,

I'm in big troubles with a wierd error in python mapscript, the log
reports: libpng error: image size exceeds user limits in IHDR

image size is 256x256... using gif instead of png shows no errors (as
expected)... any idea?

the very same piece of code run fine on my testing machine, the error
is only on production server.

Mapserver version is 6.0.3, python 2.5 and the code is basically a
wrapper to WMS service, the error appears just after

map.OWSDispatch( req )

output format is set to AGGA:

OUTPUTFORMAT
NAME 'AGGA'
DRIVER AGG/PNG
IMAGEMODE RGBA
END

the complete call is

?LAYERS=track_1&TRANSPARENT=TRUE&FORMAT=image%2Fpng%3B%20mode%3D24bit&SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&STYLES=&EXCEPTIONS=application%2Fvnd.ogc.se_inimage&SRS=EPSG%3A900913&BBOX=0.0,5009377.0857,2504688.54285,7514065.62855&WIDTH=256&HEIGHT=256

It seems like wrong HEIGHT and WIDTH are passed to the raster buffer,
I've already checked that the map object has the right size after
OWSDispatch.

Thanks in advance for any help!
--
Alessandro Pasotti
w3: www.itopen.it
Andrea Peri
2012-10-23 18:38:28 UTC
Permalink
I see your bbox has 0 on xmin.

BBOX=0.0,5009377.0857,2504688.54285,7514065.62855

Is only a wrong copy on email ?
Post by Alessandro Pasotti
hi All,
I'm in big troubles with a wierd error in python mapscript, the log
reports: libpng error: image size exceeds user limits in IHDR
image size is 256x256... using gif instead of png shows no errors (as
expected)... any idea?
the very same piece of code run fine on my testing machine, the error
is only on production server.
Mapserver version is 6.0.3, python 2.5 and the code is basically a
wrapper to WMS service, the error appears just after
map.OWSDispatch( req )
OUTPUTFORMAT
NAME 'AGGA'
DRIVER AGG/PNG
IMAGEMODE RGBA
END
the complete call is
?LAYERS=track_1&TRANSPARENT=TRUE&FORMAT=image%2Fpng%3B%20mode%3D24bit&SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&STYLES=&EXCEPTIONS=application%2Fvnd.ogc.se_inimage&SRS=EPSG%3A900913&BBOX=0.0,5009377.0857,2504688.54285,7514065.62855&WIDTH=256&HEIGHT=256
It seems like wrong HEIGHT and WIDTH are passed to the raster buffer,
I've already checked that the map object has the right size after
OWSDispatch.
Thanks in advance for any help!
--
Alessandro Pasotti
w3: www.itopen.it
_______________________________________________
mapserver-users mailing list
http://lists.osgeo.org/mailman/listinfo/mapserver-users
--
-----------------
Andrea Peri
. . . . . . . . .
qwerty àèìòù
-----------------
Andrea Peri
2012-10-23 18:47:11 UTC
Permalink
Hi,

Perhaps something correlated to the bit of colors ? The GIF is a 256 only
color format.
Instead the png could be to million colors.

I use this :

IMAGETYPE PNG8
OUTPUTFORMAT
NAME "AGGA"
DRIVER AGG/PNG
MIMETYPE "image/png"
IMAGEMODE RGBA # need RGBA to have the transparent
EXTENSION "png"
FORMATOPTION "GAMMA=1.0"
FORMATOPTION "INTERLACE=true"
FORMATOPTION "QUANTIZE_DITHER=OFF"
FORMATOPTION "COMPRESSION=6" # Compression: 0=no compression, 9=best,
6=default compression
FORMATOPTION "QUANTIZE_FORCE=ON"
FORMATOPTION "QUANTIZE_COLORS=256"
TRANSPARENT ON
END

The most important thing is that the
FORMATOPTION "QUANTIZE_COLORS=256"

force the mapserver to give only the 256 better colors.

If the question is on the 256 color or million color perhaps this could
work.

Andrea.
Post by Alessandro Pasotti
hi All,
I'm in big troubles with a wierd error in python mapscript, the log
reports: libpng error: image size exceeds user limits in IHDR
image size is 256x256... using gif instead of png shows no errors (as
expected)... any idea?
the very same piece of code run fine on my testing machine, the error
is only on production server.
Mapserver version is 6.0.3, python 2.5 and the code is basically a
wrapper to WMS service, the error appears just after
map.OWSDispatch( req )
OUTPUTFORMAT
NAME 'AGGA'
DRIVER AGG/PNG
IMAGEMODE RGBA
END
the complete call is
?LAYERS=track_1&TRANSPARENT=TRUE&FORMAT=image%2Fpng%3B%20mode%3D24bit&SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&STYLES=&EXCEPTIONS=application%2Fvnd.ogc.se_inimage&SRS=EPSG%3A900913&BBOX=0.0,5009377.0857,2504688.54285,7514065.62855&WIDTH=256&HEIGHT=256
It seems like wrong HEIGHT and WIDTH are passed to the raster buffer,
I've already checked that the map object has the right size after
OWSDispatch.
Thanks in advance for any help!
--
Alessandro Pasotti
w3: www.itopen.it
_______________________________________________
mapserver-users mailing list
http://lists.osgeo.org/mailman/listinfo/mapserver-users
--
-----------------
Andrea Peri
. . . . . . . . .
qwerty àèìòù
-----------------
Alessandro Pasotti
2012-10-23 19:25:19 UTC
Permalink
Post by Andrea Peri
Hi,
Perhaps something correlated to the bit of colors ? The GIF is a 256 only
color format.
Instead the png could be to million colors.
Thanks for the hint, but I believe it's something related to the
libraries or the python bindings on the server: I have a copy which
works perfeclty locally, the OUTPUTFORMAT AGGA is working well here
but crashes on the server.

I suspect that the function

png_set_IHDR(png_ptr, info_ptr, rb->width, rb->height,...

get wrong width and height.
--
Alessandro Pasotti
w3: www.itopen.it
Alessandro Pasotti
2012-10-23 19:36:43 UTC
Permalink
Post by Alessandro Pasotti
Post by Andrea Peri
Hi,
Perhaps something correlated to the bit of colors ? The GIF is a 256 only
color format.
Instead the png could be to million colors.
Thanks for the hint, but I believe it's something related to the
libraries or the python bindings on the server: I have a copy which
works perfeclty locally, the OUTPUTFORMAT AGGA is working well here
but crashes on the server.
I suspect that the function
png_set_IHDR(png_ptr, info_ptr, rb->width, rb->height,...
get wrong width and height.
Forgot to mention that shp2img on the mapfile saved from the script
runs with no errors.
--
Alessandro Pasotti
w3: www.itopen.it
Alessandro Pasotti
2012-10-23 19:51:12 UTC
Permalink
Post by Alessandro Pasotti
Post by Andrea Peri
Hi,
Perhaps something correlated to the bit of colors ? The GIF is a 256 only
color format.
Instead the png could be to million colors.
Thanks for the hint, but I believe it's something related to the
libraries or the python bindings on the server: I have a copy which
works perfeclty locally, the OUTPUTFORMAT AGGA is working well here
but crashes on the server.
After recompiling gdal, mapserver, all python bindings and restart all
the server stack and caches the problem seems to be gone away (too
late to be sure, maybe the dawn of tomorrow will shed some light on
this nightmare).

I also had to remove
GDAL_LIBRARY_PATH = '/usr/local/lib/libgdal.so'
from the project (Django) settings, don't ask me why... the path was
absolutely correct.
--
Alessandro Pasotti
w3: www.itopen.it
Andrea Peri
2012-10-23 19:58:11 UTC
Permalink
Was a dynamic link ?
Perhaps an update of some library has put the mapserver out of sync ?
Post by Alessandro Pasotti
Post by Alessandro Pasotti
Post by Andrea Peri
Hi,
Perhaps something correlated to the bit of colors ? The GIF is a 256
only
Post by Alessandro Pasotti
Post by Andrea Peri
color format.
Instead the png could be to million colors.
Thanks for the hint, but I believe it's something related to the
libraries or the python bindings on the server: I have a copy which
works perfeclty locally, the OUTPUTFORMAT AGGA is working well here
but crashes on the server.
After recompiling gdal, mapserver, all python bindings and restart all
the server stack and caches the problem seems to be gone away (too
late to be sure, maybe the dawn of tomorrow will shed some light on
this nightmare).
I also had to remove
GDAL_LIBRARY_PATH = '/usr/local/lib/libgdal.so'
from the project (Django) settings, don't ask me why... the path was
absolutely correct.
--
Alessandro Pasotti
w3: www.itopen.it
--
-----------------
Andrea Peri
. . . . . . . . .
qwerty àèìòù
-----------------
Alessandro Pasotti
2012-10-24 07:19:53 UTC
Permalink
Post by Andrea Peri
Was a dynamic link ?
Perhaps an update of some library has put the mapserver out of sync ?
Yes, it could be the case.
--
Alessandro Pasotti
w3: www.itopen.it
Loading...