Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Coldfusion resize making image files bigger?

So I have an image loader that before it uploads the file to Amazon S3 it optimises the image by using this code:

<cfset ImageScaleToFit(myImage,1260,"")>
<cfset imageWrite(myimage,"newImagelocation", 0.9)>

The odd thing is that if I upload an image that is already 1260 wide and 24k in size, then optimise it using the above code, the image becomes 34k in size.

Why would optimizing an image make it bigger?

like image 416
csber3 Avatar asked Mar 07 '23 18:03

csber3


1 Answers

ColdFusion function ImageScaleToFit() does not do optimization. It just converts the width/height according to arguments. When doing this the algorithm for interpolation is highestQuality by default. Which could sometime increase the size of the file due to underlying mechanism. Even though you are using the 0.9 for quality when you write that only reduces a little bit from the initially pumped up size in ImageScaleToFit() call.

If you wish to reduce the size, then specify any other algorithm which is less costlier than highestQuality.

eg. mediumQuality, highestPerformance etc.

like image 81
rrk Avatar answered Mar 15 '23 17:03

rrk