Clip or export jpeg raster without re-compressing

698
3
12-10-2021 09:27 AM
MattWilkie1
Occasional Contributor II

We have a lot of spatial imagery where lossy jpeg compression has been used. This is fine and even the most appropriate format for daily use scenarios where the image is mostly a backdrop to place other information in context.

However it is mal-adaptive when used in analytic studies where the typical workflow is crop out the area of interest and/or mosaic with overlapping images in the area of interest. To the best of my knowledge in this event the study needs to choose between:

  • Storing in lossless compression and dramatically increase storage consumption
  • Storing in lossy compression, and lose more values than has already been lost while simultaneously introducing artifacts (false data);

Or am I wrong, and there is a way to convert all or a portion of a jpeg image without re-applying jpeg compression encoding?

If it's relevant, all of the imagery I'm thinking of here are stored as jpeg-in-geotiff.

0 Kudos
3 Replies
DanPatterson
MVP Esteemed Contributor

according to Compression (Environment setting)—ArcGIS Pro | Documentation

it suggests that if compression is set to 100% when clipping it shouldn't get any worse than it is.

I would do a comparison before endorsing that workflow just to make sure.  Going forward, I am sure you will have to decide which is more important data quality for analysis or data storage size.  


... sort of retired...
MattWilkie1
Occasional Contributor II

Thanks Dan. Using Jpeg-100% is conceptually the same as applying LZW or some other encoding (except the latter is actually lossless instead of maybe-perhaps).  All of these methods add a storage increase penalty in order to keep the info unchanged. Perhaps Jpeg-100 will be the least expensive* if there is no choice.

I'm looking for a way to copy the existing info as is, especially if the only change of note is the bounding box.

 

* Depending on local circumstance. In a local quick test of a small image Jpeg100 is in the middle between ZSTD and LZW in terms of storage size:

11,626,259 cog-lzw.tif
9,887,223 cog-zstd.tif
10,164,668 jpeg-100.tif

0 Kudos
DanPatterson
MVP Esteemed Contributor

Yes, the as_is clipped version would be larger at jpeg-100% compared to its unclipped state, but one would hope the values would be the same for analysis (of potentially already modified values 😉 )


... sort of retired...
0 Kudos