<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body text="#000000" bgcolor="#FFFFFF">
<div class="moz-cite-prefix">Mark,<br>
<br>
You could try doing a "gdalinfo -stats" to get the min/max pixel
values, then do a "gdal_translate -scale" to stretch the min/max
values to 0 255 (the full range of an 8-bit band).<br>
<br>
You may be able to do the same thing in mapserver by referencing
a GDAL vrt file with a LUT entry to do the exact same thing as the
above gdal_translate command, but it would be [almost] pointless
(and there would be a performance hit).<br>
<br>
<pre class="moz-signature" cols="72">Best Regards,
Brent Fraser</pre>
On 7/11/2013 8:07 AM, Mark Volz wrote:<br>
</div>
<blockquote
cite="mid:36CA828A36E29F45B7CF0A1766E5DFA31E30A4@swmail01.r8nssis.local"
type="cite">
<meta http-equiv="Content-Type" content="text/html;
charset=ISO-8859-1">
<meta name="Generator" content="Microsoft Word 14 (filtered
medium)">
<style><!--
/* Font Definitions */
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
p.MsoListParagraph, li.MsoListParagraph, div.MsoListParagraph
        {mso-style-priority:34;
        margin-top:0in;
        margin-right:0in;
        margin-bottom:0in;
        margin-left:.5in;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";}
span.EmailStyle17
        {mso-style-type:personal-reply;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-family:"Calibri","sans-serif";}
@page WordSection1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
        {page:WordSection1;}
/* List Definitions */
@list l0
        {mso-list-id:818615467;
        mso-list-type:hybrid;
        mso-list-template-ids:603481586 67698705 67698713 67698715 67698703 67698713 67698715 67698703 67698713 67698715;}
@list l0:level1
        {mso-level-text:"%1\)";
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-.25in;}
@list l0:level2
        {mso-level-number-format:alpha-lower;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-.25in;}
@list l0:level3
        {mso-level-number-format:roman-lower;
        mso-level-tab-stop:none;
        mso-level-number-position:right;
        text-indent:-9.0pt;}
@list l0:level4
        {mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-.25in;}
@list l0:level5
        {mso-level-number-format:alpha-lower;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-.25in;}
@list l0:level6
        {mso-level-number-format:roman-lower;
        mso-level-tab-stop:none;
        mso-level-number-position:right;
        text-indent:-9.0pt;}
@list l0:level7
        {mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-.25in;}
@list l0:level8
        {mso-level-number-format:alpha-lower;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-.25in;}
@list l0:level9
        {mso-level-number-format:roman-lower;
        mso-level-tab-stop:none;
        mso-level-number-position:right;
        text-indent:-9.0pt;}
ol
        {margin-bottom:0in;}
ul
        {margin-bottom:0in;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
<div class="WordSection1">
<p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">Richard,<o:p></o:p></span></p>
<p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">I
partially figured it out, but I still could use some help.
<o:p></o:p></span></p>
<p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">The
problem that I had was not with the created image itself,
but how ESRI displayed it. By default ArcMap uses no
stretch to display the SID image while it uses a percent
clip stretch for the created tif . After I changed the
stretch from percent clip to none the images appeared almost
the same, but there was still some differences. Next, I
changed the stretch to minimum-maximum on the created tif
image and I could not tell any difference between the sid
file and the tif image.<o:p></o:p></span></p>
<p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">Questions:<o:p></o:p></span></p>
<p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoListParagraph"
style="text-indent:-.25in;mso-list:l0 level1 lfo1"><!--[if !supportLists]--><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><span
style="mso-list:Ignore">1)<span style="font:7.0pt
"Times New Roman"">
</span></span></span><!--[endif]--><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">When
creating a tiff file in gdal_translate, can I adjust
settings so that the new image will appear exactly like the
old image without having to turn stretch to minimum-maximum?<o:p></o:p></span></p>
<p class="MsoListParagraph"
style="text-indent:-.25in;mso-list:l0 level1 lfo1"><!--[if !supportLists]--><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><span
style="mso-list:Ignore">2)<span style="font:7.0pt
"Times New Roman"">
</span></span></span><!--[endif]--><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">Is
there a way in mapserver to change the stretch from none to
minimum maximum (or other types of stretches if desired) and
if so is there a performance hit?<o:p></o:p></span></p>
<p class="MsoListParagraph"
style="text-indent:-.25in;mso-list:l0 level1 lfo1"><!--[if !supportLists]--><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><span
style="mso-list:Ignore">3)<span style="font:7.0pt
"Times New Roman"">
</span></span></span><!--[endif]--><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">Is
there a way to modify a tiff file so that any GIS program
including ArcGIS that opens up the file will use the correct
stretch type, or is there a setting within ArcGIS that will
always use a certain type of stretch when it opens up tiff
images?<o:p></o:p></span></p>
<p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">Thanks<o:p></o:p></span></p>
<p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">Mark
Volz, GISP<o:p></o:p></span></p>
<p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">GIS
Specialist<o:p></o:p></span></p>
<p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<div style="border:none;border-left:solid blue 1.5pt;padding:0in
0in 0in 4.0pt">
<div>
<div style="border:none;border-top:solid #B5C4DF
1.0pt;padding:3.0pt 0in 0in 0in">
<p class="MsoNormal"><b><span
style="font-size:10.0pt;font-family:"Tahoma","sans-serif"">From:</span></b><span
style="font-size:10.0pt;font-family:"Tahoma","sans-serif"">
Richard Greenwood [<a class="moz-txt-link-freetext" href="mailto:richard.greenwood@gmail.com">mailto:richard.greenwood@gmail.com</a>]
<br>
<b>Sent:</b> Wednesday, July 10, 2013 6:32 PM<br>
<b>To:</b> Mark Volz<br>
<b>Cc:</b> <a class="moz-txt-link-abbreviated" href="mailto:fwtools@lists.maptools.org">fwtools@lists.maptools.org</a><br>
<b>Subject:</b> Re: [FWTools] gdal translate - air
photo seems washed out after converting image<o:p></o:p></span></p>
</div>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<div>
<div>
<p class="MsoNormal">On Wed, Jul 10, 2013 at 3:08 PM,
Mark Volz <<a moz-do-not-send="true"
href="mailto:MarkVolz@co.lyon.mn.us" target="_blank">MarkVolz@co.lyon.mn.us</a>>
wrote:<o:p></o:p></p>
<p class="MsoNormal">Hello,<br>
<br>
I converted a mr sid air photo to a tif file. The
colors appear washed out and too bright compared to
the mr sid file.<br>
<br>
<br>
I would like to create an image file that has the
following three characteristics:<br>
<br>
1) Fast for Mapserver to read.<br>
2) Relatively the same size as the MrSID file. - I
would prefer a file size that is no larger than twice
the size of the Mr SID file, even if it means that I
have to take a small hit by using compression<br>
3) retains the same image quality as the original
MrSID file<br>
<br>
The following two commands made the image fast for
mapserver, and relatively small. But the colors were
washed out...<br>
<br>
c:\ms4w\apps\PipestoneMaps\Raster\Picto2013>gdal_translate
-CO TILED=YES -CO PHOTOMETRIC=YCBCR -CO TFW=YES -CO
COMPRESS=JPEG -CO BIGTIFF=YES MNPIPE13-SID-9INCH.sid
New.tif<br>
c:\ms4w\apps\PipestoneMaps\Raster\Picto2013>gdaladdo
-r average --config compress_overview JPEG --config
photometric_overview YCBCR New.tif 2 4 8 16 32 64 128
256<br>
<br>
<br>
What can I do to improve the image quality, while
retaining the speed and a moderate file size?<br>
<br>
Thanks<br>
<br>
Mark Volz, GISP<br>
GIS Specialist<o:p></o:p></p>
<div>
<p class="MsoNormal" style="margin-bottom:12.0pt"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal" style="margin-bottom:12.0pt">Mark,<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">Those are pretty much the
commands that I regularly use to prepare imagery for
mapserver. I have never experienced any noticeable
color distortion. What does it look like with a
straight
<br>
gdal_translate MNPIPE13-SID-9INCH.sid New.tif<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">obviously that's not what you
want for a final product, but it would be my first
step toward 'debugging' the problem.<br>
<br>
Rich<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"> <o:p></o:p></p>
</div>
</div>
<p class="MsoNormal"><br>
-- <br>
Richard Greenwood<br>
<a moz-do-not-send="true"
href="mailto:richard.greenwood@gmail.com">richard.greenwood@gmail.com</a><br>
<a moz-do-not-send="true"
href="http://www.greenwoodmap.com">www.greenwoodmap.com</a>
<o:p></o:p></p>
</div>
</div>
</div>
</div>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">_______________________________________________
FWTools mailing list
<a class="moz-txt-link-abbreviated" href="mailto:FWTools@lists.maptools.org">FWTools@lists.maptools.org</a>
<a class="moz-txt-link-freetext" href="http://lists.maptools.org/mailman/listinfo/fwtools">http://lists.maptools.org/mailman/listinfo/fwtools</a>
<a class="moz-txt-link-freetext" href="http://fwtools.maptools.org/">http://fwtools.maptools.org/</a>
</pre>
</blockquote>
<br>
</body>
</html>