Search

Atalasoft Knowledge Base

HOWTO: Use an HTML img Tag to View Images Without Using an Atalasoft Viewer

Administrator
DotImage

Background

DotImage can be used to dynamically create a webpage with images on it without using the viewers (thus removing JavaScript and browser requirements). This also is an unsupported way to use an Atalasoft back-end with a mobile platform client via a web browser. In an ASP.NET application create a page with an <img alt="" /> tag:

HTML

<body>
    <form id="form1" runat="server">
    <div>
        <img src="GetImage.ashx?file=Images/doc_to_clean.tif&frame=0"/>
    div>
    form>
</body>

Then create a “GetImage.ashx” file that takes the input and create an interface for selecting the file from the server. Here is our example that takes a file path and a frame:

C#

using System;
using System.Web;
 
using Atalasoft.Imaging;
using Atalasoft.Imaging.Codec;
 
public class GetImage : IHttpHandler 
{ 
    public void ProcessRequest (HttpContext context) 
    {
        context.Response.ContentType = "image/png";
        string file = context.Server.MapPath(context.Request.QueryString["file"]);
        AtalaImage img = new AtalaImage(file, int.Parse(context.Request.QueryString["frame"]), null);
        img.Save(context.Response.OutputStream, new PngEncoder(), null);
    }
 
    public bool IsReusable {get {return false;}}
}

VB.NET

 
Imports System 
Imports System.Web 
 
Imports Atalasoft.Imaging 
Imports Atalasoft.Imaging.Codec 
 
Public Class GetImage 
    Implements IHttpHandler 
    
    Public Sub ProcessRequest(ByVal context As HttpContext) 
        Dim file As String = context.Server.MapPath(context.Request.QueryString("file")) 
        Dim img As New AtalaImage(file, Integer.Parse(context.Request.QueryString("frame")), Nothing) 
        img.Save(context.Response.OutputStream, New PngEncoder(), Nothing) 
    End Sub 
    
    Public ReadOnly Property IsReusable() As Boolean 
        Get 
            Return False 
        End Get 
    End Property 
End Class

Original Article

Q10252 - HOWTO: Use an HTML img Tag to View Images Without Using an Atalasoft Viewer

Last Update

2026-11-23 - TD - (fixed headings and took out bad image)

Details
Last Modified: 6 hours ago
Last Modified By: Tananda
Type: HOWTO
Article not rated yet.
Article has been viewed 24 times.
Options
Also In This Category