diff --git a/CHANGES.txt b/CHANGES.txt
index 2a36bf8..ccc5dd0 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,3 +1,9 @@
+1.1.5 (TBD)
+------------------
+
+ - add `--allow-intermediate-compression` option to reduce the memory/disk footprint (#103)
+
+
 1.1.4 (2019-10-03)
 ------------------
 
diff --git a/rio_cogeo/cogeo.py b/rio_cogeo/cogeo.py
index 346e7dd..99695e3 100644
--- a/rio_cogeo/cogeo.py
+++ b/rio_cogeo/cogeo.py
@@ -65,6 +65,7 @@ def cog_translate(
     resampling="nearest",
     in_memory=None,
     config=None,
+    allow_intermediate_compression=False,
     quiet=False,
 ):
     """
@@ -102,6 +103,10 @@ def cog_translate(
         Force processing raster in memory (default: process in memory if small)
     config : dict
         Rasterio Env options.
+    allow_intermediate_compression: bool, optional (default: False)
+        Allow intermediate file compression to reduce memory/disk footprint.
+        Note: This could reduce the speed of the process.
+        Ref: https://github.com/cogeotiff/rio-cogeo/issues/103
     quiet: bool, optional (default: False)
         Mask processing steps.
 
@@ -207,8 +212,9 @@ def cog_translate(
                     meta.pop("alpha", None)
 
                 meta.update(**dst_kwargs)
-                meta.pop("compress", None)
-                meta.pop("photometric", None)
+                if not allow_intermediate_compression:
+                    meta.pop("compress", None)
+                    meta.pop("photometric", None)
 
                 if in_memory is None:
                     in_memory = vrt_dst.width * vrt_dst.height < IN_MEMORY_THRESHOLD
diff --git a/rio_cogeo/scripts/cli.py b/rio_cogeo/scripts/cli.py
index 9f244fb..aa81bbd 100644
--- a/rio_cogeo/scripts/cli.py
+++ b/rio_cogeo/scripts/cli.py
@@ -147,6 +147,12 @@ def cogeo():
     help="Force processing raster in memory / not in memory (default: process in memory "
     "if smaller than {:.0f} million pixels)".format(IN_MEMORY_THRESHOLD // 1e6),
 )
+@click.option(
+    "--allow-intermediate-compression",
+    default=False,
+    is_flag=True,
+    help="Allow intermediate file compression to reduce memory/disk footprint.",
+)
 @click.option(
     "--threads",
     type=ThreadsParamType(),
@@ -172,6 +178,7 @@ def create(
     latitude_adjustment,
     resampling,
     in_memory,
+    allow_intermediate_compression,
     threads,
     creation_options,
     quiet,
@@ -209,6 +216,7 @@ def create(
         resampling=resampling,
         in_memory=in_memory,
         config=config,
+        allow_intermediate_compression=allow_intermediate_compression,
         quiet=quiet,
     )
 

Allow compression for intermediate file
In https://github.com/cogeotiff/rio-cogeo/blob/92bba3a2b475451e78afd58e02e25d889c1ab910/rio_cogeo/cogeo.py#L210-L211 we remove the compression to speed up the process. While this is fine in most case, sometime we want to minimize the memory/disk space usage instead of the speed. 

We could add an option to `--allow-intermediate-compression`
diff --git a/tests/test_cli.py b/tests/test_cli.py
index e447982..b086841 100644
--- a/tests/test_cli.py
+++ b/tests/test_cli.py
@@ -418,6 +418,22 @@ def test_cogeo_validTempFile(monkeypatch, runner):
         assert result.exit_code == 0
 
 
+def test_cogeo_validCompress(monkeypatch, runner):
+    """Should work as expected."""
+    with runner.isolated_filesystem():
+        result = runner.invoke(
+            cogeo,
+            [
+                "create",
+                raster_path_rgb,
+                "output.tif",
+                "--allow-intermediate-compression",
+            ],
+        )
+        assert not result.exception
+        assert result.exit_code == 0
+
+
 def test_cogeo_validate(runner):
     """Should work as expected."""
     with runner.isolated_filesystem():

pip install -e .[dev]
parse_log_pytest
requirements.txt
pytest pytest-cov rio-tiler
3.6
requirements.txt
pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning
affine==2.3.1
attrs==22.2.0
boto3==1.23.10
botocore==1.26.10
certifi==2021.5.30
cfgv==3.3.1
charset-normalizer==2.0.12
click==8.0.4
click-plugins==1.1.1
cligj==0.7.2
cogdumper==1.1.0
coverage==6.2
dataclasses==0.8
distlib==0.3.9
filelock==3.4.1
identify==2.4.4
idna==3.10
importlib-metadata==4.8.3
importlib-resources==5.2.3
iniconfig==1.1.1
jmespath==0.10.0
mercantile==1.2.1
morecantile==2.1.4
nodeenv==1.6.0
numexpr==2.8.1
numpy==1.19.5
packaging==21.3
platformdirs==2.4.0
pluggy==1.0.0
pre-commit==2.17.0
py==1.11.0
pydantic==1.9.2
pyparsing==3.1.4
pystac==0.5.6
pytest==7.0.1
pytest-cov==4.0.0
python-dateutil==2.9.0.post0
PyYAML==6.0.1
rasterio==1.2.10
requests==2.27.1
-e git+https://github.com/cogeotiff/rio-cogeo.git@92bba3a2b475451e78afd58e02e25d889c1ab910#egg=rio_cogeo
rio-color==1.0.4
rio-mucho==1.0.0
rio-tiler==2.1.4
s3transfer==0.5.2
six==1.17.0
snuggs==1.4.7
supermercado==0.2.0
toml==0.10.2
tomli==1.2.3
typing_extensions==4.1.1
urllib3==1.26.20
virtualenv==20.16.2
zipp==3.6.0

name: rio-cogeo
channels:
  - defaults
  - https://repo.anaconda.com/pkgs/main
  - https://repo.anaconda.com/pkgs/r
  - conda-forge
dependencies:
  - _libgcc_mutex=0.1=main
  - _openmp_mutex=5.1=1_gnu
  - ca-certificates=2025.2.25=h06a4308_0
  - certifi=2021.5.30=py36h06a4308_0
  - ld_impl_linux-64=2.40=h12ee557_0
  - libffi=3.3=he6710b0_2
  - libgcc-ng=11.2.0=h1234567_1
  - libgomp=11.2.0=h1234567_1
  - libstdcxx-ng=11.2.0=h1234567_1
  - ncurses=6.4=h6a678d5_0
  - openssl=1.1.1w=h7f8727e_0
  - pip=21.2.2=py36h06a4308_0
  - python=3.6.13=h12debd9_1
  - readline=8.2=h5eee18b_0
  - setuptools=58.0.4=py36h06a4308_0
  - sqlite=3.45.3=h5eee18b_0
  - tk=8.6.14=h39e8969_0
  - wheel=0.37.1=pyhd3eb1b0_0
  - xz=5.6.4=h5eee18b_1
  - zlib=1.2.13=h5eee18b_1
  - pip:
      - affine==2.3.1
      - attrs==22.2.0
      - boto3==1.23.10
      - botocore==1.26.10
      - cfgv==3.3.1
      - charset-normalizer==2.0.12
      - click==8.0.4
      - click-plugins==1.1.1
      - cligj==0.7.2
      - cogdumper==1.1.0
      - coverage==6.2
      - dataclasses==0.8
      - distlib==0.3.9
      - filelock==3.4.1
      - identify==2.4.4
      - idna==3.10
      - importlib-metadata==4.8.3
      - importlib-resources==5.2.3
      - iniconfig==1.1.1
      - jmespath==0.10.0
      - mercantile==1.2.1
      - morecantile==2.1.4
      - nodeenv==1.6.0
      - numexpr==2.8.1
      - numpy==1.19.5
      - packaging==21.3
      - platformdirs==2.4.0
      - pluggy==1.0.0
      - pre-commit==2.17.0
      - py==1.11.0
      - pydantic==1.9.2
      - pyparsing==3.1.4
      - pystac==0.5.6
      - pytest==7.0.1
      - pytest-cov==4.0.0
      - python-dateutil==2.9.0.post0
      - pyyaml==6.0.1
      - rasterio==1.2.10
      - requests==2.27.1
      - rio-color==1.0.4
      - rio-mucho==1.0.0
      - rio-tiler==2.1.4
      - s3transfer==0.5.2
      - six==1.17.0
      - snuggs==1.4.7
      - supermercado==0.2.0
      - toml==0.10.2
      - tomli==1.2.3
      - typing-extensions==4.1.1
      - urllib3==1.26.20
      - virtualenv==20.16.2
      - zipp==3.6.0
prefix: /opt/conda/envs/rio-cogeo

tests/test_cli.py::test_cogeo_validCompress
tests/test_cli.py::test_cogeo_valid tests/test_cli.py::test_cogeo_overviewTilesize tests/test_cli.py::test_cogeo_validate
tests/test_cli.py::test_cogeo_valid_external_mask tests/test_cli.py::test_cogeo_validbidx tests/test_cli.py::test_cogeo_invalidbidx tests/test_cli.py::test_cogeo_invalidbidxString tests/test_cli.py::test_cogeo_validnodata tests/test_cli.py::test_cogeo_validGdalOptions tests/test_cli.py::test_cogeo_validOvrOption tests/test_cli.py::test_cogeo_web tests/test_cli.py::test_cogeo_validgdalBlockOption tests/test_cli.py::test_cogeo_validNodataCustom tests/test_cli.py::test_cogeo_validTempFile
CHANGES.txt rio_cogeo/cogeo.py rio_cogeo/scripts/cli.py
CHANGES.txt rio_cogeo/cogeo.py rio_cogeo/scripts/cli.py