Not yet rated

Problem

You need to create a seamless mirrored tile pattern from your image so you can use the image as tiled background background.

Solution

You need to use combination of built-in ColdFusion functions like ImageNew, ImageRotate, ImageFlip to create a mirrored pattern.

Detailed explanation

We will use built-in function to create a mirrored pattern from any of your images.

 

The following examples shows what is possible (literal translation: ColdFusion Rocks!):

 

1. The Lost World - Forest.jpg:

Image

Mirrored Forest

 

 2. Tentacles! - Autumn Leaves.jpg

Autumn Leaves

You need to create a mirrored tile pattern from your image so you can use the image as tiled background background.

 

 3. Flowers!

You need to create a mirrored tile pattern from your image so you can use the image as tiled background background.

You need to create a mirrored tile pattern from your image so you can use the image as tiled background background.

 

 4. Me!

You need to create a mirrored tile pattern from your image so you can use the image as tiled background background.

You need to create a mirrored tile pattern from your image so you can use the image as tiled background background.

 

Mirrored Pattern Tiling Code:

 <cfset imgPath = "Garden.jpg" /> 

<cfset originalImage = ImageNew(imgPath) />


<cfscript>

 mirroredTile = ImageNew("", ImageGetWidth(originalImage) * 2,
ImageGetHeight(originalImage) * 2, "rgb");

 

 ImagePaste(mirroredTile,originalImage,ImageGetWidth(originalImage),
ImageGetHeight(originalImage));

 ImageRotate(originalImage, 180, "bicubic"); // generally the
quality of image is highest with bicubic

 ImageFlip(originalImage);

 ImagePaste(mirroredTile,originalImage,0,ImageGetHeight(originalImage));

 ImageFlip(originalImage);

 ImagePaste(mirroredTile,originalImage,0,0);

 ImageFlip(originalImage, "horizontal");

 ImagePaste(mirroredTile,originalImage,ImageGetWidth(originalImage),0);

</cfscript>


<cfimage source="#mirroredTile#" action="write"
destination="Mirrored-#imgPath#" overwrite="yes" />

<cfoutput>

<img src="Mirrored-#imgPath#" />

</cfoutput>
 
 
I hope that code speaks for itself. Have Fun!
 

 


+
This work is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License. Permissions beyond the scope of this license, pertaining to the examples of code included within this work are available at Adobe.

Report abuse

Related recipes