4 Replies Latest reply on Nov 8, 2007 7:05 PM by Newsgroup_User

    Image compression

    Keiko

      Dear all,

      In CF 8, is there any function to compress an uploaded image so the size is smaller to display on browser? If I use cfzip, I cannot display it as jpg / gif, right?

      Looking forward for your reply.

      Thanks in advance
      Keiko
        • 1. Re: Image compression
          ToBeNamedLater
          No. Images are already compressed. If you zip them, you run the risk of actually making them larger because of the zip overhead on an already compressed file. You don't zip a zip, in other words.

          That said, there are some exceptions. Uncompressed jpegs or raw files as they come directly off your camera, for example. TIFs and BMPs can also be compressed. But you would be unlikely to be able to compress any file that's already been optimized for the web.
          • 2. Re: Image compression
            Level 7
            do you mean 'compress' as in 'use a file compression utility on an image
            file to reduce the amount of space it occupies on a disk',
            or 'compress' as in 'resize an image file to smaller WxH pixel size',
            or 'compress' as in 'resample an image file to lower dpi settings to
            reduce its size in KB',
            or 'compress' as in 'lower the quality of an image file to reduce its
            size in KB'?

            --

            Azadi Saryev
            Sabai-dee.com
            http://www.sabai-dee.com
            • 3. Re: Image compression
              Keiko Level 1

              Thanks ToBeNamedLater and Azadi for your replies.

              Yes, 'compress' as in 'use a file compression utility (cf tag or cf function is preferred) on an image file to reduce the amount of space it occupies on a disk' so I can load faster on browser.

              If the above tag/function does not exist, how about
              1. 'compress' as in 'resample an image file to lower dpi settings to reduce its size in KB'
              2. 'compress' as in 'lower the quality of an image file to reduce its size in KB'

              The objective is to load the images faster on browser. If you google, there are quite number of products that offer compression. But can we do it from the coldfusion 8 itself?

              Thanks in advance
              Keiko

              • 4. Re: Image compression
                Level 7
                Keiko wrote:
                > The objective is to load the images faster on browser. If you google, there
                > are quite number of products that offer compression. But can we do it from the
                > coldfusion 8 itself?

                cf 8's image handling bits can:
                - thumbnail your images (reduce the image size)
                - lower the quality of JPEG images