The L_AutoFixBitmapResolutionOptions structure provides the information needed to automatically convert the resolution of digital photos in LEADTOOLS toolkits.
Size of the structure. Use sizeof(L_AutoFixBitmapResolutionOptions) to calculate this value. Before L_AutoFixBitmapResolutionOptions can be passed to any LEAD function, uStructSize must be set.
|uFlags||Reserved for future use. Set to 0.|
The minimum resolution acceptable for digital photos. This is the setting that determines whether a bitmap originated as a digital photo. Any photo or bitmap with a resolution less than nMinResolution will be automatically converted. Bitmaps with a resolution equal to or greater than this value will not be converted.
Most digital cameras seem to set the resolution to 72, so 96 is a good value for nMinResolution. The default value is 96, which means "automatically convert the resolution in bitmaps with XResolution < 96 and YResolution < 96".
Setting nMinResolution to 0 means that no bitmaps or photos will have their resolution converted.
The desired page width for the bitmaps that will be changed, in uUnit units. The default value is 8.5.
The desired page height for the bitmaps that will be changed, in uUnit units. The default value is 11.
|uUnit||Indicates the unit used in dPageWidth and dPageHeight. The following values are possible:|
|RASTERIZEDOC_UNIT_MILLIMETER|| Millimeters||The default value is RASTERIZEDOC_UNIT_INCH.|
Automatic resolution conversion is particularly useful in OCR or Document Writer operations.
Typically, a picture taken with a digital camera does not have good resolution information (DPI). (Images originating from scanners have good resolution information, but images from digital cameras do not.) This is because digital cameras usually set the resolution regardless of the width and height of the image captured. The resolution set is an arbitrary number, often 72 DPI.
An example will illustrate the consequences of using an arbitrary DPI. Suppose you take a 12 Megapixels (3000 x 4000) photo with a digital camera. Keeping the original resolution at 72 DPI, the image would be 41.6 x 55.5 inches. If you then convert this image to PDF without adjusting the resolution, it will generate a PDF file that is 41.6 x 55.5 inches. Loaded using a LEADTOOLS document viewer, the image will be loaded onto many pages (5x5 = 25 pages). Most people do not want or expect that. Therefore, it is preferable to adjust the resolution so the bitmap fits inside a single page.
The following functions take this structure as a parameter:
The settings in L_AutoFixBitmapResolutionOptions are used under the following conditions:
Directly if L_AutoFixBitmapResolution is called.
Indirectly when using LOADFILEOPTION with any load function (L_LoadBitmap, L_LoadFile, L_LoadMemory, etc.) if the ELO2_AUTOFIXBITMAPRESOLUTION flag in LOADFILEOPTION.Flags2 has been set. The load functions use the settings in L_AutoFixBitmapResolutionOptions to determine whether the resolution in a file should be automatically updated to fit inside a rectangle of dPageWidth x dPageHeight in size.
Indirectly if an L_FileInfo (or an equivalent function that retrieves a FILEINFO structure for a file whose resolution should be automatically converted) is called. The XResolution and YResolution members will be set to the converted resolution. In addition, FILEINFO.Flags will have the FILEINFO_CORRECTED_RESOLUTION flag set. See FILEINFO Flags for the other FILEINFO flags.
The fit is a smart fit, which means that if a bitmap's resolution needs to be updated, it will either be adjusted to fit inside a dPageWidth x dPageHeight rectangle, or in a dPageHeight x dPageWidth rectangle, whichever fits best.
The following examples assume the following conditions:
If a Load function or L_AutoFixBitmapResolution is called:
The following example shows how to instruct LEADTOOLS to automatically convert the resolution in digital photos (bitmaps with a resolution less than 96):
if(L_GetAutoFixBitmapResolutionOptions(&options, sizeof(L_AutoFixBitmapResolutionOptions)) == SUCCESS)
options.nMinResolution = 96;
L_INT nRet = L_SetAutoFixBitmapResolutionOptions(&options);
if(nRet != SUCCESS)
Medical Web Viewer .NET
.NET, Java, Android, and iOS/macOS Assemblies
C API/C++ Class Libraries