Solving problems with FilterJPG, FilterGIF commands

Corel PHOTO-PAINT has a set of commands to set extended filter options like FilterJPG, FilterGIF, and others. Unfortunately they do not work at all. The problem is that the commands do not store the filter information in the correct *.ini file and the filter manager doesn't pick it up. To overcome this problem, the only thing to do is to write to the correct *.ini file manually. In Corel PHOTO-PAINT 9, the filter information is stored in FiltMan.ini; in Corel PHOTO-PAINT 8, it was stored in photopnt.ini in the current workspace folder. In order to obtain the location of the current workspace folder, you should get the value of the following registry key:

  • HKEY_CURRENT_USER\Software\Corel\Corel PHOTO-PAINT\9, value "LastWorkspaceUsed" (for PP9)
  • HKEY_CURRENT_USER\Software\Corel\CorelDRAW\8\PhotoPnt\8, value "LastWorkspaceUsed" (for PP8)

The key points to the workspace file (for example, "_default.cw_"). The workspace configuration files are stored in the folder with the same name as this file but without extension (e.g. "_default").

Then, you need to call WritePrivateProfileString Windows API function to write to the ini file. JPEG filter section of the ini file has the following format:

  Photo-Paint 8 Photo-Paint 9
JPEG section [JPEG Filter]
Quality=23
Smoothing=10
SubFormat=0
Progressive=0
Optimized=1
[JPEG Filter]
Quality=23
Smoothing=10
SubFormat=0
Progressive=0
Optimized=1
Quality Factor=40
GIF section [GIF Filter]
Interlace=1
Invert Mask=0
Transparent=1
Color Index=14
Mask Index=0
[GIF Filter]
Interlace=1
Invert Mask=0
Transparent=1
Color Index=14
Mask Index=0
Frame Delay=0
Color Ref=0

The values are the same that you specify in the filter dialog box. This is a sample script for CorelPHOTO-PAINT 9 that gets the workspace folder, then writes to the ini file to set filter options:

DECLARE SUB FlushPrivateProfileString LIB "kernel32" \\
	(BYVAL Section&,BYVAL Key&,BYVAL Value&,BYVAL File$) \\
	ALIAS "WritePrivateProfileStringA"
DECLARE SUB WritePrivateProfileString LIB "kernel32" \\
	(BYVAL Section$,BYVAL Key$,BYVAL Value$,BYVAL File$) \\
	ALIAS "WritePrivateProfileStringA"

ON ERROR RESUME NEXT
ERRNUM=0
reg$=REGISTRYQUERY(1,"Software\Corel\Corel PHOTO-PAINT\9","LastWorkspaceUsed")
IF ERRNUM<>0 THEN 
   reg$="C:\Program Files\Corel\Graphics9\Workspace\Corel Photo-Paint9\_default.CW_"
ENDIF
ERRNUM=0
ON ERROR EXIT

INIFile$=LEFT(reg,LEN(reg)-4)+"\FiltMan.ini"

FlushPrivateProfileString 0,0,0,INIFile$
WritePrivateProfileString "JPEG Filter","Quality","5",INIFile
WritePrivateProfileString "JPEG Filter","Smoothing","10",INIFile
WritePrivateProfileString "JPEG Filter","SubFormat","0",INIFile
WritePrivateProfileString "JPEG Filter","Progressive","0",INIFile
WritePrivateProfileString "JPEG Filter","Optimized","1",INIFile

[ CorelSCRIPT Tips&Tricks | Learning CorelSCRIPT | Oberon Home Page ]

Copyright 2000 by Alex Vakulenko. All rights reserved.
This page was last revised on 02/13/00.