Saâd,<br><br>Gamma correction is more related to displaying the data than the data itself.<br>You can, however, modify the contrast and brightness of the dataset.<br><br>Using LUT is not hard to learn as long as you know what you want.<br>
A simple method is the stretch the data linearly along the whole range.<br>For that, your LUT element looks like this:<br><pre style="font-family:courier new,monospace" class="fragment">&lt;LUT&gt;[src value 1]:[dest value 1],[src value 2]:[dest value 2]&lt;/LUT&gt;</pre>
There are only four values.<br>src value 1: This should be the least value of the pixels in the source raster band.<br>src value 2: This should be the greatest value of the pixels in the source raster band.<br>dest value 1: This should be the least value the data type of the raster band can hold. That would usually be zero.<br>
dest value 2: This should be the greatest value the data type of the raster band can hold. That would be 255, 65535 and 4294967295 for 8bit, 16bit and 32bit raster bands.<br><br>The VRT driver calculates the intermediate values. The result here would be similar to using the scale ratio and offset parameters.<br>
<br><div class="gmail_quote">On Tue, Mar 20, 2012 at 9:25 PM, Saâd HESSANE <span dir="ltr">&lt;<a href="mailto:saad.hessane@gmail.com">saad.hessane@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hi list,<br><br>I use gdal_translate to convert 16bits images to 8bits images. The gdal_translate have the -scale argument to specify the convertion range (source-&gt;destination).<br>If I change the destination range (dst_min and dst_max), I can do manually a brightness correction (also a contrast correction).<br>

<br>But is there any way to do that with a Photoshop like method?<br>For example set a brightness to -50, a contrast to +8 and let gdal_translate do the job ?<br><br>Also can I apply a gamma correction?<br><br>I saw the VRT format and there&#39;s a way to apply a LUT. But I don&#39;t think a LUT of 65536 values is the best way to apply the correction.<br>

<br>Also the VRT have the scale ratio and scale offset elements. I think it can be useful but I don&#39;t understand how use it...<br><br>So simply put, my question : can I do a contrast, brightness or gamma correction to a raster with gdal?<br>

<br>Thank you !<br><br>PS : <span lang="en"><span>I apologize for</span> <span>my</span> <span>broken English</span><span> !<br></span></span>
<br>_______________________________________________<br>
gdal-dev mailing list<br>
<a href="mailto:gdal-dev@lists.osgeo.org">gdal-dev@lists.osgeo.org</a><br>
<a href="http://lists.osgeo.org/mailman/listinfo/gdal-dev" target="_blank">http://lists.osgeo.org/mailman/listinfo/gdal-dev</a><br></blockquote></div><br><br clear="all"><br>-- <br>Best regards,<br>Chaitanya kumar CH.<br>
<br>+91-9494447584<br>17.2416N 80.1426E<br>