Removing the Black Border After Warping an Image Introduction A common use of Didger is to combine multiple image files by calibrating and warping them, exporting them as georeferenced TIFF files (GeoTIFFs), and mosaicking the GeoTIFFs together in a Didger vector project. The warping step expands the extents of the image slightly, which creates a black border. This border is usually undesirable when mosaicking the images, as it can obscure portions of any adjacent images. Warping an image creates a black border around it. This border is undesirable when mosaicking two or more adjacent images. There are four ways to remove the black border. 1. During the warping step, specify a smaller range of Output Map Extents to prevent creation of the border. 2. Let the border be created, but specify the black border color to be transparent when combining the images in the vector project. 3. Import each image into a separate layer in a vector project and then clip the image to a polygon. 4. If you have just a single image, you can change the Project Limits in a vector project to limit the extents of the image to exclude the black border. This article provides detailed instructions on all methods. You can choose which is best suited to your needs.
Method 1: Setting the Output Map Extents By default, the warp operation expands the extents of the map slightly, to provide room in case the image needs to be rotated. However, it is possible to reduce the extents so that the black border is not created. Perform the following steps: 1. After the image is calibrated in a raster project, go to Image Warp Image. 2. In the Warp Image dialog, leave the Output Map Extents at the default values for now. Select the desired Warp Parameters and X and Y Output Bitmap Extents as appropriate, or leave them as defaulted, and click OK. 3. You may get a message that says "The current bitmap is very large. Do you wish to add it to the undo list?" If so, click Yes. We will be undoing this warp operation in order to re-warp with different settings. 4. After the warping calculations are completed, click OK in the Bitmap Import Options dialog. The warped image will appear with the black border around it. 5. Make sure your display units are set to meters if the image is projected, lat/long if the image projection is set to Unprojected Lat/Long, or whatever calibration units were used if the image is in Cartesian coordinates. If you need to change the display units, go to Image Calibrate Image, check or change the Display Units in the Initial Calibration Settings dialog (Step One), and then click Next, Next, Next, and Finish. 6. Move the cursor to the X and Y minimum and maximum extents of the actual image (not including the black border), and write down the X and Y coordinates shown in the status bar.
After warping the image, move the cursor to the extents of the image and write down the coordinates shown in the status bar. 7. If you had to change the display units in step 5, go to Edit Undo Calibration. 8. Go to Edit Undo New Bitmap to undo the warping. 9. Go back to Image Warp Image. 10. This time, enter the X and Y min/max values that you recorded in step 6 in the Output Map Extents area. Make any desired changes to the Warp Parameters and X and Y Output Bitmap Extents and click OK. 11. When the image is warped, the black border will be gone because of the reduced extents specified. After specifying the Output Map Extents in the Warp Image dialog box, warping the image does not create a black border. 12. Export the image as a GeoTIFF. It will be ready to combine later with other images in a Didger vector project. Method 2: Setting the Black Color to be Transparent Once all the bitmaps have been georeferenced and warped in a raster project, export each of them to a GeoTIFF file. The GeoTIFF files will have the black borders around them. To mosaic them together and remove the black border, follow these steps:
1. Go to File New Blank to create a blank Didger project. 2. Go to File Import Bitmap Into Vector. 3. Select one of the GeoTIFF files and click Open. In the Bitmap Import Options dialog, choose the Spatial Referenceto use and click OK. The file is imported. 4. Repeat steps 2 and 3 for each of the GeoTIFF files so they are all imported into one project. The images are aligned according to their calibration. Each image has the unwanted black border. 5. To remove the black border, select one of the bitmaps and go to Image Select Transparent Colors. 6. The Select Transparent Colors dialog opens, and the cursor changes to a fat cross. 7. Click anywhere on the black border of the image. Then click OK in the Select Transparent Colors dialog box. The black border becomes invisible. 8. Repeat steps 5 through 7 for each of the images, making all the black borders transparent. 9. If the images contain other black pixels, besides the ones in the border, they will also become transparent. To rectify this, draw a large polygon covering the interior of all images. Fill the polygon with solid black and use the Edit Arrange Move to Back command to move the polygon to the back of all the images. This will fill the areas that were unintentionalally made transparent. 10. Now you can export the combined images as a single GeoTIFF file, digitize on top of it, or import other vector or data files. Set the black border to be transparent for each image and then draw a black polygon covering all the images and move it to the back. Method 3: Clipping the Image to a Polygon
You can use this method if you have only a single image you'd like to remove the black border from. Once the bitmap has been georeferenced and warped in a raster project, export it to a GeoTIFF file. The GeoTIFF file will have the black border around it. To change the project limits, follow these steps: 1. Go to File New Blank to create a blank Didger project. 2. Go to File Import Bitmap Into Vector. 3. Select one of the GeoTIFF files and click Open. In the Bitmap Import Options dialog, choose thespatial Referenceto use and click OK. The file is imported into Layer-1. 4. Go to Digitize Rectangle. 5. Click OK in the Digitize Rectangle dialog box. 6. Draw a rectangle all the way around the image (not including the black border). 7. Select the rectangle and go to Image Clip Bitmap Current Polygon. This will clip the black border. 8. Hit the Delete key on the keyboard to delete the polygon. 9. If you only have a single image you want to clip, then you are done. If you have other images you want to mosaic and clip, right click in the Layer Manager and choose Add Layer. This will create Layer-2. 10. Double click on Layer-2 in the Layer Manager so it becomes the active layer. 11. Repeat steps 2-8 to import the next GeoTIFF file into Layer-2 and clip the black border. 12. Export the mosaicked image as a GeoTIFF. It will be ready to combine later with other images in a Didger vector project. Import each image into a separate layer and then clip each image to a polygon to remove the black border Method 4: Change the Project Limits to Exclude the Black Border for a Single Image
You can use this method if you have only a single image you'd like to remove the black border from. Once the bitmap has been georeferenced and warped in a raster project, export it to a GeoTIFF file. The GeoTIFF file will have the black border around it. To change the project limits, follow these steps: 1. Go to File New Blank to create a blank Didger project. 2. Go to File Import Bitmap Into Vector. 3. Select one of the GeoTIFF files and click Open. In the Bitmap Import Options dialog, choose thespatial Referenceto use and click OK. The file is imported into Layer-1. 4. Look at the coordinates displayed in the Status Bar. If they are not in Meters, go to View Projection Settings, change the Display Units to Meters, and click OK. 5. Move the cursor to the limits of the image (not including the black border) and write down the X and Y minimum and maximum values. 6. Go to View Project Limits, enter these values in the Specify Project Limits section, and clickok. Specify the new project limits, excluding the black border, and click OK. The new image will be cropped to the limits you specified. If you have any questions about Didger or this article, please contact us at didgersupport@goldensoftware.com.