Image Scaling & Format conversion Description
...Back to Downloads
Overview:
Conversion between 1/8/24 bit TIFF, DCX, PCX, BMP output to PDF with antialiased scaling, and palette mapping from 24 to 256 color or greyscale. Optional single page TIFF or multi-page TIFF conversion.
Details: Application (and COM object) to convert 1 bit / 8 bit / 24 bit TIFF/JPEG/PNG/DCX files to 1 bit / 8 bit / 24 bit TIFF/JPEG/PNG/DCX and PDF files.
Uses:
1) Scaling of faxes and scanned images to thumbnails, suitable for web browsing.
2) Scaling of images from very high resolutions to a screen width resolution suitable for web viewing and database storage.
3) Conversion between TIFF, DCX, JPEG, and PNG file formats.
4) Conversion of images to optimally compressed PDF, suitable for emailing, or document storage.
Supports:
1) Image Scaling from between 2% and 100% of the original size.
2) Paletized conversion from 24 bit to 8 bit color (Netscape palette), or 256 grey.
3) Error Diffusion dithering from 24 bit and 8 bit images to 1 bit images.
Notes:
If the images are compressed to 8 bit or 24 bit, then the pixels are anti-aliased when the image is reduced. This means no lines or font information is lost, and images continue to appear crisp. Single pixel lines are reduced to successively lighter grey lines as the image compresses.
If the source TIFF file contains multiple pages, then the output files are numbered filename001.jpg, filename002.jpg, etc.
If the input file is a TXT file containing a list of multiple files, then the output pages are concatentated (where appropriate). See SampleTxt.bat. The text file must be formatted one filename per line. The last line must end with a 'newline' character.
Jpeg files are lossy. You can specify how much information loss is tolerable using the /q command line parameter.
PNG files (Portable Network Graphics) 24 bit compression is lossless. 8 bit compression has a reduced color palette (256 colors, or 256 shades of grey). 1 bit compression is comparable to Group3 and Group 4 TIFF compression. 8 bit compression is comparable to JPEG compression. 24 bit compression is about twice as large as JPEG compression, but twice as small as TIFF RLE compression. See file size information below for more compression details.
PDF files are multi-page bitmaps, stored at 1 bit, or 8 bit, or 24 bit.
The file conversion functionality is contained in a multi-threaded COM object. Sample C++ code and VB code are provided in this drop (cpsample.zip, and vbsample.zip).
Comparative Output File Sizes:
100% scaling:
4,102,466 IFAX.TIF - 24 bit COLOR TIFF file (run length encoding)
883,639 ifax.png - convert Color TIF to 100% scaled 24 bit COLOR PNG file
518,665 ifax.jpg - convert Color TIF to 100% scaled 24 bit COLOR JPEG file
360,899 test100_grey.png - convert Color TIF to 100% scaled 8 bit PNG - 256 grey values
294,331 test100_1bit.pdf - convert Color TIF to 100% scaled 1 bit PDF file (Group 4 compression)
259,852 ifax100_1bit.tif - convert Color TIF to 100% scaled 1 bit B&W TIFF file (Group 3 compression)
155,356 test100_1bit.png - convert Color TIF to 100% scaled 1 bit PNG file
50% scaling:
159,876 test50_grey.png - convert Color TIF to 50% scaling, PNG - 8 bit grey
160,457 test50_grey.pdf - convert Color TIF to 50% scaling, PDF - 8 bit grey
37% scaling:
650,578 test37.tif - convert Color TIF to 37% scaling, 24 bit TIFF
373,016 test37_high.jpg - convert Color TIF to 37% scaling, JPEG - high quality (large file size)
271,327 test37_24bit.png - convert Color TIF to 37% scaling, PNG - 24 bit (large file size)
 87,054 test37_med.jpg - convert Color TIF to 37% scaling, PDF - medium quality (medium file size)
 85,666 test37_med.jpg - convert Color TIF to 37% scaling, JPEG - medium quality (medium file size)
 66,020 test37_8bit.png - convert Color TIF to 37% scaling, PNG - 8 bit (small file size)
 25,608 test37_low.jpg - convert Color TIF to 37% scaling, JPEG - low quality (small file size)
18% scaling:
116,582 testBW18.tif - convert B&W TIFF to 18% scaling, 24 bit TIFF
 52,509 testBW18_256.png - convert B&W TIFF to 18% scaling, 8 bit PNG 256 shades of grey
 19,844 testBW18.jpg - convert B&W TIFF to 18% scaling, 24 bit JPEG
 14,927 testBW18.png - convert B&W TIFF to 18% scaling, 8 bit PNG 6 shades of grey
10% scaling:
15,579 test10_grey.png - convert Color TIF to 10% scaling, PNG - 8 bit grey
JPEG 24 bit best for large color images. Compression looses information.
PNG 24 bit best for large color images - non lossy.
TIFF 24 bit best for non-compressed images (very large)
PDF 24 bit best for Color (JPEG compression)
PNG 8 bit best for grey images, or limited color images
PDF 8 bit best for grey images, or limited color images (PNG compression)
TIFF 1 bit Group 3 best for 1 bit images with lots of dithering
TIFF 1 bit Group 4 best for 1 bit images with minimal dithering
PDF 1 bit best for B&W images (1 bit) (Group 4 TIFF)
PNG 1 bit very good compression for all image types
If you compress, then decompress, then compress JPEG files, you will loose information. This is becase the JPEG file format is LOSSY. Best to capture as PNG or TIF if you are planning on doing a lot of scaling.
COM object interface:
Sept /2002
Copyright (c) ImageMAKER Development Inc.
Apartment Threaded IMGCOM.DLL COM object. Details as follows:
To register the COM object:
regsvr32 imgcom.dll
FileName: imgCom.dll
Dependencies: img32jps.dll (must be in the same directory)
uuid: "0cf659ef-e85b-4da2-b381-46c9943d0d39" : IImgTools
description: ImageMaker ImgTools 1.0 Type Library
Object Name (OLE/COM Object Viewer name): ImageMaker Image Manipulation Tools
Methods:
HRESULT CopyImage(
      BSTR lpInfile,
      short nStartPage,
      short nEndPage,
      BSTR lpOutfile,
      short nFileType,
      short nScale,
      short* pRetCode);

// full path name of input file
// 1 based
// 1 based, -1 for all pages
// full output file name
// file type (see ps_faxapi.h for list)
// between 2 and 100 (2% to 100%)
// [out] 0 for success, negative for failure (see error codes below)
HRESULT GetImageInfo(
      BSTR lpInfile,
      int* pNumPages,
      short* pBitCount,
      int* pWidth,
      int* pHeight,
      short* pRetCode);

// full path name of file
// [out] number of pages
// [out] bit count
// [out] width in pixels
// [out] height in pixels
// [out] 0 for success, negative for failure
HRESULT PrintImage(
      BSTR lpInfile,
      BSTR lpPrinterName,
      short* pRetCode);

// full path name of file to print
// name of printer or empty string for default printer
// [out] 0 for success, negative for failure
Error Return Codes:
#define ERR_SUCCESS 0
#define ERR_GENERAL -1
#define ERR_OPEN_INPUT -2
#define ERR_OPEN_OUTPUT -3
#define ERR_COPY_PAGE -4
#define ERR_MEMORY -5
#define ERR_SCALE -6
#define ERR_CREATE_DIR -7
#define ERR_APPEND_OUTPUT_PAGE -8
#define ERR_DITHER -9
#define ERR_NO_FILEASSOC -10
#define ERR_NO_PRINTTO_CMD -11
#define ERR_NO_PRINT_CMD -12
#define ERR_SHELLEXECUTE -13
Properties:
jpgQuality (r/w)

ditherIntensity (r/w)
pdfAuthor (r/w)
pdfKeywords (r/w)
pdfSubject (r/w)
pdf Title (r/w)
returnCode (r)
// 5:small/poor, 50:medium, 100:big/excellent
// default 90
// 1 - dark, 100 - light (for 1 bit images only)
// Author property for PDF files
// Keywords property for PDF files
// Subject property for PDF files
// Title property for PDF files
// Last return code
Input File Types Supported:
BMP
DCX
JPG
PCX
PNG
TIF
Output File Types (from ps_faxapi.h):
1 bit:
#define PS_TIF_GAMA
#define PS_TIF_NORMAL
#define PS_DCX
#define PS_PCX
#define PS_MR_REVERS
#define PS_MR_NORMAL
#define PS_MMR_REVERSE
#define PS_MMR_NORMAL
#define PS_PACKBITS
#define PS_CUSTOM_MH
#define PS_BMP
#define PS_PDF
#define PS_PNG
0
1
2
3
4
5
6
7
8
9
10
11
12
// Group 3 2D Modified Read (reverse)
// normal


// Group 3 2D Modified Read (reverse)
// Group 3 2D Modified Read (normal)
// Group 4 Modified Mofified Read (reverse)
// Group 4 Modified Modified Read (normal)
// Normal Tif Packbits
// custom MH file format (Winfax)
// BMP output
// PDF output
// PNG 1-bit output
8 bit:
#define PS_TIF8_PACKBITS
#define PS_BMP8
#define PS_PNG8
#define PS_PDF8
#define PS_PDF8G
#define PS_PNG8G
100
101
103
104
105
106


// PNG 8-bit output
// PNG in PDF
// PNG greyscale in PDF
// PNG 8-bit greyscale output
24 bit:
#define PS_TIF24_PACKBITS 200
#define PS_BMP24
#define PS_JPEG24
#define PS_TIF24_UNCOMPRESSED 203
#define PS_PNG24
#define PS_PDF24
200
201
202
203
204
205
// 24Bit colour TIF (packbits compression)
// 24Bit colour BMP
// 24Bit colour JPEG
// 24Bit colour TIF (no compression)
// 24bit colour PNG
// 24bit JPEG in PDF
To install:
Unzip and run SETUP.EXE
Product overview and operation is provided in the USRGUIDE.DOC file.
...Back to Downloads
Links