AspJpeg adjusting Image Compression (advanced users only)
The JPEG format uses "lossy" compression methods. This means is some minor details of an image saved as a JPEG are lost during compression. The degree of loss can be adjusted via the JPEG. Quality property. This property accepts a integer in the range 0 to 0 being the highest degree of loss (and hence, the lowest qua lity) and being the lowest degree of loss and highest quality.
The lower the loss, the larger the resultant file size. The property JPEG. Quality is set to-by default which provides a close-to-optimal combination of Quality and file size. Changing this property is generally to not recommended.
AspJpeg Object Reference
AspJpeg Properties
Expires as Date (read-only)
Returns the component ' s expiration date. If A valid registration key is installed, returns 9/9/9999.
Height as Long (read/write)
Specifies a new image height (in pixels). Must be called on an image is opened via the Open method.
Interpolation as Long (Read/write)
Specifies an image resizing algorithm. The following values are currently supported:0 (Nearest-neighbor), 1 (bilinear, default) and 2 (bicubic).
The Nearest-neighbor (NN) is the fastest but provides low-quality thumbnails.
The Bilinear method offers much better thumbnail quality but is approximately 2 times as slow as NN.
The Bicubic method are approximately twice as slow as bilinear and 4 times as slow as NN, but supposedly offers the highest Quality. In many cases, however, it provides little, if any, noticeable improvement on the bilinear method.
Default:1 (bilinear).
OriginalHeight as Long (read-only)
Returns the original image height (in pixels). Can only being called after a image is opened via the Open method. Use this property to preserve the original aspect ratio of the.
OriginalWidth as Long (read-only)
Returns the original image width (in pixels). Can only being called after a image is opened via the Open method. Use this property to preserve the original aspect ratio of the.
Quality as Long (read/write)
Specifies the degree of compression loss. Affects the resultant image quality and file size.
Accepts an integer value in the range 0 to 0 being the lowest quality, highest loss and smallest file size. The higher the value the higher the image quality, and the larger the file size.
The property Quality was set to-by default which offers a close-to-optimal combination of of image Quality and file size. Changing this property is generally to not recommended.
Width as Long (read/write)
Specifies a new image width (in pixels). Must be called on an image is opened via the Open method.
AspJpeg Methods
Sub Close ()
Closes a file opened via the Open method. This are called automatically upon the destruction of the AspJpeg object, so did not have to call it explicitly, Unless there is a immediate need to free of the file handle (such as, if you are need to delete the file).
Sub crop (x0 as long, y0 as long, X1 as long, y1 as Long)
Cuts edges off of a thumbnail. To take effect, your must call it before calling. Save or. Sendbinary.
The arguments (x0, y0) and (x1, y1) are the coordinates of the upper-left and lower-right corners of the desired I Mage within the thumbnail. For example, if the original large image is-pixels wide and pixels high, the following sequence'll produce a CRO pped thumbnail which are pixels wide and pixels high:
Jpeg.width = 120
Jpeg.height = 80
' Crop pixels from left to top.
' Make image size by 40.
Jpeg.crop 20, 30, 80, 70
Sub Fliph ()
Flips the resultant thumbnail horizontally. To take effect, your must call it before calling. Save or. Sendbinary.
Sub FLIPV ()
Flips the resultant thumbnail vertically. To take effect, your must call it before calling. Save or. Sendbinary.
Sub Open (Path as String)
Opens a JPEG image for resizing. Path must is a physical path to the image.
Sub Save (Path as String)
Resizes the currently opened image using parameters specified by various properties. Save the resultant image thumbnail to a file specified by Path. If a file with this name already exists it would be overwritten.
Sub sendbinary (Optional contentdisposition)
Resizes the currently opened image using parameters specified by various properties. Sends the resultant image directly to the client browser by internally calling. Automatically sets the Content-type header to "Image/jpeg".
If Contentdisposit