Read support for WordPerfect Graphic files

Started by thorsted, April 25, 2023, 10:52:56 AM

Previous topic - Next topic

thorsted

The WordPerfect Graphics file (WPG) was a common metafile format which was normally vector, but could hold bitmap data. Some simple metadata extraction like height and width, date, etc from the format would be amazing.
https://archive.org/details/mac_Graphics_File_Formats_Second_Edition_1996/page/n989/mode/2up

Phil Harvey

Do you have any samples you can share?

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

thorsted

#2
A few can be found here:
http://fileformats.archiveteam.org/wiki/WordPerfect_Graphics

Also here:
https://archive.org/details/EncyclopediaOfGraphicsFileFormatsCompanionCd-rom

Later versions had some wrapped in OLE.
https://archive.org/download/corel-wordperfect-suite-8-professional-cd1/corel-wordperfect-suite-8-professional-cd1.iso/


Phil Harvey

I've looked into this.  As far as I can tell, there is no date/time metadata in these files.

Also, being a vector format, the width/height are completely arbitrary, and are given in inches.

I don't think this is very useful information, so I don't think it makes sense to add support for this format.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

thorsted

Hi Phil,

Thanks for taking the time to look into the format. There are two versions of the WPG format and some don't have the date embedded but others do. Also the format while vector can have bitmap data as well. Part of the hope is to have exiftool report back if it is vector/bitmap or have both.

Here is a sample 256 color bitmap version.
https://archive.org/download/EncyclopediaOfGraphicsFileFormatsCompanionCd-rom/GFF_CD.ISO/FORMATS%2FWPG%2FIMAGE%2FTRU256.WPG

Again thanks for your time.

Tyler

emendelson

Could I add a request for support for the WPG format? It was very prominent in the DOS era, and I get requests for information about it on my WordPerfect Updated site (http://wpdos.org).

I recently put together a rough-and-ready converter using open-source software, and got this thank you-message a few hours later:

https://www.wpuniverse.com/vb/forum/wordperfect-office/other-wordperfect-office-programs/445127-a-viewer-converter-program-for-wpg-graphics?p=445137#post445137

My converter could be a lot more effective if I could use ExifTool to tell me whether a WPG graphic has (for example) bitmap or vector data or both, or exactly which version of the specification it follows (there seem to be multiple varieties of the format).

I know there are other priorities, but I know there are quite a few users who would be grateful for a tool to read metadata in this format, old as it is.

Phil Harvey

I can find details about the format of WPG version 1.0 files, but I can't find the version 2.0 specification.  Presumably it is the version 2.0 files that contain date/time information because I don't see this in the 1.0 specification.

Do you have a reference for the version 2.0 format?

You said "multiple varieties of the format".  Hopefully there are just 2.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

thorsted

Phil,

You can see the WPG 2.0 specification here:
https://drive.google.com/file/d/17mJIohS1cAk4XZEbQmJp9rxxmA286quz/view?usp=sharing

Page=147

Thank you.

Thorsted

Phil Harvey

Hi Thorsted,

Thanks.  I'll see about adding support in the next release.  But as I said, I think the extracted metadata will be minimal:  Image size in inches, and I'll also see about extracting the sizes of any contained bitmaps.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

Phil Harvey

OK, here is what I have so far, tested on the sample file linked by Tyler:

> exiftool TRU256.WPG --system:all
ExifTool Version Number         : 12.62
File Type                       : WPG
File Type Extension             : wpg
MIME Type                       : image/x-wpg
WPG Version                     : 1.0
Records                         : Start of WPG Data (Type 1), Color Map, Output Attributes, Bitmap (Type 1), End of WPG Data
Image Width Inches              : 0.85
Image Height Inches             : 0.21

Basically, all I'm extracting is the image size in inches and a list of the records in the file.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

Phil Harvey

Version 12.62 is now available with basic WPG read support.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

thorsted

Phil,

Thank you! excited to try this out. May need to be careful is avoiding clashes with a regular WordPerfect document as they use the same header, except for byte 0x9 should always have a value of 16, anything else and its a different WordPerfect file.

Phil Harvey

Good point.  Do you have a WordPerfect document file you can share?

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

thorsted

Phil,

Here are a few.
https://drive.google.com/drive/folders/1tvqSn7MeQ_WQ8uj3C8NFzbZj7yhs9PTl?usp=sharing

The values for all the different values for type are:

WordPerfect File Types

10 (0x0A) WordPerfect document
11 (0x0B) Dictionary file
12 (0x0C) Thesaurus file
13 (0x0D) Block
14 (0x0E) Rectangular block
15 (0x0F) Column block
16 (0x10) Printer resource file (.PRS)
17 (0x11) Setup file [contains the system values for WP{WP}.SET (Setup values, Shift-F1)]
18 (0x12) Reserved
19 (0x13) Printer resource file (.ALL)
20 (0x14) Display resource file (.DRS)
21 (0x15) Overlay file (WP.FIL)
22 (0x16) WP graphic file (.WPG)
23 (0x17) Hyphenation code module
24 (0x18) Hyphenation data module
25 (0x19) Macro resource file (.MRS)
26 (0x1A) Graphics screen-driver file (.VRS)
27 (0x1B) Hyphenation lex module
28 (0x1C) Printer Q codes (used by VAX/DG)
29 (0x1D) Spell code module word list
30 (0x1E) WP.QRS file (WP5.1 equation resource file)
31 (0x1F) Reserved
32 (0x20) VAX.SET
33 (0x21) Spell code module rules
34 (0x22) Dictionary rules
35 (0x23) Reserved
36 (0x24) .WPD files
37 (0x25) Rhymer word file (WPCorp TSR product)
38 (0x26) Rhymer pronunciation file
39 (0x27) Reserved
40 (0x28) Reserved
41 (0x29) WP51.INS file (install options file)
42 (0x2A) Mouse driver for WP5.1
43 (0x2B) UNIX setup file for WP5.0
44 (0x2C) Macintosh WP2.0 document
45 (0x2D) VAX file (WP4.2 document)
46 (0x2E) External spell code module (WP5.1) (This file type is set aside for third parties to create their own speller code modules in WP5.1 DOS)
47 (0x2F) External spell dictionary (This file type is set aside so third parties can create their own dictionary .LEX files to be read by their speller code.)
48 (0x30) Macintosh SOFT graphics file (SOFT (Sequential Object Format) graphics file for the Macintosh WP.)
49 (0x31) Reserved
50 (0x37) Reserved
51 (0x38) WPWin 5.1 Application Resource Library added for WPWin 5.1

Phil Harvey

...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).