Subscribe to this thread
Home - General / All posts - Channel Shuffle and Export Tif
dchall8
709 post(s)
#07-May-20 01:22

I took one of the USDA NAIP NIR images and changed the channels to 3,0,1 as was done in the excellent video. Then I exported the drawing as a Tif and got surprising results. Here are the two images. First one is from within Manifold. The second one is the exported tif from an image viewer

It looks like the blue channel did not export.

Attachments:
Manifold NIR Ch 3,0,1.jpg
TIF export from Manifold zoomed.jpg

Dimitri


5,993 post(s)
#07-May-20 07:23

NAIP images are four channel images. If you shuffle channels so that the R, G and B display is driven by what used to be channels 3,0,1, that still leaves the fourth channel (Channel 3) as it was originally.

When you export the resulting four channel image to a TIFF, how viewing software displays that fourth channel is up to the software.

By default, viewing software like Photos in Windows 10 treats the fourth channel as an alpha channel, so where Channel 3 has high values the transparency of the image is high. In some viewing software the "background" is assumed white, so as more of that shows through the image is lighter in those places.

In PhotoShop, high transparency (high values of the fourth, alpha channel) results in more of the default checkerboard background pattern showing through.

You can see the effect by opening your Flying L Ranch image in Manifold and then in the Style pane using the Channel quick select button to choose RGBA. It will then interpret the fourth channel, Channel 3, as alpha, and you'll see a similar effect to what your image viewing software shows.

The solution is to either a) before export set all values in the fourth channel to 0 so the alpha channel says "make everything Opaque" or b) create an RGB three channel image from your RGBa four channel image and export the three channel image.

Option b) is easy to do using the Join dialog: Suppose your four channel image is called "Ranch":

1. Open Ranch and in the Transform pane use the Channel template to save Channel 0 to an image called Ranch RGB. Ranch RGB is a single channel image with one channel, Channel 0, taken from Ranch.

2. Create a map with both Ranch and Ranch RGB in it.

3. With the focus on Ranch RGB, launch Edit - Join and choose Ranch as the joined image.

4. Click the Add button, then Fields.

5. Choose Channel 1 and Channel 2 to add

6. Press Join Component. You've now added two more channels, Channel 1 and 2, to Ranch RGB to make it a three channel, RGB image.

7. Click on a different layer and then back onto Ranch RGB to refresh all the styles, and then in the Style dialog in the quick selector button choose RGB as the layout for channels. You now have a normal looking RGB image that only has three channels in it. Export Ranch RGB and there won't be any fourth channel for software to figure out.

----

You could, of course, use SQL to modify the fourth channel or to drop it, but the above is just point and click all the way. Transform templates for images really should be enhanced slightly so that instead of there being just a limited selection for multi-channel images, that all the many templates that work with single channel images would appear but with a channel selector control so you could apply what they do to just one channel in a multichannel image.

Dimitri


5,993 post(s)
#07-May-20 09:08

There's a new video that shows what's going on and how to make a three channel image: Create RGB from RGBA using Join

dchall8
709 post(s)
#07-May-20 20:37

Thanks, that works. I tried to get fancy with contrast in Manifold, but the exported tif was the flat looking data. I adjusted the contrast and saturation in my image program, deleted the extraneous data from the original quarterquad down to the parcel I'm looking at, and got a nice image that's not huge. Flying L Ranch is now a golf course as you can see in the image.

Attachments:
Flying L Ranch Infrared 3.jpg

dchall8
709 post(s)
#08-May-20 20:56

I guess I'm never happy, except with Manifold. I like the contrast colors that Manifold uses much better than what I could do with my limited skills in the imaging program. Do you have any more tricks so that the Manifold generated colors can be exported to tif?

Dimitri


5,993 post(s)
#09-May-20 04:13

I can't think of anything off the top of my head. Manifold gives you the ability to "style" an image, that is, to change the display characteristics of it, without changing the actual pixel values. Software like PhotoShop instead changes the actual pixel values to do things like changing contrast. I've sent in a suggestion asking for either a) export as styled, where the pixel values would be re-computed to use ranges, or b) a Make Image command, that would simply create a new image as displayed, including all style effects like contrast, shading, etc.

HMS79 post(s)
#18-May-20 21:22

Hi Dimitri, I don't know if this is the appropriated thread or if this question was already answered elsewhere but even after searching the manual I can't seem to find a way to export a tiff file to a precise pixel resolution.

Right now I need to export a tiff that originally has 300 dpi but after exporting the same image both from M8 and M9 I get different results. Checking both images in Photoshop reveals that the M8 export preserves the 300 dpi but the M9 export reduces the resolution to 72 dpi. Is this an expected result or am I doing something wrong with the M9 export?

tjhb

9,223 post(s)
#18-May-20 21:34

The dpi value is just metadata, describing how things should go for print. The true pixel resolution is the number of pixels, for a given geographic linear length.

That doesn't mean that you don't need the dpi metadata--maybe you do--or that M9 should drop it, or use the current Windows default (I'm not sure which it is doing, could test).

You can get it back very easily in Photoshop for example. Just open up Image Size, uncheck Resample image, and change the dpi value to anything you like. It really is just metadata--this doesn't change any pixels.

HMS79 post(s)
#18-May-20 21:57

Hi, thanks for the reply! That makes sense, of course. I was just trying to find out a quick way to do this in Manifold without the need to go to a different tool. After rechecking the process again I got the same results in M8 and M9 (I definitely made same mistake before).

tjhb

9,223 post(s)
#18-May-20 23:11

That's good. Not least because I forgot to mention that, exporting a TIFF from Photoshop will normally strip all of the GeoTIFF tags--it just winds up a normal TIFF. (Unless you have Avenza's Geographic Imager.) That could be annoying (and more important than dpi).

If you ever do need to adjust the dpi setting while keeping GeoTIFF metadata as well, I think GDAL tools would be a better bet.

HMS79 post(s)
#19-May-20 02:58

Thanks for the tip. I'm aware about ruining the GeoTIFF purpose with photoshop. In this case I just used it to check the resolution of the file. Still in this subject is the M9 exported tiff file a compressed one by default?

M9 export its easy and superfast but it doesn't seem to provide any customizing options regarding the final file specs.

Manifold User Community Use Agreement Copyright (C) 2007-2019 Manifold Software Limited. All rights reserved.