Bitmaps: BMP, DIB, RLE
CompuServe GIF: GIF
JPEGs: JPG, JPEG, JPE, JFIF, JIF
JPEG2000: JP2, J2C, J2K, JPC
Photodhop: PSD
Portable Bitmaps: PBM, PGM, PPM, PXM
Portable Network Graphics: PNG
Targa: TGA, VDA, ICB, VST
TIFFs: TIF, TIFF, FAX, G3N, G3F
Windows Cursor: CUR
Windows Enhanced Metafile: EMF
Windows Icon: ICO
Windows Metafile: WMF
Wireless Bitmap: WBMP
ZSoft Paintbrush: PCX, DCX
|
Adobe Acrobat: PDF
Bitmaps: BMP
CompuServe GIF: GIF
JPEGs: JPG
JPEG2000: JP2, J2K
Portable Bitmaps: PXM
Portable Network Graphics: PNG
Targa: TGA
TIFFs: TIF
Windows Icon: ICO
Wireless Bitmap: WBMP
ZSoft Paintbrush: PCX, DCX
|
DLL file contains a single function:
ConvertImage(FN1: PCHAR; FN2:PCHAR; NewWidth:integer;
NewHeight:integer; Rotation:integer; Photometry:integer;
Compression:integer; Page:integer);
FN1 - source filename with full path;
FN2 - destination filename with full path;
NewWidth, NewHeight - new
image dimensions for resizing. To skip resizing set both parameters
to 0. To resize maintaining aspect ratio: parameter NewWidth must be set to the longest side of the new image (width or
height), and the parameter NewHeight should be set to 0.
Rotation: 0-skip rotation;
1-rotate left; 2-rotate right; 3-rotate 180 degrees; 4-automatic
rotation according to EXIF_orientation tag (for JPEG or TIFF
only). After rotation is finished, the value of EXIF_orientation
tag (if it exists) will be reset to 0.
Photometry, Compression - these options
are effective, if destination format is JPEG, JPEG2000 or TIFF.
Page - this option is effective,
if multipage TIFF file is specified as source file. It can
be used to specify the page to be converted. If Page=0 then all pages of multipage TIFF will be converted to set
of files. For multipage TIFF files a string "-page-X" will be added to output filenames automatically. Say, when
converting a multipage TIFF file "test.tiff" to "test.jpg" a set of files "test-page-1.jpg", "test-page-2.jpg" etc... will be created.
EXAMPLES:
Invoke from VB
Public Class Form1
Private Declare Function Conv Lib "ImageConverter.dll" Alias "ConvertImage" (ByVal FN1 As String, ByVal FN2 As String, ByVal NewW As Integer, ByVal NewH As Integer, ByVal Rotate As Integer, ByVal ph As Integer, ByVal comp As Integer, ByVal pg As Integer) As Integer
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Conv("e:\1.jpg", "e:\1.bmp", 0, 0, 0, 1, 50, 0)
End Sub
End Class
Invoke from C++
typedef void _stdcall (*_Convert)(char *Src, char *Dst, int NWidth, int NHeight, int Rotate, int Ph, int Compr, int Pg);
void __fastcall TForm1::Button1Click(TObject *Sender)
{
_Convert pConvert = NULL;
HINSTANCE hLib = LoadLibrary("ImageConverter.dll");
pConvert = (_Convert)GetProcAddress(hLib, "ConvertImage");
pConvert((PCHAR)L"e:\\1.jpg", (PCHAR)L"e:\\1.bmp", 0, 0, 0, 1, 50, 0);
}
Invoke from Delphi
procedure TForm1.Button2Click(Sender: TObject);
var
DLLInstance : THandle;
ImgCnv :TImgCnv;
begin
DLLInstance := LoadLibrary('ImageConverter.dll');
@ImgCnv := GetProcAddress(DLLInstance, 'ConvertImage');
if Assigned(ImgCnv) then begin
ImgCnv(PChar('d:\1.bmp'),PChar('d:\1.jpg'), 0, 0, 0, 1, 50, 0);
end;
FreeLibrary(DLLInstance);
end;
|