0

I am new in R.

I want to know how to read and write tiff format image in R and how to use R to locate pixels and bands of images My environment is in Windows when I try to read tiff image it shows

readTIFF("Z:/For bo/July1.tif", as.is=TRUE)
Warning messages:
1: In readTIFF("Z:/For bo/July1.tif", as.is = TRUE) :
  TIFFReadDirectory: Unknown field with tag 33550 (0x830e) encountered
2: In readTIFF("Z:/For bo/July1.tif", as.is = TRUE) :
  TIFFReadDirectory: Unknown field with tag 33922 (0x8482) encountered
3: In readTIFF("Z:/For bo/July1.tif", as.is = TRUE) :
  TIFFReadDirectory: Unknown field with tag 34735 (0x87af) encountered
4: In readTIFF("Z:/For bo/July1.tif", as.is = TRUE) :
  TIFFReadDirectory: Unknown field with tag 42113 (0xa481) encountered

how to solve it?

0

2 Answers 2

2

I would recommend using the raster or rgdal package(s) to read tiff files. This will also set you up for success in your second question, which not only needs to be a new question but also needs more than "how to locate pixels".

In the raster package you can use "raster" for single band or stack for muntiband (e.g., RGB) tiff's. In rgdal you can use "readGDAL" for either single or multi. The resulting object types are quite different but the raster solution will be memory safe whereas rgdal will not as is your current approach.

0
1

Some background:

  • Those messages come from libtiff, which is widely used for reading TIFF images. R is just one of the users.

  • TIFF is a flexible format, and additional information can be added using extra "tags" (hence the name of the format), not all of which are necessarily public. The specification will give you more detail if needed. Different tools read and write different tags.

  • libtiff has configuration for many "tags", but it isn't possible to provide them all. So when an unknown tag is found, you get a message.

Lets take one example: 0x8482. A search for "tiff tags" and the number is usually enough to get you to a web site that lists them. In this case, AwareSystems provides some great information on that tag.

It is possible for libtiff to be configured with extra tag information through its API. However I don't see that exposed in the R bindings, so if you need that information, you'd need to use another language or tool.

In general the warnings are useful information, but don't necessarily represent a problem unless you were specifically expecting that tag to be used, or you aren't getting the results you expect.

0

Not the answer you're looking for? Browse other questions tagged or ask your own question.