Minimalistic Fortran GeoTIFF module, with sintax inspired on LIBTIFF C-Library.
Open/close file:
-
TIFF_Open (iunit, fileName, 'r', tiff, ierror)
-
TIFF_Close (tiff)
Read commands:
-
TIFF_Get_Tag_Value (tiff, tagId, value)
-
TIFF_Get_Image (tiff, *nimg, image)
-
GTIFF_Get_Key_Value(tiff, keyId, value)
-
GTIFF_Get_Image_Coordinates(tiff, *nimg*, x, y)
Write commands:
-
TIFF_Set_Tag_Value (tiff, tagId, value)
-
TIFF_Set_Image (tiff, *nimg, image)
-
GTIFF_Set_Key_Value(tiff, keyId, value)
-
TIFF_Write_TIFF(tiff)
program my_program
use geoTiff
implicit none
type(TIFF_FILE) :: my_tiff
integer :: ierr,wid,len,bps
character(100) :: descr
real , allocatable :: image(:)
integer, allocatable :: sof
call TIFF_Open(124,"files/cea.tif",'r', my_tiff, ierr)
if (ierr==0) then
!get TIFF params:
call TIFF_GET_TAG_VALUE(my_tiff, 1, TIFF_ImageWidth , wid )
call TIFF_GET_TAG_VALUE(my_tiff, 1, TIFF_ImageLength , len )
call TIFF_GET_TAG_VALUE(my_tiff, 1, TIFF_BitsPerSample , bps )
call TIFF_GET_TAG_VALUE(my_tiff, 1, TIFF_ImageDescription, descr)
!get TIFF image:
allocate(image(wid*len))
call TIFF_GET_IMAGE(my_tiff,1, image)
!get crs
call GTIFF_GET_KEY_VALUE(my_tiff, GKEY_ProjectedCSType, crs)
!get coordinates
allocate(x(wid*len))
allocate(y(wid*len))
call GTIFF_GET_IMAGE_COORDINATES(my_tiff,1,x,y)
call TIFF_Close(my_tiff)
else
stop 'Failed to read TIFF file'
endif
end program
General:
- Read/Open function implementation
- Write/Create function implementation
- IO-error management
TIFF 6.0 Baseline:
- Big-Enddian support (swap byte-order)
- Orientation: support for different orientation images (not all tested)
- Compression: Support for PackBits
- Compression: Support for Modified Huffman (CCITT Group 3, 1-D)
- Multi-band TIFFs
- Planar configuration TIFFs
- Extend
TIFF_Get_Image
for categorical (integer) fields
TIFF 6.0 Optional:
- 'Tiled' images
- Multi-image TIFF (more than 1 IFD)
- Compression: LZW
- GeoKey values access
- Find how to get coordinates info
Performance:
- Memory (RSS)
- CPU usage testing
- Parallel access? (is it possible?)