"WSQ image library" for Windows 32-bit (version 5.3)
FBI certified WSQ implementation number:
11281 (scanned certificate)





  

WSQ image library adds the power of WSQ (FBI's Wavelet Scalar Quantization) file format to your software projects using only a few lines of code.
The library also supports JPEG-2000, ANSI/NIST-ITL 1-2000 Type-8 signature and other graphic file formats and allows conversion between them.

Free WSQ Viewer demonstrates capabilities of WSQ image library.


Importance of WSQ format


Electronic fingerprints submitted to the FBI either through Integrated Automated Fingerprint Identification System (IAFIS), or Electronic Fingerprint Image Print System (EFIPS) may not be compressed with any technique other than WSQ.

Licensing of WSQ image library


How long does the license last?
Buy once, use forever!
The license is perpetual. There is no annual fee. There is no timing limitation.
“WSQ image library” is NOT a subscription.
All future updates are included with your one-time purchase at no additional charge.
You will get all updated versions of “WSQ image library” without any additional payment.


Price of WSQ image library


Licensing of “WSQ image library (for Windows 32-bit)” is available in two ways:

1) runtime free/royalty free. This means when you buy such a license, your organization/company can run “WSQ image library (for Windows 32-bit)” on unlimited number of computers.
WSQ image library (for Windows 32-bit) runtime free / royalty free license costs 758.00 U.S. dollars.

2) licensing individual computers. The price for the first license (single developer license) is 189.00 US dollars, and the price for additional client licenses is 19.00 US dollars per license. One license means one computer.
Let you illustrate with the example.
Suppose you want to run “WSQ image library (for Windows 32-bit)” on six(6) computers.
Then the price will be:

189.00 US dollars (first license) + 19.00 US dollars x 5 (five additional client computers) = 189.00 + 19.00 x 5 = 284 US dollars.

Android, Windows 32-bit, Windows 64-bit, Linux 32-bit, Linux 64-bit and macOS 64-bit versions of WSQ Image Library are considered separate products and each has its own pricing.
To order "WSQ image library (for Windows 32-bit)" please click here


WSQ image library specifications


Table 1 Format of WSQ image library

FeatureFormat
Operating systemWindows 95/98/2000/2003/NT/XP/Vista/7/8/10/11
Library formatDLL (Dynamic Link Library)
Format of exported functionsC language
Calling convention
of exported functions
(default)
__cdecl
Calling conventions
of exported functions
available through additional
wrapper DLL interface
__stdcall
JNIEXPORT
MatLab MEX
FORTRAN
Internal engineC++



Table 2 Supported formats for reading

FormatDescription
WSQFBI's Wavelet Scalar Quantization
BMPWindows Bitmap Graphics
TIFFMacintosh Tagged Information File Format images
TIFPC Tagged Information File Format images
JPG, JPEGJoint Photographic Experts Group images
JP2JPEG2000 Part 1 images
JPCJPEG2000 Code Stream images
JPEJPE images
PNGPortable Network Graphics images
GIFCompuserve Graphic Interchange Format images
PSPPaintshop Pro images
JFIFJFIF images
RLERun length encoded Windows bitmaps
DIBDevice independant Windows bitmaps
TGA, WIN, VST, VDA, ICBTruevision Targa Graphic images
FAXGFI fax images
PCX, PCCZSoft Paintbrush images (PC Paintbrush Bitmap Graphic)
SCRWord 5.x screen capture images
RPF, RLAAlias/Wavefront images
SGI, RGBA, RGBSilicon Graphics International true color images
BWSGI black/white images
PSDPhotoshop images
PDDPhotoshop images
PPMPortable pixel map images
PGMPortable gray map images
PBMPortable bitmap images
CELAutodesk images / Animator Graphic (FLC and FLI formats)
PICAutodesk images
PCDKodak Photo-CD images
CUTDr. Halo images
IFFAmiga Bitmap Graphic (8 bits)
ICOWindows icons
WMFWindows metafiles
EMFWindows enhanced meta files
PBMPortable Bitmap Format
PGMPortable Graymap Format
PPMPortable Pixmap Format
BINANSI/NIST-ITL 1-2000 Type-8 signature (Uncompressed scanned binary image data)
BINANSI/NIST-ITL 1-2000 Type-8 signature (ANSI/EIA-538-1988 facsimile compression)



Table 3 Supported formats for writing

FormatDescription
WSQFBI's Wavelet Scalar Quantization
BMPWindows Bitmap Graphics
TIFFTagged Information File Format (no LZW compression)
PNGPortable Network Graphics
JPGJoint Photographic Experts Group
RGBSilicon Graphics International (uncompressed)
TGATruevision Targa Graphic
JP2JPEG2000 Part 1
JPCJPEG2000 Code Stream
PBMPortable Bitmap Format
PGMPortable Graymap Format
PPMPortable Pixmap Format
BINANSI/NIST-ITL 1-2000 Type-8 signature (Uncompressed scanned binary image data)
BINANSI/NIST-ITL 1-2000 Type-8 signature (ANSI/EIA-538-1988 facsimile compression)



Table 4 Functions available in the library

FunctionDescription
HBITMAP CreateBMPFromFile(const char *filename)Creates an HBITMAP from an image file. The extension of the file name determines the file type.
Always returns 24-bit DIB (Device Independent Bitmap) HBITMAP. Returns an HBITMAP if successful, NULL otherwise.
Non-English characters in filenames are supported starting from version 5.3 of DLL.
Filename argument string must be in UTF-8 or ANSI format.
SaveBMPToFile(HBITMAP hBitmap, const char *filename, int filetype)Saves the contents of an HBITMAP to a file. Returns 1 if successful, 0 otherwise.
"filetype" denotes integer with possible values:
1 - WSQ
2 - Windows BMP
3 - TIFF
4 - PNG
5 - JPEG
6 - Targa
7 - RGB
8 - JP2
9 - JPC
10 - PBM
11 - PGM
12 - PPM

Filename argument string must be in UTF-8 or ANSI format.
HBITMAP CreateBMPFromWSQByteArray(unsigned char *input_wsq_byte_array, int size_of_input_wsq_byte_array)Creates an HBITMAP from WSQ compressed byte array. Returns an HBITMAP if successfull, NULL otherwise.
int SaveWSQByteArrayToImageFile(unsigned char *input_wsq_byte_array, int size_of_input_wsq_byte_array, const char *filename, int filetype)Saves WSQ compressed byte array to an image file. Returns 1 if successfull, 0 otherwise.
"filetype" denotes integer with possible values:
1 - WSQ
2 - Windows BMP
3 - TIFF
4 - PNG
5 - JPEG
6 - Targa
7 - RGB
8 - JP2
9 - JPC
10 - PBM
11 - PGM
12 - PPM
void WriteWSQ_bitrate(double bitrate)Sets current WSQ bitrate. For example 0.75, 2.25 (-1.0 if unknown).
double ReadWSQ_bitrate()Reads current WSQ bitrate. For example 0.75, 2.25 (-1.0 if unknown).
void WriteWSQ_ppi(int ppi)Sets current WSQ ppi (pixels per inch). Value "-1" is used for unknown ppi.
int ReadWSQ_ppi()Reads current WSQ ppi (pixels per inch). Value "-1" is used for unknown ppi.
void WriteWSQ_comment(char *comment)Sets current WSQ comment text.
char* ReadWSQ_comment()Reads current WSQ comment text.
void WriteTIFFcompression(int tiff_compression)Sets the TIFF compression type. Available options are:
0 - NONE
1 - ZIP compression
(if ZIP compression is used, you also need to set TIFF "predictor" parameter)
2 - MACINTOSH compression
void WriteTIFFpredictor(int tiff_predictor)Sets the TIFF ZIP compression predictor value.
void SetShowFilePropertiesDialog(int file_properties_dialog)Enables/disables invocation of graphic file properties dialog window.
"file_properties_dialog" denotes integer with possible values:
1 - Show file properties dialog
0 - Do not show file properties dialog.
Function "void SetShowFilePropertiesDialog(int file_properties_dialog)" has effect only when saving WSQ and TIFF file types.
void ShowFileConverter()Obsolete legacy function which was removed and now is empty. In old versions of the library this function invoked graphic file format converter utility window.
int WSQ_decode_stream(unsigned char *input_data_stream, const int input_stream_length, unsigned char **output_data_stream, int *width, int *height, int *ppi, unsigned char **comment_text)Decodes memory stream (memory block) from WSQ format into uncompressed format. Returns 1 if successful, or error code otherwise.
int WSQ_encode_stream(unsigned char *input_data_stream, const int width, const int height, const double bitrate, const int ppi, char *comment_text, unsigned char **output_data_stream, int *output_stream_length)Encodes memory stream (memory block) from uncompressed format into WSQ format. Returns 1 if successful, or error code otherwise.
HBITMAP ConvertHBITMAPtoGrayScale256(HBITMAP hBitmap)Converts any HBITMAP to 8-bit 256 grayscale HBITMAP. Returns an HBITMAP if successful, NULL otherwise.
int SaveHBITMAPtoFileAsGrayScale256BMP(HBITMAP hBitmap, const char *filename)Saves the contents of an HBITMAP to 8-bit 256 grayscale BMP file. Returns 1 if successful, 0 otherwise.
int ReadWSQ_implementation_number()Reads WSQ implementation number.
HBITMAP CreateHBITMAPfromNISTType8BinaryField(int type8_width, int type8_height, int type8_compression_type, unsigned char* type8_input_byte_array, int type8_input_byte_array_size)Creates an HBITMAP from ANSI/NIST-ITL 1-2000 Type-8 signature image byte array. Always returns 24-bit DIB (Device Independent Bitmap) HBITMAP. Returns an HBITMAP if successful, NULL otherwise.
HBITMAP CreateHBITMAPfromNISTType8UncompressedBinaryField(int type8_width, int type8_height, unsigned char* type8_input_byte_array, int type8_input_byte_array_size)Creates an HBITMAP from ANSI/NIST-ITL 1-2000 Type-8 signature (uncompressed scanned binary image data) image byte array. Always returns 24-bit DIB (Device Independent Bitmap) HBITMAP. Returns an HBITMAP if successful, NULL otherwise.
HBITMAP CreateHBITMAPfromNISTType8CompressedBinaryField(int type8_width, int type8_height, unsigned char* type8_input_byte_array, int type8_input_byte_array_size)Creates an HBITMAP from ANSI/NIST-ITL 1-2000 Type-8 signature (ANSI/EIA-538-1988 facsimile compression) image byte array. Always returns 24-bit DIB (Device Independent Bitmap) HBITMAP. Returns an HBITMAP if successful, NULL otherwise.
unsigned char* CreateNISTType8BinaryFieldfromHBITMAP(HBITMAP input_HBITMAP, int type8_compression_type)Creates ANSI/NIST-ITL 1-2000 Type-8 signature image byte array from HBITMAP. Returns NULL on failure.
unsigned char* CreateNISTType8UncompressedBinaryFieldfromHBITMAP(HBITMAP input_HBITMAP)Creates ANSI/NIST-ITL 1-2000 Type-8 signature (uncompressed scanned binary image data) image byte array from HBITMAP. Returns NULL on failure.
unsigned char* CreateNISTType8CompressedBinaryFieldfromHBITMAP(HBITMAP input_HBITMAP)Creates ANSI/NIST-ITL 1-2000 Type-8 signature (ANSI/EIA-538-1988 facsimile compression) image byte array from HBITMAP. Returns NULL on failure.
unsigned char* CreateImageFromNISTType8UncompressedBinaryField(unsigned char* type8_input_byte_array, int type8_input_byte_array_size, int type8_width, int type8_height)Creates image bytes from ANSI/NIST-ITL 1-2000 Type-8 signature (uncompressed scanned binary image data) image byte array. Returns NULL on failure.
unsigned char* CreateImageFromNISTType8CompressedBinaryField(unsigned char* type8_input_byte_array, int type8_input_byte_array_size, int type8_width, int type8_height)Creates image bytes from ANSI/NIST-ITL 1-2000 Type-8 signature (ANSI/EIA-538-1988 facsimile compression) image byte array. Returns NULL on failure.
int CreateNISTType8UncompressedBinaryFieldfromImage(unsigned char* input_image, int type8_width, int type8_height, unsigned char **output_type8_bytes, int *output_type8_bytes_length)Creates ANSI/NIST-ITL 1-2000 Type-8 signature (uncompressed scanned binary image data) image byte array from image bytes. Returns NULL on failure.
int CreateNISTType8CompressedBinaryFieldfromImage(unsigned char* input_image, int type8_width, int type8_height, unsigned char **output_type8_bytes, int *output_type8_bytes_length) Creates ANSI/NIST-ITL 1-2000 Type-8 signature (ANSI/EIA-538-1988 facsimile compression) image byte array from image bytes. Returns NULL on failure.
int ReadType8DataCompressionType()Reads Type-8 data compression type. "0" means uncompressed scanned binary image data, "1" means ANSI/EIA-538-1988 facsimile compression.
int ReadType8DataWidth()Reads Type-8 signature image width.
int ReadType8DataHeight()Reads Type-8 signature image height.
void WriteType8CompressionWidthHeight(int type8_width, int type8_height, int type8_compression_type)Writes Type-8 signature image width, height and compression type ("0" means uncompressed scanned binary image data, "1" means ANSI/EIA-538-1988 facsimile compression).
int ReadSizeOfNISTType8BinaryField()Reads size of NIST Type-8 binary field.
void SetNISTType8ImageColorInversion(int in_uncompressed_type8_image_inverted, int out_uncompressed_type8_image_inverted, int in_compressed_type8_image_inverted, int out_compressed_type8_image_inverted)Sets NIST Type-8 image color inversion.
RegisterWSQ()Registers WSQ image library on the computer. Returns 1 if successful, 0 otherwise.




Screenshots of available library windows are shown below.

Figure 1 WSQ properties settings window Figure 2 TIFF properties settings window



WSQ format description


In the USA, fingerprints have traditionally been collected on cards, each card containing the inked impressions of all ten fingers. The U.S. Federal Bureau of Investigation's fingerprint database began in 1924 with a cataloged collection of 810,188 cards. By the start of World War II, this collection had grown to over 10 million cards, and by 1946 had reached over 100 million cards.

In 1995 this collection was contained on over 200 million cards stored in filing cabinets occupying one acre of floor space in the J. Edgar Hoover building in Washington D.C. and archive size was increasing at the rate of 30,000 to 50,000 new cards per day.

Digitization of fingerprint cards seemed to be the most obvious choice and the project named FBI's Integrated Automated Fingerprint Identification System (IAFIS) was started to cope with the design and implementation of a national standard for collecting, encoding, storing, and retrieving digitized fingerprint images. According to the FBI standard fingerprints are stored as 8-bit grayscale images. Each fingerprint card, when digitized at 500 dpi requires about 10 Mbytes of storage. The FBI's entire collection would therefore consume two petabytes (2,000,000,000 megabytes) of electronic storage space.

The need for an effective compression technique was then very urgent. Unfortunately, neither the well-known lossless methods nor the JPEG methods were found to be satisfactory. Most lossy compression methods, such as JPEG, discard the smallest (highest frequency) details in images, and at higher compression ratios unacceptably distorts the image. Contained within fingerprints are tiny details that are considered admissible points of identification in a court of law. To JPEG, these details may be regarded as noise and removed. The JPEG quantization matrix also allows blocking artifacts to occur in the image at compression ratios above about 10:1. Shifting bits to the high frequencies to preserve small details will only make the blocking worse.

Lossless compression methods, such as LZW and JBIG, cannot achieve the high compression ratios of WSQ on fingerprint data, with 2:1 typically being the best.

A new compression technique (with small acceptable loss), called Wavelet Scalar Quantization (WSQ) was developed and it became the FBI standard for the compression of 500 dpi fingerprint images.

WSQ is a lossy compression method that is well-suited for preserving the very high resolution details of grayscale images while maintaining high compression ratios of typically 12:1 to 15:1 on images that have not undergone "quality enhancements" (such as histogram equalization) to improve the appearance of the image.



Table 5 WSQ file format specifications

FeatureDescription
NameFBI's Wavelet Scalar Quantization file format.
Also known as: FBI Fingerprint Format or FBI WSQ
ApplicationThe standard file format used by the FBI for storage and interchange of grayscale fingerprint images
OriginatorFBI (U.S. Federal Bureau of Investigation)
TypeBitmap
Colors8 bit grayscale
CompressionWavelet Scalar Quantization
Maximum image size64K x 64K
Multiple images per fileNo



Adding WSQ image library to your software project


Using WSQ image library is very easy. Only 2-3 steps and a few lines of code are needed. Several examples are provided below.
Adobe_Photoshop
Microsoft Visual C++
Microsoft Visual C++ .NET
Microsoft Visual C# .NET
Microsoft Visual Basic .NET
Microsoft Visual J# .NET
Microsoft Visual Basic 1.x-6.x
Microsoft Excel
Microsoft Access
Microsoft Word
Microsoft PowerPoint
Borland C++ Builder (dynamic DLL loading)
Borland C++ Builder (static DLL loading)
Borland Delphi
Lazarus
Bloodshed Dev-Pascal
Sun Java
MinGW C/C++
Eclipse C/C++
Code::Blocks C++
Bloodshed Dev-C++
Borland C++ for Win32
Digital Mars C/C++
wxWidgets
Microsoft Visual FoxPro
Lotus Notes
MatLab
Compaq Fortran
PowerBASIC
MASM32 (32 bit Microsoft Assembler)
PHP


Adobe Photoshop


Step 1
Please copy all files:

  
WSQ_Import_32.8BA
WSQ_Export_32.8BE
WSQ_library.dll
to the Adobe Photoshop plug-ins directory, like for example:
C:\Program Files (x86)\Adobe\Adobe Photoshop CC 2017 (32 Bit)\Plug-ins\Import-Export
C:\Program Files\Adobe\Adobe Photoshop CS4\Plug-ins\Import-Export

Step 2
Restart Adobe Photoshop. WSQ plug-ins will be available in Adobe Photoshop menu:

  
File->Import...->WSQ Import...
File->Export...->WSQ Export...

To download WSQ plug-ins for Adobe Photoshop click here



Microsoft Visual C++


Step 1
Load WSQ library and declare its functions. Add following lines to your code:

  
typedef (*SaveBMPToFile)( HBITMAP hBitmap, const char *filename, int filetype);
typedef HBITMAP (*CreateBMPFromFile)( const char *filename);
typedef (*RegisterWSQ)();

SaveBMPToFile  pSaveBMPToFile;
CreateBMPFromFile  pCreateBMPFromFile;
RegisterWSQ pRegisterWSQ;

HINSTANCE hWSQ_library;
hWSQ_library = LoadLibrary("WSQ_library.dll");

pSaveBMPToFile = (SaveBMPToFile) GetProcAddress(hWSQ_library, "_SaveBMPToFile");
pCreateBMPFromFile = (CreateBMPFromFile) GetProcAddress(hWSQ_library, "_CreateBMPFromFile");
pRegisterWSQ = (RegisterWSQ) GetProcAddress(hWSQ_library, "_RegisterWSQ");

Step 2
Call and use WSQ library functions:

  
hbitmap = (pCreateBMPFromFile)((LPCSTR)dlgFile.GetPathName());
or
(pSaveBMPToFile)(bitmap->GetBitmap(), (LPCSTR)dlgFile.GetPathName(), dlgFile.m_ofn.nFilterIndex);

Step 3
Unload WSQ library. Add following line to your code:

  
bRes = FreeLibrary(hWSQ_library);

To download Microsoft Visual C++ 6.0 sample project click here



Microsoft Visual C++ .NET


Click here for important notes for .NET developers

Step 1
Load WSQ library and declare its functions. Add following lines to your code:

  
[DllImport("WSQ_library.dll", EntryPoint = "_CreateBMPFromFile", CharSet = Ansi)]
static Int32 _CreateBMPFromFile(String* filename);
[DllImport("WSQ_library.dll", EntryPoint = "_SaveBMPToFile", CharSet = Ansi)]
static void _SaveBMPToFile(IntPtr hBitmap, String* filename, Int32 filetype);
[DllImport("WSQ_library.dll", EntryPoint = "_RegisterWSQ", CharSet = Ansi)]
static void _RegisterWSQ();

Step 2
Call and use WSQ library functions:

  
picture->Image = Image::FromHbitmap(_CreateBMPFromFile(ofd->FileName));
or
_SaveBMPToFile((new Bitmap(picture->Image))->GetHbitmap(), sfd->FileName, sfd->FilterIndex);

To download Microsoft Visual C++ .NET 2003 Windows Forms Application sample project click here
To download Microsoft Visual C++ .NET 2008 Windows Forms Application sample project click here
To download Microsoft Visual C++ .NET 2022 CLR Project (.NET Framework) sample project click here



Microsoft Visual C# .NET


Click here for important notes for .NET developers

Step 1
Load WSQ library and declare its functions. Add following lines to your code:

  
[DllImport("WSQ_library.dll")]
public static extern IntPtr _CreateBMPFromFile(String lpszFileName);
[DllImport("WSQ_library.dll")]
public static extern void _SaveBMPToFile(IntPtr hBitmap, String filename, Int32 filetype);
[DllImport("WSQ_library.dll")]
public static extern void _RegisterWSQ();

Step 2
Call and use WSQ library functions:

  
bp = _CreateBMPFromFile(ofd.FileName);
or
_SaveBMPToFile(bp, sfd.FileName, sfd.FilterIndex);

To download Microsoft Visual C# .NET 2003 sample project click here
To download Microsoft Visual C# .NET 2010 sample project click here
To download Microsoft Visual C# .NET 2013 Windows Forms App sample project click here
To download Microsoft Visual C# .NET 2017 Windows Forms App sample project click here
To download Microsoft Visual C# .NET 2022 Windows Forms App sample project click here



Microsoft Visual Basic .NET


Click here for important notes for .NET developers

Step 1
Add declarations of WSQ library functions using PInvoke (platform invoke) mechanism :

  
<DllImport("WSQ_library.dll", CallingConvention:=CallingConvention.Cdecl, CharSet:=CharSet.Ansi)> _
Shared Function _CreateBMPFromFile(ByVal lpszFileName As String) As IntPtr
End Function
<DllImport("WSQ_library.dll", CallingConvention:=CallingConvention.Cdecl, CharSet:=CharSet.Ansi)> _
Shared Function _SaveBMPToFile(ByVal hBitmap As IntPtr, ByVal lpszFileName As String, _
ByVal ifiletype As Short) As Short
End Function
<DllImport("WSQ_library.dll", CallingConvention:=CallingConvention.Cdecl, CharSet:=CharSet.Ansi)> _
Shared Sub _RegisterWSQ()
End Sub

Step 2
Call and use WSQ library functions:

  
OutputPicture.Image = Bitmap.FromHbitmap(_CreateBMPFromFile(OpenFileDialog1.FileName))
or
iResult = _SaveBMPToFile((New Bitmap(OutputPicture.Image)).GetHbitmap(), SaveFileDialog1.FileName,
SaveFileDialog1.FilterIndex)

To download Microsoft Visual Basic .NET 2003 sample project click here
To download Microsoft Visual Basic .NET 2010 sample project click here
To download Microsoft Visual Basic .NET 2013 Windows Forms App sample project click here
To download Microsoft Visual Basic .NET 2017 Windows Forms App sample project click here
To download Microsoft Visual Basic .NET 2022 Windows Forms App sample project click here



Microsoft Visual J# .NET


Click here for important notes for .NET developers

Step 1
Load WSQ library and declare its functions. Add following lines to your code:

  
/** @attribute DllImport("WSQ_library.dll", CharSet=System.Runtime.InteropServices.CharSet.Ansi, SetLastError=true) */	
public static native System.IntPtr _CreateBMPFromFile(String lpszFileName);
/** @attribute DllImport("WSQ_library.dll", CharSet=System.Runtime.InteropServices.CharSet.Ansi, SetLastError=true) */	
public static native void _SaveBMPToFile(System.IntPtr hBitmap, String filename, int filetype);
/** @attribute DllImport("WSQ_library.dll", CharSet=System.Runtime.InteropServices.CharSet.Ansi, SetLastError=true) */	
public static native void _RegisterWSQ();

Step 2
Call and use WSQ library functions:

  
bp = _CreateBMPFromFile(ofd.get_FileName());
or
_SaveBMPToFile(bp, sfd.get_FileName(), sfd.get_FilterIndex());

To download Microsoft Visual J# .NET 2003 sample project click here
To download Microsoft Visual J# .NET 2005 sample project click here



Microsoft Visual Basic 1.x-6.x


Click here for important notes for Visual Basic 1.x-6.x developers

Step 1
Add declarations of WSQ library functions using __stdcall wrapper interface:

  
Private Declare Function CreateBMPFromFile Lib "WSQ_library_stdcall.dll" 
Alias "CreateBMPFromFile_stdcall"
(ByVal lpszFileName As String) As Long
Private Declare Function SaveBMPToFile Lib "WSQ_library_stdcall.dll" 
Alias "SaveBMPToFile_stdcall"
(ByVal hBitmap As Long, ByVal lpszFileName As String, ifiletype As Integer) As Integer
Private Declare Function RegisterWSQ Lib "WSQ_library_stdcall.dll" 
Alias "RegisterWSQ_stdcall" () As Integer

Step 2
Call and use WSQ library functions:

  
OutputPicture.Picture = GetPicture(CreateBMPFromFile(CommonDialog1.FileName), vbPicTypeBitmap)
or
iResult = SaveBMPToFile(OutputPicture.Picture.Handle, lpszDialogFileName, 
CommonDialog1.FilterIndex)

To download Microsoft Visual Basic 6.0 sample project click here



Microsoft Microsoft Excel


Step 1
Add declarations of WSQ library functions using __stdcall wrapper interface:

  
Private Declare Function CreateBMPFromFile Lib "WSQ_library_stdcall.dll" 
Alias "CreateBMPFromFile_stdcall"
(ByVal lpszFileName As String) As Long
Private Declare Function SaveBMPToFile Lib "WSQ_library_stdcall.dll" 
Alias "SaveBMPToFile_stdcall"
(ByVal hBitmap As Long, ByVal lpszFileName As String, ifiletype As Long) As Long
Private Declare Function RegisterWSQ Lib "WSQ_library_stdcall.dll" 
Alias "RegisterWSQ_stdcall" () As Long

Step 2
Call and use WSQ library functions:

  
Sheet1.OutputImage.Picture = ModuleOleHelper.HBitmapToIPicture(CreateBMPFromFile(FileName))
or
iResult = SaveBMPToFile(Sheet1.OutputImage.Picture.Handle, FileName, iFilterIndex)

To download Microsoft Microsoft Excel 2003 sample project click here



Microsoft Microsoft Access


Step 1
Add declarations of WSQ library functions using __stdcall wrapper interface:

  
Private Declare Function CreateBMPFromFile Lib "WSQ_library_stdcall.dll" 
Alias "CreateBMPFromFile_stdcall"
(ByVal lpszFileName As String) As Long
Private Declare Function SaveBMPToFile Lib "WSQ_library_stdcall.dll" 
Alias "SaveBMPToFile_stdcall"
(ByVal hBitmap As Long, ByVal lpszFileName As String, ifiletype As Long) As Long
Private Declare Function RegisterWSQ Lib "WSQ_library_stdcall.dll" 
Alias "RegisterWSQ_stdcall" () As Long

Step 2
Call and use WSQ library functions:

  
hBitmap = ModuleOleHelper.HBitmapToIPicture(CreateBMPFromFile(FileName))
or
iResult = SaveBMPToFile(hBitmap, FileName, iFilterIndex)

To download Microsoft Microsoft Access 2003 sample project click here



Microsoft Microsoft Word


Step 1
Add declarations of WSQ library functions using __stdcall wrapper interface:

  
Private Declare Function CreateBMPFromFile Lib "WSQ_library_stdcall.dll" 
Alias "CreateBMPFromFile_stdcall"
(ByVal lpszFileName As String) As Long
Private Declare Function SaveBMPToFile Lib "WSQ_library_stdcall.dll" 
Alias "SaveBMPToFile_stdcall"
(ByVal hBitmap As Long, ByVal lpszFileName As String, ifiletype As Long) As Long
Private Declare Function RegisterWSQ Lib "WSQ_library_stdcall.dll" 
Alias "RegisterWSQ_stdcall" () As Long

Step 2
Call and use WSQ library functions:

  
OutputImage.Picture = ModuleOleHelper.HBitmapToIPicture(CreateBMPFromFile(FileName))
or
iResult = SaveBMPToFile(OutputImage.Picture.Handle, FileName, iFilterIndex)

To download Microsoft Microsoft Word 2003 sample project click here



Microsoft Microsoft PowerPoint


Step 1
Add declarations of WSQ library functions using __stdcall wrapper interface:

  
Private Declare Function CreateBMPFromFile Lib "WSQ_library_stdcall.dll" 
Alias "CreateBMPFromFile_stdcall"
(ByVal lpszFileName As String) As Long
Private Declare Function SaveBMPToFile Lib "WSQ_library_stdcall.dll" 
Alias "SaveBMPToFile_stdcall"
(ByVal hBitmap As Long, ByVal lpszFileName As String, ifiletype As Long) As Long
Private Declare Function RegisterWSQ Lib "WSQ_library_stdcall.dll" 
Alias "RegisterWSQ_stdcall" () As Long

Step 2
Call and use WSQ library functions:

  
Slide1.OutputImage.Picture = ModuleOleHelper.HBitmapToIPicture(CreateBMPFromFile(FileName))
or
iResult = SaveBMPToFile(Slide1.OutputImage.Picture.Handle, FileName, iFilterIndex)

To download Microsoft Microsoft PowerPoint 2003 and 2010 sample project click here



Borland C++ Builder (dynamic DLL loading)


Step 1
Load WSQ library and declare its functions. Add following lines to your code:

  
typedef (*SaveBMPToFile)( HBITMAP hBitmap, const char *filename, int filetype);
typedef HBITMAP (*CreateBMPFromFile)( const char *filename);
typedef (*RegisterWSQ)();

SaveBMPToFile  pSaveBMPToFile;
CreateBMPFromFile  pCreateBMPFromFile;
RegisterWSQ pRegisterWSQ;

HINSTANCE hWSQ_library;
hWSQ_library = LoadLibrary("WSQ_library.dll");

pSaveBMPToFile = (SaveBMPToFile) GetProcAddress(hWSQ_library, "_SaveBMPToFile");
pCreateBMPFromFile = (CreateBMPFromFile) GetProcAddress(hWSQ_library, "_CreateBMPFromFile");
pRegisterWSQ = (RegisterWSQ) GetProcAddress(hWSQ_library, "_RegisterWSQ");

Step 2
Call and use WSQ library functions:

  
hBitmap = (pCreateBMPFromFile)(open_dialog->FileName.c_str());
or
(pSaveBMPToFile)(OutputImage->Picture->Bitmap->Handle, save_dialog->FileName.c_str(),
save_dialog->FilterIndex);

To download Borland C++ Builder 6.0 sample project (dynamic version) click here
To download Borland C++ Builder 2007 sample project (dynamic version) click here
To download Embarcadero C++ Builder 2010 sample project (dynamic version) click here
To download Embarcadero C++ Builder XE2 sample project (dynamic version) click here
To download Embarcadero C++ Builder 10 Seattle sample project (dynamic version) click here



Borland C++ Builder (static DLL loading)


Notice: Static DLL loading is available only for Embarcadero C++ Builder 10 Seattle.

All other compilers and other C++ Builder versions should use dynamic DLL loading.

Step 1
Add the file “WSQ_library.lib” to your project as show in figures below
Figure 4 Go to menu Project -> Add Project Figure 5 Select file “WSQ_library.lib”

Step 2
Add this line at the beginning of your main program:

  
#include "wsq_library.h"

Step 3
Call and use WSQ library functions:

  
hBitmap = CreateBMPFromFile( open_dialog->FileName.c_str());
or
SaveBMPToFile( OutputImage->Picture->Bitmap->Handle, save_dialog->FileName.c_str(), 
save_dialog->FilterIndex);

To download Embarcadero C++ Builder 10 Seattle sample project (static version) click here



Borland Delphi / Lazarus
Lazarus
Bloodshed Dev-Pascal


Step 1
Add declarations of WSQ library functions:

  
function CreateBMPFromFile (const file_name: PCHAR): HBitmap; cdecl; external 'WSQ_library.dll' 
name '_CreateBMPFromFile';
function SaveBMPToFile( const bitmap : HBITMAP;  const filename : PCHAR; filetype: Integer):Integer;
cdecl; external 'WSQ_library.dll' name '_SaveBMPToFile';
function RegisterWSQ():Integer; cdecl; external 'WSQ_library.dll' name '_RegisterWSQ';

Step 2
Call and use WSQ library functions:

  
OutputImage.Picture.Bitmap.Handle := CreateBMPFromFile( PCHAR(open_dialog.FileName));
or
SaveBMPToFile( OutputImage.Picture.Bitmap.Handle, PCHAR(save_dialog.FileName), 
save_dialog.FilterIndex);

To download Borland Delphi 7.0 sample project click here
To download Borland Delphi 2007 sample project click here
To download Embarcadero Delphi 2010 sample project click here
To download Embarcadero Delphi XE2 sample project click here
To download Embarcadero Delphi 10 Seattle sample project click here
To download Lazarus 2.2.0 sample project click here
To download Bloodshed Dev-Pascal 1.9.2 sample project click here



Sun Java


Click here for important notes for Sun Java developers

Step 1
Add declarations of WSQ library functions using JNIEXPORT wrapper interface:

  
System.loadLibrary("WSQ_library_jniexport");
public static native int[] CreateBMPFromFile(int[] dimension, String fileName);
public static native void SaveBMPToFile(int[] data, int width, int height, String fileName, int type);
public static native void RegisterWSQ();

Step 2
Call and use WSQ library functions:

  
int[] data = WSQ_Demo.CreateBMPFromFile(dimension, fileName)
or
WSQ_Demo.SaveBMPToFile(pixels, width, height, fileName, type)

To download Sun Java (Java SE Development Kit 8u144) sample project sample project click here



MinGW C/C++
Eclipse C/C++
Code::Blocks C++
Bloodshed Dev-C++
Borland C++ for Win32
Digital Mars C/C++


Step 1
Load WSQ library and declare its functions. Add following lines to your code:

  
typedef HBITMAP (WINAPI *CreateBMPFromFile)(const char *filename);
typedef void (WINAPI *SaveBMPToFile)(HBITMAP hBitmap, const char *filename, int filetype);
typedef int (WINAPI *RegisterWSQ)();

CreateBMPFromFile CreateBMPFromFile_ptr = 0;
SaveBMPToFile SaveBMPToFile_ptr = 0;
RegisterWSQ RegisterWSQ_ptr = 0;

HINSTANCE g_wsqLibrary = 0;
g_wsqLibrary = LoadLibrary("WSQ_library.dll");

CreateBMPFromFile_ptr = (CreateBMPFromFile)GetProcAddress(g_wsqLibrary, "_CreateBMPFromFile");
SaveBMPToFile_ptr = (SaveBMPToFile)GetProcAddress(g_wsqLibrary, "_SaveBMPToFile");
RegisterWSQ_ptr = (RegisterWSQ)GetProcAddress(g_wsqLibrary, "_RegisterWSQ");

Step 2
Call and use WSQ library functions:

  
g_hBitmap = CreateBMPFromFile_ptr(szFileName);
or
SaveBMPToFile_ptr(bitmap, szFileName, ofn.nFilterIndex);

Step 3
Unload WSQ library. Add following line to your code:

  
bRes = FreeLibrary(g_wsqLibrary);

To download MinGW C/C++ 8.1.0 sample project click here
To download Eclipse IDE 2023-06 C/C++ (MinGW C/C++ 8.1.0) sample project click here
To download Code::Blocks C++ 20.03 (MinGW C/C++ 8.1.0) sample project click here
To download Bloodshed Dev-C++ 4.9.9.2 sample project click here
To download Borland C++ 5.5 for Win32 sample project click here
To download Digital Mars C/C++ 8.57 sample project click here



wxWidgets


Step 1
Load WSQ library and declare its functions. Add following lines to your code:

  
typedef void (*SaveBMPToFile)( HBITMAP hBitmap, const char *filename, int filetype);
typedef HBITMAP (*CreateBMPFromFile)( const char *filename);
typedef void (*RegisterWSQ)();

SaveBMPToFile pSaveBMPToFile;
CreateBMPFromFile pCreateBMPFromFile;
RegisterWSQ pRegisterWSQ;

HINSTANCE hWSQ_library;
hWSQ_library = LoadLibrary( _("WSQ_library.dll"));

pSaveBMPToFile = (SaveBMPToFile) GetProcAddress(hWSQ_library, "_SaveBMPToFile");
pCreateBMPFromFile = (CreateBMPFromFile) GetProcAddress(hWSQ_library, "_CreateBMPFromFile");
pRegisterWSQ = (RegisterWSQ) GetProcAddress(hWSQ_library, "_RegisterWSQ");

Step 2
Call and use WSQ library functions:

  
bitmap = (pCreateBMPFromFile)(fileName.utf8_str());
or
(pSaveBMPToFile)(bitmap, fileName.utf8_str(), index);

To download wxWidgets 2.8.7 (Code::Blocks 20.03 with Microsoft Visual C++ 2008) sample project click here



Microsoft Visual FoxPro


Step 1
Add declarations of WSQ library functions using __stdcall wrapper interface:

  
DECLARE INTEGER CreateBMPFromFile_stdcall IN WSQ_library_stdcall ;
STRING lpszFileName
DECLARE INTEGER SaveBMPToFile_stdcall IN WSQ_library_stdcall ;
INTEGER  hBitmap, STRING  lpszFileName, INTEGER ifiletype
DECLARE INTEGER RegisterWSQ_stdcall IN WSQ_library_stdcall 

Step 2
Call and use WSQ library functions:

  
hBitmap = CreateBMPFromFile_stdcall(FileName)
or
SaveBMPToFile_stdcall(hBitmap, FileName, FileType)

To download Microsoft Visual FoxPro 5.0 sample project click here



Lotus Notes


Step 1
Add declarations of WSQ library functions using __stdcall wrapper interface:

  
Declare Function CreateBMPFromFile Lib "WSQ_library_stdcall.dll" _
Alias "CreateBMPFromFile_stdcall" (Byval lpszFileName$ As String) As Long
Declare Function SaveBMPToFile Lib "WSQ_library_stdcall.dll" _
Alias "SaveBMPToFile_stdcall" (Byval hBitmap% As Long, Byval lpszFileName$ As String, _
Byval ifiletype% As Long) As Long
Declare Function RegisterWSQ Lib "WSQ_library_stdcall.dll" _
Alias "RegisterWSQ_stdcall" () As Long

Step 2
Call and use WSQ library functions:

  
hBitmap = CreateBMPFromFile(FileName)
or
ret = SaveBMPToFile(hBitmap, FileName, 1)

To download Lotus Notes 6.0 sample project click here



MatLab


Click here for important notes for MatLab developers

Step 1
Load WSQ library and declare its functions. Add following lines to your code:

  
loadlibrary 'WSQ_library' 'WSQ_library.h' 'alias' 'WSQ_lib';

Step 2
Call and use WSQ library functions using MatLab MEX wrapper interface (for functions containing HBITMAP type data) or call WSQ library functions directly (for functions without HBITMAP):

  
picture_data = WSQ_library_read_image(filename);
or
WSQ_library_write_image(picture_data, filename_write, int32(file_type));

Step 3
Unload WSQ library. Add following line to your code:

  
 unloadlibrary WSQ_lib;

To download MatLab 7.0 sample project click here



Compaq Fortran


Click here for important notes for Compaq Fortran developers

Step 1
Add declarations of WSQ library functions using Fortran wrapper interface:

  
hWSQLib = loadlibrary("WSQ_library_fortranexport.dll"C)
pCreateBMPFromFile = getprocaddress(hWSQLib, "_CreateBMPFromFile"C)
pSaveBMPToFile = getprocaddress(hWSQLib, "_SaveBMPToFile"C)
pRegisterWSQ = getprocaddress(hWSQLib, "_RegisterWSQ"C)

Step 2
Call and use WSQ library functions:

  
hb = CreateBMPFromFile(filename)
or
i = SaveBMPToFile(%VAL(hBitmap), filename, %VAL(filterIndex))

Step 3
Unload WSQ library. Add following line to your code:

  
status = freelibrary(hWSQLib)

To download Compaq Visual Fortran 6.6 sample project click here



PowerBASIC


Step 1
Load WSQ library and declare its functions. Add following lines to your code:

  
$DllName = "WSQ_library_stdcall.dll"
DECLARE FUNCTION CreateBMPFromFile(BYVAL lpszFileName AS STRING) AS LONG 
DECLARE FUNCTION SaveBMPToFile(BYVAL hBitmap AS LONG, BYVAL lpszFileName AS STRING, BYVAL
ifiletype AS LONG) AS INTEGER
DECLARE FUNCTION RegisterWSQ() AS INTEGER 

TYPE WSQLibrary_Proc
    pCreateBMPFromFile     AS DWORD 
    pSaveBMPToFile         AS DWORD 
    pRegisterWSQ           AS DWORD 
END TYPE 

TYPE WSQLibrary_Params 
    hLib    AS LONG 
    DProcs  AS WSQLibrary_Proc 
END TYPE 

WSQLibrary_Param.hLib = LoadLibrary( BYVAL STRPTR($DllName) )

WSQLibrary_Param.DProcs.pCreateBMPFromFile = GetProcAddress( WSQLibrary_Param.hLib,
"CreateBMPFromFile_stdcall" )
WSQLibrary_Param.DProcs.pSaveBMPToFile = GetProcAddress( WSQLibrary_Param.hLib,
"SaveBMPToFile_stdcall" )
WSQLibrary_Param.DProcs.pRegisterWSQ = GetProcAddress( WSQLibrary_Param.hLib,
"RegisterWSQ_stdcall" )

Step 2
Call and use WSQ library functions:

  
CALL DWORD WSQLibrary_Param.DProcs.pCreateBMPFromFile USING CreateBMPFromFile(szFileName)
TO hBitmap
or
CALL DWORD WSQLibrary_Param.DProcs.pCreateBMPFromFile USING SaveBMPToFile(hBitmap,
szFileName, ofn.nFilterIndex) TO nResult

Step 3
Unload WSQ library. Add following lines to your code:

  
DIM dp AS WSQLibrary_Params
FreeLibrary WSQLibrary_Param.hLib
WSQLibrary_Param = dp

To download PowerBASIC 8.0 sample project click here



MASM32 (32 bit Microsoft Assembler)


Step 1
Load WSQ library and declare its functions. Add following lines to your code:

  
; WSQ library name
LIBNAME DB 'WSQ_library.dll',0
; WSQ library names of procedures
STR_CREATEBMP   DB '_CreateBMPFromFile',0
STR_SAVE        DB '_SaveBMPToFile',0
; WSQ library addresses of functions
HCREATEBMP      DD 0 ; CreateBMPFromFile address
HSAVE           DD 0 ; SaveBMPToFile address
; WSQ library address	 
HLIB            DD 0

; Load DLL
PUSH  OFFSET LIBNAME
CALL  LoadLibraryA@4
CMP   EAX, 0
JE    DLL_LOAD_ERROR
MOV   [HLIB], EAX

; Get address of function LoadBMPFromFile 
PUSH  OFFSET STR_CREATEBMP
PUSH  [HLIB]
CALL  GetProcAddress@8
CMP   EAX, 0
JE    FUNC_NOT_FOUND
MOV   HCREATEBMP, EAX
	
; Get address of function SaveBMPToFile
PUSH  OFFSET STR_SAVE
PUSH  [HLIB]
CALL  GetProcAddress@8
CMP   EAX, 0
JE    FUNC_NOT_FOUND
MOV   HSAVE, EAX

Step 2
Call and use WSQ library functions:

  
; CreateBMPFromFile
PUSH OFFSET STR_FILENAME
CALL [HCREATEBMP]
ADD ESP, 4
CMP EAX, 0
JE  UNKNOWN_ERROR ; Error loading image
MOV [hBitmap], EAX
XOR EAX, EAX
JMP FINISH
or
; SaveBMPToFile
PUSH [OFN.nFilterIndex]
PUSH OFFSET STR_FILENAME
PUSH [hBitmap]
CALL [HSAVE]
ADD  ESP, 12
CMP  EAX, 0
JE   UNKNOWN_ERROR
XOR  EAX, EAX
JMP  FINISH

Step 3
Unload WSQ library. Add following lines to your code:

  
; Free WSQ library
PUSH [HLIB]
CALL FreeLibrary@4
CMP  EAX, 0
JE   UNKNOWN_ERROR



To download MASM32 (32 bit Microsoft Assembler) 9.0 sample project click here



PHP


Step 1
Click here for important notes for PHP developers

Step 2
Call and use WSQ library functions:

  
//converts image from WSQ format to JPG format
wsq_convert_image("./sample_image.wsq","./output_JPG_image",5);
or
$image1 = wsq_read_image_from_file("./sample_image.wsq");
or
wsq_save_image_to_file($image2, $output_fileName, 5); //save image as JPG

To download PHP 4/5/7 sample project click here



Copyright ©2024 Cognaxon. All rights reserved. Privacy