Coldfusion Manipulating image with custom text and add custom image

178 Views Asked by At

Found posts with PDFs to improve the quality but not with images. This is first time working with images and apologize if it is duplicate or silly question.

Have an image with high resolution, adding text to image using x and y coordinates. Final image loses its resolution.

Goal: Keeping the image resolution intact, final image will have custom text and add custom images like electronic signature, custom text image to exiting image. I'm stuck at even keeping resolution after adding custom text. Didn't even made an attempt to add image.

Coldfusion version: 2018 standard

Image properties from coldfusion function before changes

coldfusion-properties

Image properties from actual image

image-properties

Final image quality

final-image-properties

<cfoutput><cfscript>

    variables.string = "test string";

    variables.dupImage = ImageNew("test.jpg");

    ImageResize(variables.dupImage,800,600);

    ImageScaleToFit(variables.dupImage,800,600);

    ImageSetDrawingColor(variables.dupImage,"black");

    variables.attributeCollect = {};

    variables.attributeCollect["font"] = "arial";

    variables.attributeCollect["size"] = 17;

    variables.attributeCollect["style"] = "bold";

    //ImageDrawText(variables.dupImage, variables.string, 115, 190,variables.attributeCollect);

    variables.dupImage.drawText(variables.string, 115, 220,variables.attributeCollect);

    //ImageScaleToFit(variables.dupImage,3300,"");

</cfscript></cfoutput>

<cfimage source="#variables.dupImage#" action="writeToBrowser">
0

There are 0 best solutions below