Marblecore Imaging Library Documentation

Documentation Introduction

Getting started with the ATL/COM object

The ATL/COM version of the Marblecore Imaging Library is a very fast and easy way to use the component in your software projects. It can be used in all kinds of languages and environments, like ASP, VBScript, JScript, JavaScript, Windows Script Host and many others. The only thing you need to do is to install the component on each computer where you want to run software which depends on the Marblecore Imaging Library. This page describes how to install the component, how to use it in your projects and gives some additional information. If you are programming using the .NET framework, we suggest to use the .NET Class Library.

When to use

Use the ATL/COM version of the component if you like to:
  • Use the component in a scripting language like VBScript, JScript and JavaScript
  • Use the component in classic ASP websites and applications
  • Use the component for batch processing large amount of images (you can use Windows Script Host for this purpose)
  • Automate image processing using a scripting language or macro (VBA)
  • Use the component in other COM/ActiveX aware applications (Microsoft Excel, Microsoft Access, etc.)
  • Use the component as a superior substitute for the old and outdated ASPImage server component.

Available versions

The component is available for different processor architectures. All available versions are included in the download package. Please choose the right version for your system.
  • 32-bit systems (x86): MarblecoreImagingATL.dll
  • 64-bit systems (x64): MarblecoreImagingATL.x64.dll
  • Itanium 64-bit systems (IA-64): MarblecoreImagingATL.ia64.dll

Install the component

To install the component you have to do three things:
  • Download the ATL/COM version of the component from the download page.
  • Extract the files to any location you like (for example 'C:\MarblecoreImaging\').
  • Register the right version of the component, so it's available in your software projects.
To register the component use the regsvr32 tool which is available on every Windows machine. To register the object execute the following command from the command prompt or use the Windows Run dialog (make sure you have administrative permissions):
regsvr32 <YourInstallationLocation>\MarblecoreImagingATL.dll
So if you extrated the component to 'C:\MarblecoreImaging\', the command will be:
regsvr32 C:\MarblecoreImaging\MarblecoreImagingATL.dll
If the registration succeeded the following message will appear: DllRegisterServer in MarblecoreImagingATL.dll succeeded. If you receive an error message, check the path to the component DLL and make sure you are executing the command with enough administrative permissions (e.g. as an administrator). If you want to use the 64-bit version, change the filename in the command above to the right version.

How to use

To use the component you have to create an object to interact with the library. The exact code to do this depends on the language you are using. But, mostly there is a method called CreateObject available to create an object from a registered COM object (in ASP the call is Server.CreateObject and in Windows Script WScript.CreateObject). After creating the object you can interact with it and call all the methods and properties as documented.


Below are some examples for different languages and applications. The first two examples show you how to use the Marblecore Imaging Library in ASP scripts. The third example shows how to use it in Windows Script Host.
Example 1 | Classic ASP implementation using VBScript to create an image and return it to the client
2 <%
4 Dim Image
6 ' Create a new image object
7 Set Image = Server.CreateObject("Marblecore.Imaging")
9 ' Create a new image of 200x200 pixels
10 Image.Create 200, 200
12 ' Draw a red filled rectangle on it
13 Image.DrawRectangleFilled 0, 0, 200, 200, Image.GetColorFromHTML("#ff0000")
15 ' Set the content type and write the image to the response stream
16 Response.ContentType = Image.GetMIMEFromFormat("PNG")
17 Response.BinaryWrite Image.SaveToStream("PNG")
19 %>
Example 2 | Classic ASP implementation using JScript to create an image and return it to the client
2 <%
4 // Create a new image object
5 var pImage = Server.CreateObject("Marblecore.Imaging");
7 // Create a new image of 200x200 pixels
8 pImage.Create(200, 200);
10 // Draw a red filled rectangle on it
11 pImage.DrawRectangleFilled(0, 0, 200, 200, pImage.GetColorFromHTML("#ff0000"));
13 // Set the content type and write the image to the response stream
14 Response.ContentType = pImage.GetMIMEFromFormat("PNG");
15 Response.BinaryWrite(pImage.SaveToStream("PNG"));
17 %>
Example 3 | Draw and save an image with Windows Script Host using JScript
1 // Create a new image object
2 var pImage = WScript.CreateObject("Marblecore.Imaging");
4 // Create a new image of 200x200 pixels
5 if (pImage.Create(200, 200)) {
6     // Draw a red filled rectangle on it
7     pImage.DrawRectangleFilled(0, 0, 200, 200, pImage.GetColorFromHTML("#ff0000"));
9     // Save the image to a file
10    pImage.SaveToFile("example.jpg");
11 }
To run this example, save the code above to example.js and execute the following command:
cscript example.js //NoLogo

Apply a license

If you have bought a Marblecore Imaging license, you need to supply your license data to confirm you are a licensed user. License verification is very simple and performed by adding the LicenseVerify method to your code. Take a look at the getting started with licenses page for more information.

Security settings

The Marblecore Imaging Library will be executed using the security permissions of the script host. For example, if you use the component in ASP, the ASP application pool determines the account under which the component runs. You have to make sure the right account has the right permissions on the component DLL file. You can set those permissions in the file security dialog (right click on the DLL, select properties, go to the security tab). The account needs 'read & execute' permission on the DLL.

Removing the component

If you want to uninstall the component, you have to unregister it using the regsvr32 tool. Use the following command executed with administrative permissions:
regsvr32 <YourInstallationLocation>\MarblecoreImagingATL.dll /u

Using the 32-bit version on 64-bit systems

It is possible to use the 32-bit version of the component on 64-bit systems. To do this you have to use another version of the regsvr32 tool. The standard version is used to register 64-bit versions of components. To register the 32-bit version, use the following command:
\windows\syswow64\regsvr32 <YourInstallationLocation>\MarblecoreImagingATL.dll
The 32-bit version can only be used by applications which run as a 32-bit process. If you are using Marblecore from ASP, check to see if IIS is running in 32-bit or 64-bit mode to determine which version you need. If you use Marblecore in VB6 applications, you always need the 32-bit version. This may also apply to older versions of other programming languages such as Delphi, FoxPro, etc. There is no harm in downloading and registering both the 32-bit and 64-bit versions of Marblecore. Windows has separate registries for 32-bit and 64-bit components. Both versions may be registered.


Classic ASP website example (VBScript) | Classic ASP website example (JScript) | Windows Script Host example

See also

Download | Buy license | Getting started with licenses | Getting started with the Class Library