PHOTOMETRIC values in tiffs

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
dacust

PHOTOMETRIC values in tiffs

Post by dacust »

NEWBIE ALERT!!!

I have converted some jpgs to tifs. Works fine. The images are B&W aerial photos, color aerial photos and color topographical maps.

There is a conversion tool tif2bsb that will create a format that can be displayed by marine navigation software. When I run it I get errors.

On the B&W photos I get:
No support for TIFF files with PHOTOMETRIC=1 (only images containing color maps
supported)

On the color topos or color aerials I get:
No support for TIFF files with PHOTOMETRIC=2 (only images containing color maps
supported)

So, the question is, does that message tell you anything? And is there a way for me to convert the jpgs so they will be in a format tif2bsb understands?

I tried searching for the answer, both in this forum and in the documentation, but if it's there, I think I don't know the correct terms to search with.

What follows is probably useless details, so feel free to stop here. But just in case this helps:
On the tif2bsb command, there is a switch -c n for the number of colors. In looking in the headers of commercial charts, this ranges from 4 to 127 colors (they specify them as RGB values). The utility will automatically create these RGB values in the header. So I figure if "convert" can do it, it will be by reducing the color depth (if I am using the correct term). I bet, even if you do come up with a way for me to convert it to a format it can use, the image will suffer. But I at least want to try.

Another thing I noticed that probably means nothing. The B&W tif shows the dimensions in explorer, but neither of the color ones do. But I can open all 3 in Gimp and they look fine.

Thanks,

-dan
dacust

Re: PHOTOMETRIC values in tiffs

Post by dacust »

I found out that they are expecting a palette instead of RGB. Convert from jpg to gif and then to tif accomplished it. So, that worked.

So, can someone tell me how to do this the most efficiently? Hopefully in one step? I have tens of thousands to convert.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: PHOTOMETRIC values in tiffs

Post by fmw42 »

to specify palette use

-type Palette

at the end of your command line. That should make it palette rather than truecolor.

to see the various types,

convert -list type
dacust

Re: PHOTOMETRIC values in tiffs

Post by dacust »

fmw42 wrote:to specify palette use

-type Palette

at the end of your command line. That should make it palette rather than truecolor.

to see the various types,

convert -list type
Thanks! Since my last post I got tif2bsb to work. I now have aerial photos and topo maps displaying in my marine navigation program with the GPS showing my position on them!!! Too cool.

Now all I gotta is automate the process. Since everything is now being done on the command line, I just have to write a program to generate the commands and configuration files. More than you wanted to know, I'm sure, but I just wanted to show how excited I am to have it working.

If you'd like to see the result of one on the screen, here ya go.

Your help with the pallette type will help speed things up. Thanks again.

-dan
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: PHOTOMETRIC values in tiffs

Post by fmw42 »

I have had a lot of experience with photogrammetry and remote sensing from aerial and satellite photography/images in my past (see http://www.fmwconcepts.com/fmw/ipt.html). So your example is most interesting, but I don't see any cartographic map or topography contours.

Too bad IM does not support GEOTiff information in the tiff file headers. Don't know if that would help you, though.

If I can be of help making your command lines more efficient, let me know. I am not sure exactly what you are doing. But if you can identify your commands so far perhaps I can help, at least with the IM commands.
dacust

Re: PHOTOMETRIC values in tiffs

Post by dacust »

I'll check your link out later. Heading to bed right now.

My commands so far are just:

Code: Select all

convert a0001_u.jpg -colors 127 a0001_u.gif
convert a0001_u.gif -colors 127 a0001_u.tif
So, I imagine next time I'll try:

Code: Select all

convert a0001_u.jpg -type Palette -colors 127 a0001_u.tif
Here is a topo map

The result you see in this example and the other one is that I can choose to see the navigation chart or the photo or the topo map. They are georeferenced and so it shows my boat in the correct location. The charts don't really show the towns or much else on land. The docks show up as little lines, but you can't tell if they are public, private, commercial, etc. So the photos give a better idea of the surroundings. Just another tool in the toolbox.

-dan
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: PHOTOMETRIC values in tiffs

Post by fmw42 »

I don't know if it will matter, but you might try putting the -type palette after the -colors and adding +dither before the -colors to turn off dithering when reducing colors. Also you could add -depth 8, but that may or may not matter with -colors. Just some things to try. You can see the effects in the images and also use

identify -verbose resultimage

to see the information about the resulting image.

see Anthony's page http://www.imagemagick.org/Usage/quantize/ for information about color reduction.

How are you getting the photo and map and other topo infomation georegistered?

Have you used or tested (optionally color coded) terrain elevation or sea depth information (in the form of an image)? If so, how have you registered that with your photos?
Post Reply