[FWTools] help converting format

Benoît Andrieu bea at ixsea.com
Fri Feb 12 12:22:51 EST 2010


Oups, sorry, I made some mistakes...

So, first mistake, if you are using a command line you should only have 
one % and not two %%. On the contrary, if you are using a bat file, you 
should have two %%.
Next, I forgot a ~ in the DO syntax it should be %%~nxg and %%~ng.

So, from the command line, the correct syntax is :

    FOR %g in (C:\conversion_tif_bin\*.bing) DO gdal_translate -of JPEG
    "C:\conversion_tif_bin\%~nxg" "C:\conversion_tif_bin\%~ng.jpg"

I haven't looked at your image at the moment...

Regards,
Benoît Andrieu


Le 12/02/2010 16:18, Carlos Padovani a écrit :
> Dear Benoît,
> I am doing some thing wrong, but I do not know what.
> I am sending a figure "path" with the path and another figure 
> "FWTools_Shell_error" with the error message of the FWTools Shell. The 
> message of error is "%%g foi inesperado neste momento", it is in 
> Portuguese and means something like "%%g was unexpected at the 
> moment". You can see in the figure "FWTools_Shell_error" how I typed 
> the path and other data necessary. I would like more help on this if 
> possible.
> Sorry but I sent the wrong image. I am sending the right one now 
> "image1" with the data you required.
> No. of columns: 600
> No. of rows: 600
> No. of bands: 1 (gray)
> Data type: Binary 16-bit integer
> On Fri, Feb 12, 2010 at 12:39 PM, Benoît Andrieu <bea at ixsea.com 
> <mailto:bea at ixsea.com>> wrote:
>
>     Dear Carlos,
>
>     Yes, you should open a FWTools shell or set the FWTools path in
>     your PATH environment variable.
>     And yes, the command line should be executed in the directory
>     where your images are but you can easily customize his behaviour :
>
>         mkdir __your_path__\converted
>         FOR %%g in (__your_path__\*.tif) do gdal_translate -of JPEG
>         "__your_path__\%%nxg" "__your_path__\converted\%%ng.jpg"
>
>     The first line will create a new folder in your folder.
>
>     FOR %%g in (__your_path__*.tif)    ===> This will select all the
>     files in your directory and iterate with the %%g variable
>     "%%nxg"                            ===> n = name of the file
>     without its extension, x = extension of the file, g = the name of
>     the variable
>     "%%ng.jpg"                         ===> This will change the
>     extension of the file
>
>     Regarding the binary format, could you tell me more about the file
>     you sent ?
>     I would need its width, height, number of bands (gray, RGB, ARGB
>     ?) and the data type of each pixel (Byte, Int16, Float32 ?).
>     Thanks.
>     I would use the GenBin format too but unfortunately, GDAL is only
>     able to read them...
>
>     *_To the list :_*
>     You can find the file sent by Carlos at this address
>     http://benoit.andrieu.free.fr/00046agua.zip
>
>     Best regards,
>     Benoît Andrieu
>
>
>
>     Le 12/02/2010 13:06, Carlos Padovani a écrit :
>>     Dear Benoît,
>>     thanks very much for your fast response.
>>     I am not familiar with command line procedures, so could you
>>     explain in more details what should I do for to convert the tif
>>     images to other format?
>>     I will use this command line in the FWTools Shell? I need to
>>     wrote this command line in a directory where the images are?
>>     I took a look in the http://www.gdal.org/formats_list.html and I
>>     guess that the binary files I need to convert from tif are the
>>     Generic Binary (GenBin).
>>     I am sending an image file for you to take a look if
>>     you agree and maybe help me to identify if it is the same Generic
>>     Binary of gdal format list.
>>     Thanks once more.
>>     Carlos
>>     On Fri, Feb 12, 2010 at 10:04 AM, Benoît Andrieu <bea at ixsea.com
>>     <mailto:bea at ixsea.com>> wrote:
>>
>>         I don't know about binary formats but you should find what
>>         you want here : http://www.gdal.org/formats_list.html
>>
>>
>>         You can use a bat file to convert all files from a folder :
>>
>>             mkdir converted
>>             FOR %%g in (*.tif) do gdal_translate -of JPEG "%%nxg"
>>             "converted\%%ng.jpg"
>>
>>
>>         Regards,
>>         Benoît Andrieu
>>
>>
>>
>>         Le 12/02/2010 11:00, Carlos Padovani a écrit :
>>>         Dear users of FWTools,
>>>         I need to convert a lot of images form TIFF format to binary
>>>         format.
>>>         It is possible to do it in FWTools, but I do not know which
>>>         is the format available in the software that correspond to
>>>         binary format. Another thing is that in FWTools I can
>>>         convert the images one by one, and as I have a lot of images
>>>         to convert, I would like a way to convert a lot of images at
>>>         once. I use Windows WP as operacional system.
>>>         Could someone help me?
>>>         Thanks in advance.
>>>         Carlos
>>>
>>>
>>>         _______________________________________________
>>>         FWTools mailing list
>>>         FWTools at lists.maptools.org  <mailto:FWTools at lists.maptools.org>
>>>         http://lists.maptools.org/mailman/listinfo/fwtools
>>>         http://fwtools.maptools.org/
>>>            
>>
>>         _______________________________________________
>>         FWTools mailing list
>>         FWTools at lists.maptools.org <mailto:FWTools at lists.maptools.org>
>>         http://lists.maptools.org/mailman/listinfo/fwtools
>>         http://fwtools.maptools.org/
>>
>>
>>
>>
>>     -- 
>>     Carlos Padovani
>>     Pesquisador
>>     Embrapa Pantanal
>>     www.cpap.embrapa.br <http://www.cpap.embrapa.br/>
>>     SKYPE: carlos.padovani
>>     MSN:crpadovani at hotmail.com <mailto:MSN%3Acrpadovani at hotmail.com>
>>
>>
>
>
>
> -- 
> Carlos Padovani
> Pesquisador
> Embrapa Pantanal
> www.cpap.embrapa.br <http://www.cpap.embrapa.br>
> SKYPE: carlos.padovani
> MSN:crpadovani at hotmail.com <mailto:MSN%3Acrpadovani at hotmail.com>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.maptools.org/pipermail/fwtools/attachments/20100212/d31ee4ff/attachment.htm 


More information about the FWTools mailing list