<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body>
    <p>Hi Thomas,</p>
    <p>Interesting - thanks for the hint about turbo-jpeg.</p>
    <p>I found out that my gdal is linked against libjpeg.so.8 and not
      against libturbojpeg.so.0 which is also present on my system.</p>
    <p>Would I have to tell gdal to compile against libturbojpeg with
      the --with-jpeg= flag in order to benefit from turbo-jpeg?</p>
    <p>And yes, the mask thing is what I was struggling with JPEG
      compression and RGB images, but I got the mask to work by using
      the following gdal_translate command:</p>
    <pre style="box-sizing: border-box; font-family: SFMono-Regular, Consolas, "Liberation Mono", Menlo, monospace; font-size: 13.6px; margin-top: 0px; margin-bottom: 16px; overflow-wrap: normal; padding: 16px; overflow: auto; line-height: 1.45; background-color: rgb(246, 248, 250); border-radius: 6px; color: rgb(36, 41, 46); font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;"><code style="box-sizing: border-box; font-family: SFMono-Regular, Consolas, "Liberation Mono", Menlo, monospace; font-size: 13.6px; padding: 0px; margin: 0px; background: initial; border-radius: 6px; word-break: normal; white-space: pre; border: 0px; display: inline; overflow: visible; line-height: inherit; overflow-wrap: normal;">gdal_translate -b 1 -b 2 -b 3 -b mask -of COG --config GDAL_DISABLE_READDIR_ON_OPEN TRUE\
  -co COMPRESS=JPEG -co BIGTIFF=YES -co NUM_THREADS=4 -a_srs EPSG:2056\
  infile.vrt outfile.tif</code></pre>
    <p>Thanks and greetings,</p>
    <p>Andreas<br>
    </p>
    <div class="moz-cite-prefix">Am 09.10.20 um 17:53 schrieb thomas
      bonfort:<br>
    </div>
    <blockquote type="cite"
cite="mid:CAOM3y2i4fEryTjq4MrAUrfc36RfdGrHVQvLYWK6beHunUWNUOg@mail.gmail.com">
      <meta http-equiv="content-type" content="text/html; charset=UTF-8">
      <div dir="ltr">Andreas,
        <div>The size gains compared to JPEG are marginal, at the cost
          of noticeably higher compression and decompression times
          (especially compared to the optimized turbo jpeg library).
          WEBP does however support an alpha channel which can be
          desirable, as it avoids having to add a mask IFD to the TIFF.</div>
        <div>Regards,</div>
        <div>Thomas</div>
      </div>
      <br>
      <div class="gmail_quote">
        <div dir="ltr" class="gmail_attr">On Fri, Oct 9, 2020 at 4:30 PM
          Andreas Neumann <<a href="mailto:a.neumann@carto.net"
            moz-do-not-send="true">a.neumann@carto.net</a>> wrote:<br>
        </div>
        <blockquote class="gmail_quote" style="margin:0px 0px 0px
          0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
          <div
            style="font-size:10pt;font-family:Verdana,Geneva,sans-serif">
            <p>Thanks Thomas,</p>
            <p>Yes, compiling it with libtiff=internal and
              libgeotiff=internal did the trick - thanks for the hint!</p>
            <p>Do you recommending using webp instead of jpeg inside
              GTIFF or COG? It seems like the WEBP compression produces
              smaller file sizes than JPEG, but how does it look
              speed-wise regarding decompression?</p>
            <p>Thanks,</p>
            <p>Andreas</p>
            <p id="gmail-m_-4180496771565306986reply-intro">On
              2020-10-09 15:33, thomas bonfort wrote:</p>
            <blockquote type="cite" style="padding:0px
              0.4em;border-left:2px solid rgb(16,16,255);margin:0px">
              <div id="gmail-m_-4180496771565306986replybody1">
                <div>
                  <div dir="ltr">You might need to compile with gdal's
                    internal libtiff so that webp-in-tif support is
                    enabled (i.e. the system libtiff might not have webp
                    support). Also note you should probably be adding
                    "-co TILED=YES" to your translate command.</div>
                  <br>
                  <div>
                    <div dir="ltr">On Fri, Oct 9, 2020 at 3:07 PM
                      Andreas Neumann <<a
                        href="mailto:a.neumann@carto.net"
                        rel="noreferrer" target="_blank"
                        moz-do-not-send="true">a.neumann@carto.net</a>>
                      wrote:</div>
                    <blockquote style="margin:0px 0px 0px
                      0.8ex;border-left:1px solid
                      rgb(204,204,204);padding-left:1ex">
                      <div
                        style="font-size:10pt;font-family:Verdana,Geneva,sans-serif">
                        <p>Hi,</p>
                        <p>I am using a self-compiled GDAL 3.1.2 version
                          and try to create a GTIFF file with
                          COMPRESS=WEBP</p>
                        <p>libwebp-devel and other webp automatic
                          dependencies are installed on this ubuntu
                          18.04 machine. I could also compile against
                          libwebp</p>
                        <p>However, when running gdal_translate like</p>
                        <p><span>gdal_translate -b 1 -b 2 -b 3 -b mask
                            -of GTIFF -co COMPRESS=WEBP -co
                            PHOTOMETRIC=YCBCR -co BLOCKXSIZE=512 -co
                            BLOCKYSIZE=512 -co BIGTIFF=YES -co
                            NUM_THREADS=4 -a_srs EPSG:2056 -projwin
                            2599700 1226200 2602200 1224650
                            ch.swisstopo.orthofoto_2018.rgb.vrt
                            test_webp_ycbcr.tif<br>
                          </span></p>
                        <p>I get the following error output:</p>
                        <p><span>Input file size is 530000, 480000 <br>
                            Warning 6: 'WEBP' is an unexpected value for
                            COMPRESS creation option of type
                            string-select. <br>
                            ERROR 1: Cannot create TIFF file due to
                            missing codec for WEBP.<br>
                            <br>
                          </span></p>
                        <p><span>Any idea what might be missing in my
                            installation - where do I get this missing
                            codec for WEBP?</span></p>
                        <p><span>Thanks,</span></p>
                        <p><span>Andreas</span></p>
                        <p><br>
                        </p>
                      </div>
                      _______________________________________________<br>
                      gdal-dev mailing list<br>
                      <a href="mailto:gdal-dev@lists.osgeo.org"
                        rel="noreferrer" target="_blank"
                        moz-do-not-send="true">gdal-dev@lists.osgeo.org</a><br>
                      <a
                        href="https://lists.osgeo.org/mailman/listinfo/gdal-dev"
                        rel="noopener noreferrer" target="_blank"
                        moz-do-not-send="true">https://lists.osgeo.org/mailman/listinfo/gdal-dev</a></blockquote>
                  </div>
                </div>
              </div>
            </blockquote>
            <p><br>
            </p>
          </div>
          _______________________________________________<br>
          gdal-dev mailing list<br>
          <a href="mailto:gdal-dev@lists.osgeo.org" target="_blank"
            moz-do-not-send="true">gdal-dev@lists.osgeo.org</a><br>
          <a href="https://lists.osgeo.org/mailman/listinfo/gdal-dev"
            rel="noreferrer" target="_blank" moz-do-not-send="true">https://lists.osgeo.org/mailman/listinfo/gdal-dev</a></blockquote>
      </div>
    </blockquote>
  </body>
</html>