Tools for Web Developers

PerthWeb Developer : Products

ImageProc : Examples

RESIZE IMAGE

Use the following code to resize an existing file horizontally (vertical sizing will be proportional) to 300 pixels.

     <cfx_pwimageproc infile="c:\directory\file.jpg"
	                     set_width="300"> 

This code will resize an existing file vertically (horizontal sizing will be proportional) to 150 pixels.

     <cfx_pwimageproc infile="c:\directory\file.jpg"
                      set_height="150">

This will resize an existing file vertically and horizontally to 100 pixels, and save it with a new file name (leaving the original file as is).

     <cfx_pwimageproc infile="c:\directory\file.jpg"
                      outfile="c:\directory\newfile.jpg"
                      set_height="100"
                      set_width="100">

ROTATE & FLIP IMAGE

This code will rotate the image 45°.

     <cfx_pwimageproc infile="c:\directory\file.jpg"
                      set_rotate="45">

This code will rotate the image 135° and flip it horizontally.

     <cfx_pwimageproc infile="c:\directory\file.jpg"
                      set_rotate="135"
                      set_flip="horizontal">

This code will rotate the image 190°, flip it vertically, set the background colour to black and save it as a new file.

     <cfx_pwimageproc infile="c:\directory\file.jpg"
                      outfile="c:\directory\newfile.jpg"
                      set_rotate="190"
                      set_flip="vertical"
                      set_rotate_background="000000">

CHANGE COLOUR DEPTH & JPEG COMPRESSION

This will set 40% jpeg compression on the image, change the colour depth to 8bit (256 colours) and save it as a new file.

     <cfx_pwimageproc infile="c:\directory\file.jpg"
                      outfile="c:\directory\newfile.jpg"
                      jpg_quality="60"
                      set_colordepth="8">

IMAGE TEXT

The following code will add the text "Developed by PerthWeb" to the specified file. The text will be white, size 14, using the Verdana font face, and be placed in the middle of the image.

     <cfx_pwimageproc infile="c:\directory\file.jpg"
                      text_draw="Developed by PerthWeb"
                      text_colour="FFFFFF"
                      text_font_name="Verdana"
                      text_font_size="14"
                      text_x="c"
                      text_y="m">

The following code will add the text "Developed by PerthWeb" to the specified file. The text will be white, bold, size 12, using the Arial font face, bold, italic, placed in the top left hand corner, and be 75% transparent.

     <cfx_pwimageproc infile="c:\directory\file.jpg" 
                      text_draw="Created by PerthWeb" 
                      text_color="FFFFFF" 
                      text_bold="yes" 
                      text_italic="yes" 
                      text_font_name="Arial" 
                      text_font_size="12" 
                      text_x="l" 
                      text_y="t" 
                      text_transparency="75"> 


This code will add the text "Created by PerthWeb" (white, bold, size 12, tahoma, top left corner) and cfx_pwimageproc 2 (black, italic, size 14, arial, 85% transparent, 200 pixels down and 200 pixels across from top left) to the specified file.

     <cfx_pwimageproc infile="c:\directory\file.jpg" 
                      text_draw="Created by PerthWeb,cfx_pwimageproc 2" 
                      text_color="FFFFFF,000000" 
                      text_bold="yes,no" 
                      text_italic="no,yes" 
                      text_font_name="Tahoma,Arial" 
                      text_font_size="12,14" 
                      text_x="l,200" 
                      text_y="t,200" 
                      text_transparency="0,85">

COLOR DEPTH & JPEG COMPRESSION

This will set 40% jpeg compression on the image, change the colour depth to 8bit (256 colours) and save it as a new file.

		 <cfx_pwimageproc infile="c:\directory\file.jpg" 
                      outfile="c:\directory\newfile.jpg" 
                      jpg_quality="60" 
                      set_colordepth="8"> 

ADDING BORDERS

This code will add a 2 pixel black border to the image 'file.jpg'.

		 <cfx_pwimageproc infile="c:\directory\file.jpg" 
                      outline_draw="yes" 
                      outline_width="2" 
                      outline_color="000000">

ADDING WATERMARKS

This code will add the file 'logo.jpg' as a watermark to the image 'file.jpg'. The watermark will be placed in the bottom left hand corner.

		 <cfx_pwimageproc infile="c:\directory\file.jpg" 
                      watermark_image="c:\other\directory\logo.jpg" 
                      watermark_x="l" 
                      watermark_y="b">