1. The What is AspJpeg?

AspJpeg is a powerful network based image processing component of the Microsoft IIS environment, its detailed and in-depth introduction Chinese article is not much, even if there is generally only involves the image thumbnails and image watermark, which with its English The version has a close relationship. AspJpeg can use a few lines of code in your ASP / ASP.NET application to dynamically create high-quality thumbnails like Supported image formats: JPEG, GIF, BMP, TIFF, PNG The can do AspJpeg: Merge pictures pictures cutting image effects database support verification code technology to generate thumbnail images generated watermark image GIF dynamic picture create, modify, …

2. Summary of aspjpeg function

Support JPEG, GIF, BMP, TIFF and PNG format Source The picture can be derived from the disk, memory, or set of records (database) Adjusted picture can be saved to disk, memory, or HTTP streaming Support three types of change the size of the algorithm: Nearest Neighbor, Bilinear, Bicubic Add a picture or text in the picture above, support for TrueType and Type 1 fonts The words wrap, text alignment: left, right, center, at both ends, picture rotation Support Picture-in-Picture Shear, flip, rotate, sharpen, grayscale adjustment You can adjust the compression ratio to get the best output effect and size EXIF and IPTC metadata extracted from the JPEG image Preservation metadata change the picture Add and edit IPTC metadata CMYK to RGB The tan filter habitats (the aging photo style) Arbitrary pixel from the image read / write access PNG alpha channel support GIF transparent support Adjustment of brightness, contrast and saturation The GIF output transparency and animation to save And JPEG GIF format conversion

3. AspJpeg System Requirements

Windows NT/2000/XP/2003/Vista, and IIS 4.0 + and ASP / ASP.NET, or Visual Basic 5.0 +, or Visual C + + 5.0 +, or any development environment supporting COM.

4. AspJpeg installation The new installation:

To the official website to download a 30-day fully functional evaluation version 32 version (aspjpeg.exe the end of the current version 2.0, file size: 1.75M Last updated: 2008.01.28) and 64-bit version (aspjpeg64.exe deadline The current version is 2.0, File size: 1.35M last updated: 2008.02.25, does not contain the document) The running downloads aspjpeg.exe or aspjpeg64.exe When prompted to enter the serial number, enter a valid serial number can not input that will be used by the representative of the 30-day evaluation version, you can change the registry RegKey to register If the installation location disk format is NTFS, you may access issues, the need to manually set the anonymous user have read aspjpeg.exe permissions.

Update installation: If mounted before other versions AspJpeg components, you need to uninstall the original components, then the installation of the new version. First stop IIS: net stop iisadmin / y Uninstall the old components: regsvr32 / u Path / aspjpeg.dl (Path to the installation path) Restart IIS: Net Start w3svc Then a fresh install or copy the Bin directory AspJpeg.dll file to the installation directory for manual installation: Program code regsvr32 Path / aspjpeg.dll (Path to the installation path) If the normal installation process does not enter the serial number or update installation you need to add the following items to register in the registry, for convenience, you can directly save the following code for key.reg document and import the registry:

Program code

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE / Software / Persits Software / AspJpeg / RegKey] @ = “17361-38566-42221”

In addition, you can RegKey property by aspjpeg object code layer to set the registration code, as follows:

  1. Set Jpeg = Server.CreateObject (“Persits.Jpeg”)
  2. Jpeg.RegKey = “12345-67890-12345”   
  1. Set Jpeg = Server.CreateObject(“Persits.Jpeg”)  
  2. Jpeg.RegKey = “12345-67890-12345”  
  3. …   

7, how to AspJpeg components to create image thumbnails? 

  1. <%
  2.  Set Jpeg = Server.CreateObject (“Persits.Jpeg”) ‘Create aspjpeg object instance   
  3. Path = Server.MapPath (“.. / Images / apple.jpg”) ‘set the picture path   
  4. Jpeg.Open Path ‘open the picture   
  5.  ‘Adjust the width and height of the original 50%   
  6. Jpeg.Width = Jpeg.OriginalWidth / 2
  7. Jpeg.Height = Jpeg.OriginalHeight / 2
  8. Jpeg.Save Server.MapPath (“apple_small.jpg”) ‘save the image to disk   
  9. Jpeg.Close: Set Jpeg = Nothing   
  10. %>
  1. <%   
  2. Set Jpeg = Server.CreateObject(“Persits.Jpeg”)    ‘ASPJpeg  
  3. Path = Server.MapPath(“../images/apple.jpg”)      
  4. Jpeg.Open Path                                      
  5. ‘50%  
  6. Jpeg.Width = Jpeg.OriginalWidth / 2  
  7. Jpeg.Height = Jpeg.OriginalHeight / 2  
  8. Jpeg.Save Server.MapPath(“apple_small.jpg”)          
  9. Jpeg.Close:Set Jpeg = Nothing  
  10. %>  

8, how to AspJpeg components to create a picture watermark? 

  1. <%
  2.  Set Jpeg = Server.CreateObject (“Persits.Jpeg”)
  3. Jpeg.Open Server.MapPath (“2.jpg”)
  4.  ‘Began to write text   
  5. Jpeg.Canvas.Font.Color = & 000000 ‘red color   
  6. Jpeg.Canvas.Font.Family = “Courier New”      ‘Font   
  7. Jpeg.Canvas.Font.Bold = true      ‘Whether the bold   
  8. Jpeg.Canvas.Print 10, 10, “Copyright (c) XYZ, Inc.”     
  9.  Print coordinates of the ‘Print coordinates x y need to print characters   
  10.  ‘The following image border   
  11. Jpeg.Canvas.Pen.Color = & H000000 ‘black color   
  12. Jpeg.Canvas.Pen.Width = 2 ‘pen width   
  13. Jpeg.Canvas.Brush.Solid = False      ‘Whether the thickening process   
  14. Jpeg.Canvas.Bar 1, 1, Jpeg.Width, Jpeg.Height
  15.  ‘Starting X coordinate of the starting Y coordinate input length of the input of highly   
  16. Jpeg.Save Server.MapPath (“1.jpg”) ‘save   
  17. %>
  1. <%   
  2. Set Jpeg = Server.CreateObject(“Persits.Jpeg”)   
  3. Jpeg.Open Server.MapPath(“2.jpg”)   
  4. ‘   
  5. Jpeg.Canvas.Font.Color = &000000    ‘red    
  6. Jpeg.Canvas.Font.Family = “Courier New”    ‘   
  7. Jpeg.Canvas.Font.Bold = True    ‘   
  8. Jpeg.Canvas.Print 10, 10, “Copyright (c) XYZ, Inc.”   
  9. ‘x y    
  10. ‘   
  11. Jpeg.Canvas.Pen.Color = &H000000    ‘black    
  12. Jpeg.Canvas.Pen.Width = 2    ‘   
  13. Jpeg.Canvas.Brush.Solid = False    ‘   
  14. Jpeg.Canvas.Bar 1, 1, Jpeg.Width, Jpeg.Height   
  15. ‘X Y     
  16. Jpeg.Save Server.MapPath(“1.jpg”)    ‘   
  17. %>  

9, how to AspJpeg components merge pictures? 
AspJpeg 1.3 + enables you to place images on top of each other via the method DrawImage. To use this method, you must create two instances of the AspJpeg objects and populate both of them with images via calls to Open (or OpenBinary). When calling Canvas.DrawImage, the 2nd instance of AspJpeg is passed as an argument to this method, along with the X and Y offsets (in pixels): 
Use this method, you must to create two AspJpeg instance object 

  1. <%
  2.  Set Jpeg1 = Server.CreateObject (“Persits.Jpeg”)
  3.  Set Jpeg2 = Server.CreateObject (“Persits.Jpeg”)
  4. Jpeg1.Open Server.MapPath (“t.jpg”)
  5. Jpeg2.Open Server.MapPath (“t1.jpg”)
  6. Jpeg1.Canvas.DrawImage 10, 10, Jpeg2 ‘optional arguments omitted   
  7. Server.mappath (“tt.jpg”)
  8. %>
  1. <%  
  2. Set Jpeg1 = Server.CreateObject(“Persits.Jpeg”)  
  3. Set Jpeg2 = Server.CreateObject(“Persits.Jpeg”)  
  4. Jpeg1.Open Server.MapPath(“t.jpg”)  
  5. Jpeg2.Open Server.MapPath(“t1.jpg”)  
  6. Jpeg1.Canvas.DrawImage 10, 10, Jpeg2 ‘ optional arguments omitted  
  7. Server.mappath(“tt.jpg”)  
  8. %>  

10, how to AspJpeg component picture cutting? 

AspJpeg 1.1 + is also capable of cutting off edges from, or cropping, the resultant thumbnails via the method Crop (x0, y0, x1, y1). The size of the cropped image is specified by the coordinates of the upper-left and lower -right corners within the resultant thumbnail, not the original large image. 

  1. <%
  2.  Set Jpeg = Server.CreateObject (“Persits.Jpeg”)
  3. Jpeg.Open Server.MapPath (“t.jpg”)
  4. jpeg.Crop 20, 30, jpeg.Width – 20, jpeg.Height – 10
  5. Server.mappath (“tt.jpg”)
  6. Response.Write (“the src=tt.jpg>)</img 
  7. %>
  1. <%  
  2. Set Jpeg = Server.CreateObject(“Persits.Jpeg”)  
  3. Jpeg.Open Server.MapPath(“t.jpg”)  
  4. jpeg.Crop 20, 30, jpeg.Width – 20, jpeg.Height – 10   
  5. Server.mappath(“tt.jpg”)  
  6. Response.write(“</img src=tt.jpg>)  
  7. %>