Home
Products
Forums
Help
Publish Article
ImagOMatix
ImagoMatix - Samples and Examples

There has been a change in the recent shipping version of Professional version. The PROGID of the component has been changed to NETOMATIX.ImagePro. This PROGID will not be changed for rest of the life of this component. Customers who bought the component before 8/1/2003 can keep using NETOMATIX.ImageEngine as PROGID.

Example1 - Determining Size Of Image

<%@Language=javascript%>
<%
	Response.Buffer = true;
	var obImgEngine = null;
	var obImage = null;
	try
	{
		// Create image charting engine.
		obImgEngine = Server.CreateObject("NETOMATIX.ImageEngine");
		var strImgFile = Server.MapPath("CD001.jpg");
		obImage = obImgEngine.GetImageSize(strImgFile);
		Response.Write("Width: " + obImage.Width);
		Response.Write("<br>");
		Response.Write("Height: " + obImage.Height);
	}
	catch  (ex)
	{
		Response.Write(ex.description);
	}
%>
						

Example2 - Creating Thumbnail Image

<%@Language=javascript%>
<%
	Response.Buffer = true;
	var obImgEngine = null;
	var obImage = null;
	try
	{
		obImgEngine = Server.CreateObject("NETOMATIX.ImageEngine");
		var strImgFile = Server.MapPath("CD001.jpg");
		var strDestFile = Server.MapPath("uploadedfiles/CD001_th.jpg");
		obImgEngine.CreateThumbnail(strImgFile, strDestFile, 30, 30, 0, 1);
	}
	catch  (ex)
	{
		Response.Write(ex.description);
	}
%>
						

Example3 - Merging two images

<%@Language=javascript%>
<%
	Response.Buffer = true;
	var obImgEngine = null;
	var obImage = null;
	try
	{
		obImgEngine = Server.CreateObject("NETOMATIX.ImageEngine");
		var x = 0;
		var y = 0;
		var strImgFile = Server.MapPath("CD001.jpg");
		var strLogoImage = Server.MapPath("logo.jpg");
		var strDestFile = Server.MapPath("uploadedfiles/CD001_masked.jpg");
		obImgEngine.MergeImages(strImgFile, strLogoImage, strDestFile, 3, 1, x, y);
	}
	catch  (ex)
	{
		Response.Write(ex.description);
	}
%>
						

Example4 - Writing text on an image

<%@Language=javascript%>
<%
	Response.Buffer = true;
	var obImgEngine = null;
	var obImage = null;
	try
	{
		obImgEngine = Server.CreateObject("NETOMATIX.ImageEngine");
		var x = 0;
		var y = 0;
		var strImgFile = Server.MapPath("CD001.jpg");
		var strLogoText = "Pardesi Logo";
		var obFont = pImageEngine.GetFontObject();
		var obColor = pImageEngine.GetColorObject();
		
		obColor.R = 255;
		obColor.G = 0;
		obColor.B = 255;
		
		obFont.Name = "Arial";
		obFont.Size = 12;
		obFont.Bold = true;
		
		var strDestFile = Server.MapPath("uploadedfiles/CD001_text.jpg");
		obImgEngine.
		 WriteTextOnImage(strImgFile, strDestFile, strLogoText, 1, x, y, obFont, obColor, 1);
	}
	catch  (ex)
	{
		Response.Write(ex.description);
	}
%>
						

Example5 - Applying Color Filter

<%@Language=javascript%>
<%
	Response.Buffer = true;
	var obImgEngine = null;
	var obImage = null;
	var obColor = null;
	try
	{
		// Create image charting engine.
		obImgEngine = Server.CreateObject("NETOMATIX.ImageEngine");
		var strImgFile = Server.MapPath("CD001.jpg");
		var strDestFile = Server.MapPath("uploadedfiles/greyimage.jpg");
		obColor = obImgEngine.GetColorObject();
		obColor.R = 255;obColor.G = 0; obColor.B = 0;
		obImgEngine.CreateGreyScaleImage(strImgFile, strDestFile, obColor, 0);
	}
	catch  (ex)
	{
		Response.Write(ex.description);
	}
%>
						

Example6 - Stream Image Directly To ASP Page

<%@Language=javascript%>
<%
	Response.Clear();
	Response.Buffer = true;
	Response.AddHeader("pragma", "no-cache");
	Response.AddHeader("cache-control", "private");
	Response.CacheControl = "no-cache";

	var obImgServer = null;
	var obStream = null;
	try
	{
		//
		// Create image processing engine.
		//
		
		obImgServer = Server.CreateObject("NETOMATIX.ImageServer");
		var strImgFile = Server.MapPath("CD001.jpg");
		obStream = Server.CreateObject("ADODB.Stream");
		obStream.Type = 1;
		obStream.Open();
		obImgServer.ResizeImageToStream(strImgFile, obStream, 75, 50, 2, 0);
		obStream.Position=0;
		Response.ContentType = "image/jpeg";
		Response.BinaryWrite(obStream.Read());
		Response.End();
	}
	catch  (ex)
	{
		Response.Write(ex.description);
	}
%>						
						
Go Freelance
Home     About us     Contact us    Copyright    Privacy Policy    Return Policy    Advertisers
Copyright © Netomatix