[Gdal-dev] RE: Urgent help needed with image conversion for the
JimGray search
Norman Vine
nhv at cape.com
Fri Feb 2 13:42:02 EST 2007
Forde, Sean writes:
>
> Friends - can I use gdal_translate to convert 11bit geotiff
> to jpeg? Can you tell me the command line arguments?
gdal_translate -scale 0 2047 -of JPEG $INFILE.tif $OUTFILE.jpgshould work
Note I like to use a non-linear scale as demonstrated in the following
Python code
####################
from PIL import Image
import numarray as NA
def ImageToArray(im,power=8):
""" """
cols = im.size[0]
rows = im.size[1]
r = NA.fromstring(im.tostring(),NA.UInt16)
#r = NA.clip(r,0,(2**power)-1)
r.shape = rows,cols
return r*(1.0/(2**power))
def ArrayToImage(arr,extents,max_pix=255.0,scale=1.0):
""" """
h = extents[0]
w = extents[1]
band = arr*(max_pix/scale)
return Image.fromstring('L',(w,h),(band.astype('b')).tostring())
img = Image.open("roi.1875402401.tif")
a = ImageToArray(img,11)
a = NA.exp(a)
a -= a.min()
a *= (1.0/a.max())
img = ArrayToImage(a,a.shape)
img.save("roi.1875402401.png","PNG")
#############################
Let me know if you need a hand translating these
Norman
>
> ________________________________
>
> From: owner-software at amazon.com
> [mailto:owner-software at amazon.com] On Behalf Of Vogels, Werner
> Sent: Friday, February 02, 2007 8:50 AM
> To: software at amazon.com
> Cc: turk-jim-gray at amazon.com
> Subject: Urgent help needed with image conversion for the Jim
> Gray search
>
>
> As you guys may know computer science icon Jim Gray
> disappeared at sea last Sunday, and the Coast Guard has not
> been able to find any trace. It is a complete mystery.
>
> We have started an effort to find him by getting access to
> satellite data with the intention to load it into Mechanical
> Turk, the turk team has worked deep into the night to make
> this happen.
>
> We have however hit an obstacle to which we have no answer:
> the image format is 16 bit panchromatic with on 11 bits used
> for data (tiff). If you view this in a regular viewer it will
> be pitch black. We'll need to run a conversion similar to
> what is described here:
>
> http://www.eurimage.com/products/qb_photoshop/photoshop.html
> <http://www.eurimage.com/products/qb_photoshop/photoshop.html>
>
> to get the images into a spectrum that is usable.
>
> Does any of you know of any automated tools or procedures
> that can make this happen?
>
> Some of the images can be found at: internal/~deflaux/JimGray
>
> --
> Werner
> <http://openphi.net/tenacious/>
>
More information about the Gdal-dev
mailing list