Hi Val, Thanks for looking at this and discussing it with me to try and find a solution which I appreciate. As discussed, to solve this problem I expect we are going to have to work at it from both the ERDASS end and the ThinkGeo end. One possible approach we have established at the ERDASS end is to adjust all black pixel values in the source TIFF image by 1 (ie from rgb value 0,0,0 to 0,0,1 or 1,1,1), then georeference (rotate) the image to it's correct orientation and then export it as an ECW with a background with rgb values of 0,0,0. This would mean no other pixels in the image would be rgb 0,0,0. We can then use the ThinkGeo API to render all rgb pixels with a value of 0,0,0 as being transparent without punching holes in the photo itself. Visually pixels with an rgb value of 0,0,1 or 1,1,1 are essentially black anyway. However this poses a massive processing task at the ERDASS end and I assume will limit performance at the ThinkGeo End as the whole image is being assessed for pixel values of 0,0,0 as opposed to just the margin. Our desire therefore is to find a solution from the ThinkGeo end which applies as a much smaller image is being rendered as opposed to being a massive processing task at the ERDASS end with very large source images (up to 372MB in size each * several thousand a day). An approach we are wondering if you can consider is whether during the rendering of several stacked images you can floodfill or paint all contiguous or neighbouring pixels as transparent starting from the edge, top left corner or from all four corners pixels of each individual image, as opposed to searching across all pixels in the image. As the border is probably less than 20% of the image this could have a significant impact on processing time. An example of how this is done in the open source, command line image processing software program "ImageMagick" http://www.imagemagick.org is shown in the following command line, I have adapted this from the second usage example listed at url http://www.imagemagick.org/Usage/color/#opaque under "Floodfil" : convert ImageIn.jpg -bordercolor "rgb(0,0,0)" -border 1x1 -background "rgb(0,0,0)" ^ -flatten -fuzz 3% -draw "fill none matte 0,0 floodfill" -shave 1x1 ImageOut.png Broken down, the syntax of this is : 1. Read ImageIn.jpg 2. Add border 1 pixel wide with a background colour of black (ie rgb 0,0,0) 3. Using a variance of 3%, floodfill the image from pixel xy coordinate 0,0 (ie the top left) with a value of "none" (ie transparent) 4. Shave off the border that was 1 pixel wide added previously 5. Save the image as a png. (in our case we wish to save the final image as a JPG) The effect of this which is important with the image example we have provided you with is : a) the pixel corners of the original photo when rotated can be on the very edge of the final image, thus a flood fill operation of contiguous pixels of the same value (or within a 3% range) will stop and only make transparent the top left corner of the image. b) the ability to vary the pixel colour of rgb 0,0,0 by say 3% is necessary as there is some leakage of colour from the rotated image into the black margin during the compression to ECW. Unfortunately this results in black skuff on the outside of the image referred to in the example by David above. If it was possible to use the Think geo API to floodfill all contiguous neighboring pixels (within a range of say 3%), from the corner of the image, this may mean we can avoid the massive processing task at the ERDASS end referred to above. A further approach which would reduce the readwrite time of the command line above would be to use the pixel width and height of the image to determine the top right, bottom right and bottom left pixel x,x coordinate value and floodfill all pixels from each corner within say a 3% range of rgb 0,0,0. This would obviate the need (and time) to undertake the step of drawing a 1 pixel width border, filling it with rgb value 0,0,0 and then deleting it when finished as in the above command line example. This may also be important to avoid in case it affects the actual geolocation of the image. Also our images do not always have a black margin on all corners. If the colour of any corner pixel was found to be not rgb 0,0,0 then it would simply be skipped, thus reducing processing time further before moving onto the next corner. The only downside with this approach is where there are contiguous black pixels within the rotated photo that join up with the margin on the outside of the photo. For example a "Black River" or black shadow on the edge of the photo within the image. For this reason we may need to process all the pixels on the ERDASS end, however I am assuming there could still be a substantial saving of processing time on the ThinkGeo end if it only makes transparent the outer edge as opposed to the whole image. Would be grateful for your comments or any suggestions you can come up with. Regards David |