[mapserver-users] jagged edges on images

chris_faulkner@anytimenow.com chris_faulkner@anytimenow.com
Fri, 14 Jun 2002 17:00:13 +0100 (GMT Daylight Time)


--------------Boundary-00=_DSDP4FCQENTS4WTFXFP0
Content-Type: text/plain; charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline

Hi

Sorry for the incorrect terminology.=20

I wouldn't want to store multiple copies of the data because our image da=
tabase is measured in terrabytes. The cost of the disk is not necessarily=
 of prime importance (although top-end robust, reliable, raid is not chea=
p when you buy that sort of quantity). The management issues of all those=
 files would come into play, though. I'd rather wait another fraction of =
a second for it to do the resampling every time, especially when the imag=
e is being served over the web and the slowest part of the process is muc=
h longer than that and is out of our control - the download ro the user's=
 device.


Chris

> Chris -
>=20
> In the example you sent, it's not downsampling, it's upsampling - the
> output image is at a higher resolution than the input image.  While
> there are alternatives, and it would be nice for MapServer to support
> more resampling options, doing that well really needs to wait for the
> 24-bit output support to be available.
>=20
> Why do you not want to store multiple copies of the data?  With multipl=
e
> copies you greatly reduce the amount of resampling that needs to be
> done, and I'm a big fan of precomputing everything you possibly can.
>=20
>  - Ed
>=20
>=20
> -----Original Message-----
> From: chris_faulkner@anytimenow.com
> [mailto:chris_faulkner@anytimenow.com]=20
> Sent: Friday, June 14, 2002 3:41 AM
> To: Ed McNierney
> Cc: chris_faulkner@anytimenow.com; mapserver-users@lists.gis.umn.edu
> Subject: RE: [mapserver-users] jagged edges on images
>=20
>=20
> Hi
>=20
> Yes - when I make sure that the input image resolution is the same as
> output,  the image looks OK.=20
>=20
> However, as my last email says, I do want to be able to  change scale
> without storing multiple copies of the data so it would be nice if the
> down-sampling operation could support an option of a higher quality
> alogorithm. IN this case, the output image might need to increase in
> depth, though - maybe MapServer wouldn't support that.
>=20
> Chris
>=20
>=20
> > Chris -
> >=20
> > This looks like an artifact of image scaling in the output image.
> > MapServer prudently uses a fast algorithm for scaling source input
> > images to produce the output result.  If you ask for an output image
> > whose pixel resolution (that is, meters per pixel, for example) is
> > different than the source image resolution, the source image has to b=
e
> > scaled.  Your sample image looks like an output image with a pixel
> > resolution slightly smaller than the input image.  For example, let's
> > assume your source image is at a resolution of 2 meters per pixel.
> Then
> > let's assume you asked for a 400 x 400 pixel output image from
> MapServer
> > with a spatial extent of 600 meters by 600 meters.  That means you
> want
> > the output pixels to be 1.5 meters per pixel.
> >=20
> > Since the output is "zoomed in" a bit, MapServer is being asked to=20
> > generate 400 output pixels (in each dimension) out of 300 input pixel=
s
>=20
> > (600 meters at 2 meters per pixel).  It will do that by duplicating=20
> > every third input pixel in the output, so if you had a row of pixels=20
> > with these values:
> >=20
> > 0 1 2 3 4 5
> >=20
> > you would get an output image with these values:
> >=20
> > 0 1 2 2 3 4 5 5
> >=20
> > Image then, that you had two single-pixel vertical lines in the sourc=
e
>=20
> > image.  In the output, the one at pixel position 2 would end up being=
=20
> > two pixels wide, while the identical input line at pixel position 4=20
> > would still be only one pixel wide in the output.  This will look=20
> > strange.
> >=20
> > In your specific example, you appear to have antialiased text in the=20
> > input image.  The intermediate-shaded pixels along the edge of the=20
> > text are sometimes replicated, giving the odd effect you see in the=20
> > words "Briar Patch".
> >=20
> > For optimum image quality without artifacts, keep the output image=20
> > resolution the same as the source resolution, or a multiple of 2x the=
=20
> > source resolution.  If you're going to be doing that often, consider=20
> > using GDAL and create overview images (preprocessed subsamples of the=
=20
> > source image) to avoid having to resample the source image over and=20
> > over again to serve map requests.
> >=20
> >  - Ed
> >=20
> > Ed McNierney
> > President and Chief Mapmaker
> > TopoZone.com / Maps a la carte, Inc.
> > 73 Princeton Street, Suite 305
> > North Chelmsford, MA  01863
> > ed@topozone.com
> > (978) 251-4242
> >=20
> > -----Original Message-----
> > From: chris_faulkner@anytimenow.com=20
> > [mailto:chris_faulkner@anytimenow.com]
> > Sent: Wednesday, June 12, 2002 6:14 PM
> > To: mapserver-users@lists.gis.umn.edu
> > Subject: [mapserver-users] jagged edges on images
> >=20
> >=20
> > Hello again
> >=20
> > I've been looking at some imagery being generated via PHP Mapscript.=20
> > On my imagery , jagged effects appear along some of the edges. The=20
> > jagged version from MapServer is attached. Look along the road=20
> > boundaries and the word "Briar Patch". Anyone know why this happens ?=
=20
> > These effects don't appear when I view and zoom in and out of the=20
> > source with ImageMagick. Here is the tiffinfo output. Note that I=20
> > started with tiled Tifs and converted to stripped - I have played wit=
h
>=20
> > different sized strips.
> >=20
> > TIFF Directory at offset 0x1255d6
> >   Image Width: 3500 Image Length: 3500
> >   Bits/Sample: 8
> >   Compression Scheme: PackBits
> >   Photometric Interpretation: palette color (RGB from colormap)
> >   FillOrder: msb-to-lsb
> >   Document Name: "Standard Input"
> >   Image Description: "converted PNM file"
> >   Orientation: row 0 top, col 0 lhs
> >   Samples/Pixel: 1
> >   Rows/Strip: 2
> >   Planar Configuration: single image plane
> >   Color Map: (present)
> >=20
> > If anyone needs it, I can send the original one but I didn't want to=20
> > waste too much bandwidth !
> >=20
> > Thanks
> >=20
> >=20
> > Chris
> >=20
> >=20
>=20
>=20

--------------Boundary-00=_DSDP4FCQENTS4WTFXFP0--