Search code examples
imagecoldfusionresizecfimage

How to avoid resized images being blurred in Coldfusion?


I'm resizing and saving some images using Coldfusion8. However, all images, no matter what size are blurred and I don't know how to turn it off.

This is what I'm doing:

<cfimage action="read" source="#variables.basePath#" name="base">
<cfscript>
    variables.height = 127;
    variables.width = "";
    ImageScaleToFit(base, variables.width, variables.height);
    variables.offset = ImageGetWidth( base ) - 100;
    if ( variables.offset GT 0 )
    {
        imageCrop( base, variables.offset/2, 0, 100, 127 );
    }
    variables.filekey = "s_" & img_paths.bilddateiname;
    variables.filename = variables.tempDirectory & variables.keyName;
    imageWrite( base, variables.filename, ".99" );
 </cfscript>

Any idea what I'm doing wrong? The images are blurred no matter if I convert to 800x1110px or the above 100x127. The base picture is sharp, so it must be something I'm doing when resizing.

Thanks for inputs!

EDIT: original image:

enter image description here

resized image:

enter image description here


Solution

  • Using CF9.0.2

    Using your source jpeg, your code, and hardcode the output to be y.jpg:

    8KB

    What's wrong? Isn't this what you expect?