The igconsole sample program demonstrates how to load an image in one format and convert it to another format.
Copy Code
|
|
---|---|
Usage: igconsole [options] where [Options] may include any of the following: -i[page number] <input file> -o[page number] <output file> -e <Component name> -f <output format ID> -p <list all possible output formats ID's> -v <display version numbers> |
This topic provides information about the command-line parameters of this program and the corresponding ImageGear API calls which implement the requested functionality.
Copy Code
|
|
---|---|
-i[nIPageNumber] < IFileName > |
The sample uses the IG_fltr_load_file() function to load the specified page from the multi-page image and associate it with the hIGear handle:
Copy Code
|
|
---|---|
nErrCount=IG_fltr_load_file(IFileName, nIPageNumber, &hIGear); |
Copy Code
|
|
---|---|
-f nFormat |
The sample uses the IG_fltr_save_file() function to save the already-loaded hIGear image in the format of the nFormat parameter value:
Copy Code
|
|
---|---|
nErrCount=IG_fltr_save_file(hIGear, OFileName, nFormat, nOPageNumber, FALSE); |
The nFormat value is an integer constant taken from ImageGear’s master include file accucnst.h.
Copy Code
|
|
---|---|
–p |
This command returns a list of all currently available output formats by:
<format_id>:<Format_name>.<Compression_name>
The contents of the list depend upon the component that is attached (refer to Component Manager API). For example, if the LZW component is loaded, then the GIF/LZW format is available for use and will appear in the list.
The sample uses the IG_fltr_savelist_get function to obtain the list of output formats, and then calls the IG_fltr_info_get function in a loop to obtain information on each output format.
Please see the igconsole.c source file for the code that implements this feature.
Copy Code
|
|
---|---|
-i[nIPageNumber] < IFileName > |
This loads the nIPageNumber page of an IFileName file and then returns a list of all available output formats to which the loaded image can be saved.
The sample uses the IG_fltr_savelist_get function to obtain the list of output formats, and then calls the IG_fltr_info_get function in a loop to obtain information on each output format.
Please see the igconsole.c source file for the code that implements this feature.
Copy Code
|
|
---|---|
-e component_filename |
The sample uses IG_comm_comp_attach to attach a component:
Copy Code
|
|
---|---|
nErrCount=IG_comm_comp_attach(component_filename); |
The following example loads the second page from a mydocument.pdf document and saves it to a JPEG file:
Copy Code
|
|
---|---|
igconsole -e libIGPDF.so -i2 mydocument.pdf -f 393237 -o tiff6_p2.jpg |
The following example converts the first page of the input document to BMP format:
Copy Code
|
|
---|---|
char *argv[] |