Following the migration from Adobe Coldfusion to Lucee, we have just noticed that the weight of the images that we create with cfimage resize remain rather high, much more than before. From memory we used imageCR3. On Lucee, for example, resizing a jpg image so that it is 140 pixels by 140 pixels, regardless of whether I set the quality attribute to 0.10 or 0.75, the weight remains around 750 kb. It seems huge for such a small jpg image.
What is fascinating is that changing the quality of 75% to 10%, it barely reduces the file size (ex: 758 KB to 755 KB), but the image quality is reduced drastically. We see large pixels.
I read this thread, but it’s from 2015. It was discussed to remove Lucee’s core image processing to an extension and it was done.
My question is: Is it known that Lucee’s cfimage tag does not compress images well and the weight is high even today?
Thank you for your support!
OS: Windows Server 2016 (10.0) 64bit
Java Version: 1.8.0_181 (Oracle Corporation) 64bit
Tomcat Version: Apache Tomcat/8.5.33
Lucee Version: Lucee 18.104.22.168
Tony, before moving from ACF had you been using the interpolation attribute of cfimage to help control that size/quality? I can’t tell from cfdocs.org if lucee supports that specific attribute/argument. If not, it might even ignore it, if you did have it.
But if it supports it, and you’re not using it, check out if it may help. The default is highestquality, and lowering it can dramatically improve performance and yet not necessarily reduce quality, as I discussed in a post here (gosh, 10 yrs ago, but still holding true for ACF):
My focus there was indeed performance rather than resulting size, but it may still help you.
I didn’t use the interpolation attribute on cfimage before. I used imageCR3 and cfimage with just the quality attribute. I saw the attribute interpolation in the documentation, but it look it it doesn’t exists for
I’ll try to use
image.resize instead and come back to let you know.
I tried this with differents values for the interpolation attribute, but the file size stay high (over 750 Kb for a 140 pixels by 140 pixels image).
Am I doing something wrong?
Note : I took a look at the source code of Lucee’s image extension, and the interpolation attribute seems well and truly supported.
In your last example, there’s no quality setting in imageWrite.
You are right. I added the attribute quality with a value of 0.10. The image is ugly, and the file size still very high. I’m starting to feel there is something wrong with the batch of images I’m trying. I asked the client to send me the original files to figure it out. I’ll try again later with fresh new images.
Maybe color profile or exif data remaining? I tested and my 50KB went to 3KB.
Well, do try it on cfimage. It may work and yet not be documented. I’m on a phone as I write, and cfimage is not supported at all on trycf.com. Or sure, try the script alternative (which is why I’d mentioned it being an attribute or an argument).
Let us know how both go.
You got it! I opened the file in Photoshop > File > File Info… > Raw Data and boom! Almost 900 Ko of data just there. I’m going to look a solution to remove the data on upload. It’s probably just with ImageWrite and noMetaData attribute. Will look into it tomorrow.
Just by doing this, it’s clear the most part of the EXIF data like Blue TRC, Green TRC, Red TRC, and more :
and the file size becomes reasonable!
All the images files of the client have a lot of Raw Data. The client use a photoshop template to generate all the images and was not using the Save for Web function in Photoshop. So it keeps all the Raw Data on upload. It’s why all the batch of images had this problem. The Raw Data look like it :
........ + hundreds of rows
Thank you to all of you! Your help was very useful to me!