danielhordern.com

BitmapCom - an ASP ActiveX component for manipulating bitmaps on the server. Developed in Visual C++ / ATL 3 (no mfc). Supports loading and saving in BMP and JPEG file formats. From an asp script BitmapCom would typically be used to load bitmaps from a file or from a database field. The bitmap can be manipulated, then sent directly to the client, or saved back into a databasefield.

Properties

  • Width

  • Height

  • BitsPerPixel

Members

  • LoadFromFile( Filename )
  • LoadFromArray( Array )
  • LoadFromADOField( ADORecordSetObj, FieldName )
  • Write2ADOField( ADOFieldObj, Width, Height, BitmapFormat )
  • Write2ASPResponse( Width, Height )
  • Write2Array( Width, Height, BitmapFormat ) returns array
  • Resample( Width, Height )
  • Blur( Amount )
  • FlipHorizontal()
  • FlipVertical()
  • Sharpen( Amount )
  • Greyscale()
  • Blend( SrcBitmapCom, DestX, DestY, Alpha )

Example script:

Test javasript code:

    <%
        var filename    = 'images/samplebitmap.jgp';
        try
        {
            // create object
            var oBitmap = Server.CreateObject('BitmapComponent.BitmapCom');
            
            // load bitmap
            filename = Server.MapPath( filename );
            oBitmap.LoadFromFile(filename);
            
            // display info about bitmap
            Response.Write('Width=' + oBitmap.Width + ' Height=' + oBitmap.Height + '<br>');
            Response.Write('BitsPerPixel=' + oBitmap.BitsPerPixel  + '<br>');
        }
        catch(e)
        {
            Response.Write('exception: ' + e.description + '<br>');
        }
    %>    

Development notes and scripting examples