Compress .ECW file to give to contractor using MapInfo

5275
7
Jump to solution
11-11-2012 03:12 PM
BenVan_Kesteren1
Occasional Contributor III
Hi Guys,

I have got an 18Gig .ecw file here at work, and a contractor has asked for a lower quality one that could be burned to DVD or put on thumb drive (i know we can get big thumb drive, but the DVD option is better for us) so im trying to work out how to convert the 18Gig to be a smaller 4gig file.

I have done the obvious thing of opening it in Irfanview, clicking save as, then reducing quality to abot 3:1 as per the options, and this dramatically reduces the file size to about 10meg, while still being adequate for what contractor needs. But when i bring this new ECW into my MXD map it comes up with warning - see photo below.
[ATTACH=CONFIG]19209[/ATTACH]

So i open Catalog and import the same coord system as all my projects/files and try again, but the error still comes up, and the image doesnt project on my plan.

Does anyone know why this is happening, and how i can resolve this?

-Cheers
0 Kudos
1 Solution

Accepted Solutions
MarcoBoeringa
MVP Regular Contributor
Ben,

You might be able to solve the "scaling" issue by using ArcGIS's image georeferencing tools on the image created by IrfanView. Choose a simple "Affine" type transformation, that will allow you to scale the image back to its original size. The georeferencing tools for images/rasters don't write a new file, they just add a so-called world file or *.AUX.XML file storing the information on how to display the image.

See the following ArcGIS Help topics for more information:
Fundamentals for georeferencing a raster dataset
Entering specific x,y coordinates when georeferencing

By the way, in your case it might be best to not use a percentage resize in IrfanView, but use exact X,Y pixel widths. This will allow you to accurately determine by what factor (e.g. 2, 4 etc.), the image will be resampled and ensure it will re-map to the same extent as the original. Look at Image/Information in IrfanView or in ArcCatalog, to find out the size in number of pixels X and Y, the original image is. You can also use the "Resample" option in the Batch dialog of IrfanView. It will be slower but may give a better quality image as, if I remember it well, it resamples based on a bilinear or cubic interpolation method, instead of collecting pixels based on nearest neighbour resampling.

View solution in original post

0 Kudos
7 Replies
JakeSkinner
Esri Esteemed Contributor
Hi Ben,

What version of ArcGIS Desktop are you using?
0 Kudos
BenVan_Kesteren1
Occasional Contributor III
What version of ArcGIS Desktop are you using?


Using version 10

-Cheers
0 Kudos
MarcoBoeringa
MVP Regular Contributor
Hi Guys,

I have got an 18Gig .ecw file here at work, and a contractor has asked for a lower quality one that could be burned to DVD or put on thumb drive (i know we can get big thumb drive, but the DVD option is better for us) so im trying to work out how to convert the 18Gig to be a smaller 4gig file.

I have done the obvious thing of opening it in Irfanview, clicking save as, then reducing quality to abot 3:1 as per the options, and this dramatically reduces the file size to about 10meg, while still being adequate for what contractor needs. But when i bring this new ECW into my MXD map it comes up with warning - see photo below.
[ATTACH=CONFIG]19209[/ATTACH]

So i open Catalog and import the same coord system as all my projects/files and try again, but the error still comes up, and the image doesnt project on my plan.

Does anyone know why this is happening, and how i can resolve this?

-Cheers


Ben,

There is no way an 18Gig ECW is compressable to just 10Mb without resampling / downsampling to a much, much more coarse resolution, e.g. create a 100x100m ECW of a high precision 0,2x0,2meter ECW file.

You have to realize that ECW is already an extremely well compressed format (usually up to 20x and more), there is not much to gain by trying to recompress it, unless you are willing to sacrify a serious amount of the image quality by recompressing again at a target ratio of over 20:1, e.g. 50. The resulting image quality is likely so-so...

In addition, you are miss-interpreting the Irfanview control. The compress ratio 3:1 is a target compression for the file size based largely on uncompressed raster size, meaning if you have a non-compressed file, a 3:1 ratio will reduce the file size to a third of the original. More normal values are, as visible in Irfanview, 20:1 or 10:1, meaning a 1Gb file will be reduced to 50 or 100Mb file size.

In your case, if the 18 Gb image was an uncompressed TIFF, setting a 3:1 target compression would result in possibly a 6Gb ECW file at best.

If I run a re-compress to ECW against an already well compressed small ECW of 11Mb with a target ratio of 3:1 in Irfanview, the file size actually INCREASES, to about 38Mb...

This all means that in all likelyhood, the "Save As" in Irfanview simply failed. Are you able to view it back in Irfanview, and especially, zoom in to the same level of detail as you were in the original file?

If not, this is again an indication the "Save As" failed as intended, and maybe Irfanview just compressed or wrote one of the higher level pyramids to a new file.

By the way, Irfanview does offer a re-sampling option to save a new file to a coarser, and thus smaller file size, image. The option is available under File/Batch conversion and than under "Batch conversion settings" choose "Use advanced options/Resize". I usually find it the easiest to just choose "Set new size as percentage of original", and set for example  50% to reduce the number of image pixels to 1/4 of the original. Combine this with a moderate target compression of let's say 10:1, and you may have a decent smaller image with still good image pixel quality.
0 Kudos
MarcoBoeringa
MVP Regular Contributor
Lastly, Irfanview doesn't write the coordinate system to the file nor copies over *.prj or *.xml files. This causes problems when adding to ArcMap. Use ArcCatalog, the options to define a Spatial Reference for a raster therein (preferably and easiest to import from the original file using the Import option).

- Right click new ECW file in ArcCatalog
- Choose Properties from context menu
- Choose Spatial Reference/Edit
- Choose Import
- Select original ECW file to import from

Now you should be able to add the new ECW file to ArcMap without issues.

*** UPDATE ***:

Hmmm, that was a bit optimistic ;(... When I tried it, the image does display, but if it is resampled to a smaller size, Irfanview/ArcMap doesn't register a bigger cell size, and just reduces the coverage of the image to a fraction of the original extent, which is of course completely wrong. E.g. if I choose to reduce size in Irfanview to 25% of the original, the extent in ArcMap comes out as 25% as well.

Of course, Irfanview was never designed to handle GIS data and be able to handle geographical coordinate system stuff.
0 Kudos
BenVan_Kesteren1
Occasional Contributor III
I usually find it the easiest to just choose "Set new size as percentage of original", and set for example  50% to reduce the number of image pixels to 1/4 of the original. Combine this with a moderate target compression of let's say 10:1, and you may have a decent smaller image with still good image pixel quality.


Hi,

I just had a go with the Batch Conversion, but that percentage of original option will physically resize the image size, and the objective is to provide a georeferenced aerial photograph, so in my instance that one wont work.

Cheer
0 Kudos
MarcoBoeringa
MVP Regular Contributor
Hi,

I just had a go with the Batch Conversion, but that percentage of original option will physically resize the image size, and the objective is to provide a georeferenced aerial photograph, so in my instance that one wont work.

Cheer


Ben,

That is what I remarked in my "UPDATE" in the last post. Actually, the problem is not so much in physically "resizing" the image, because we do it every day in GIS with raster datasets, but in not properly changing cell size to avoid changing geographical extent as well. If you resample an image to a coarser raster in any GIS, it will change cell size, but Irfanview is blissfully unaware of something like a geographical context, as it is a simple image processor and viewer, not a GIS.
0 Kudos
MarcoBoeringa
MVP Regular Contributor
Ben,

You might be able to solve the "scaling" issue by using ArcGIS's image georeferencing tools on the image created by IrfanView. Choose a simple "Affine" type transformation, that will allow you to scale the image back to its original size. The georeferencing tools for images/rasters don't write a new file, they just add a so-called world file or *.AUX.XML file storing the information on how to display the image.

See the following ArcGIS Help topics for more information:
Fundamentals for georeferencing a raster dataset
Entering specific x,y coordinates when georeferencing

By the way, in your case it might be best to not use a percentage resize in IrfanView, but use exact X,Y pixel widths. This will allow you to accurately determine by what factor (e.g. 2, 4 etc.), the image will be resampled and ensure it will re-map to the same extent as the original. Look at Image/Information in IrfanView or in ArcCatalog, to find out the size in number of pixels X and Y, the original image is. You can also use the "Resample" option in the Batch dialog of IrfanView. It will be slower but may give a better quality image as, if I remember it well, it resamples based on a bilinear or cubic interpolation method, instead of collecting pixels based on nearest neighbour resampling.
0 Kudos