Readme for sfwwhichfmt v1.1.0  2015-02-07

Abilities

sfwwhichfmt can be used to differentiate the 3 main .sfw formats produced by the Seattle FilmWorks / PhotoWorks application:

  • SFW94
  • SFW98
  • Uncompressed (SFW94)

It can also detect the other Seattle FilmWorks / PhotoWorks file formats: .pwp, .pwm, and .alb.

Also, it can now correctly identify the earlier .sfw format: SFW93A.  [corrected on 2015-02-07]

For more details of these file formats, see https://jonesrh.info/sfw/index.html, the jonesrh .sfw conversion portal. Also, be sure to examine the sfwwhichfmt.c source. Some aspects of the formats are only explained in sfwwhichfmt.c.

For more details of other things which sfwwhichfmt can do -- eg, displaying the .sfw header "triplets" which give an overview of what some of the .sfw files contain, or displaying the contents of any .sfw Description field -- display the sfwwhichfmt help by simply running the sfwwhichfmt.exe executable with the -h or --help switch:

> sfwwhichfmt -h

or simply review the Help section below. It shows the output from issuing:

> sfwwhichfmt -v -h

Purposes

sfwwhichfmt has been provided for 2 main purposes:

  • to determine which format a .sfw file is in so that you can decide which of the .sfw file conversion utilities in the Existing .sfw to .jpg converters list will convert it to .jpg (or some alternate format),

  • to demonstrate how existing software can incorporate accurate detection of the Seattle FilmWorks / PhotoWorks file formats.

CC0 Public Domain Dedication

To allow for the most widespread adoption of its Seattle FilmWorks / PhotoWorks file format detection, the sfwwhichfmt source (including this readme) and the sfwwhichfmt executable have been released into the public domain using the Creative Commons CC0 1.0 Universal (CC0 1.0) Public Domain Dedication.

That should allow its Seattle FilmWorks / PhotoWorks file format detection guts to be incorporated into existing software -- whether commercial, shareware, or free (ie, no cost). And that should allow its guts to be incorporated into both open source and closed source software.

You should have received a copy of the CC0 Public Domain Dedication along with this software. See the file COPYING_(CC0_legal_code).txt or see:

       https://creativecommons.org/publicdomain/zero/1.0/legalcode

For a human readable summary of the CC0 legal code and for more CC0 information, see:

       https://creativecommons.org/publicdomain/zero/1.0/

There is ABSOLUTELY NO WARRANTY provided whatsoever with sfwwhichfmt.

Distributed Files

The following files are contained in sfwwhichfmt_win.zip, the sfwwhichfmt distribution for 32-bit x86 Windows systems:

  • sfwwhichfmt.exe

    This is the sfwwhichfmt executable. It is the only file necessary for someone who simply wants to evaluate the Seattle FilmWorks / PhotoWorks file formats for any .sfw, .pwp, .pwm, or .alb files.

    This was developed and thoroughly tested on a WinXP SP3 32-bit X86 Pentium M system. It has also been run on a WinME 32-bit X86 system. And it has been tested briefly on a Win10 system, a Win7-Pro SP1 64-bit AMD64 system, and a Win2000-Pro Pentium III system.

    It does NOT run on a Win31 system.

    I have not tested it on: Win95, Win98, Vista, or Win8/8.1.

  • sfwwhichfmt.c

    This is the guts of sfwwhichfmt. It contains almost all the source, including what would normally be separated into a .h include file. During most of development, it was the single source file.

    It contains a lot of information about the Seattle FilmWorks / PhotoWorks .sfw file format internals. It also does a good job of describing the Seattle FilmWorks / PhotoWorks .alb and .pwm file formats.

    I've tried to generalize it so it could be compiled with different compilers and on operating systems other than Windows. It's left as an exercise for the user to actually implement it with other compilers and/or on systems other than WinME / Win2000 / WinXP / Win7 / Win10.

  • sfwwhichfmt.rc

    The sfwwhichfmt resource source file. Contains the source of the VERSIONINFO resource which allows seeing the Version tab when right-clicking sfwwhichfmt.exe then selecting Properties.

  • sfwwhichfmt.h

    Contains the version oriented items needed by sfwwhichfmt.c and/or sfwwhichfmt.rc.

    Note:
    This doesn't contain all the sfwwhichfmt defines like an associated include file normally would contain. It was created late in the development / testing cycle. It strictly contains the version / build / copyright / "written by" info needed by sfwwhichfmt.c and/or sfwwhichfmt.rc.

  • makefile.

    Make file which uses the Digital Mars supplied MAKE utility in a Digital Mars C v8.37 thru v8.55 development system. Drives win32.mak. See both makefile and win32.mak for more details.

  • win32.mak

    Performs the guts of the "make-ing". Designed to be used with Digital Mars C v8.37 thru v8.55 development system. See win32.mak for instructions on how to drive win32.mak from Open DCL Lite or from WinXP CMD.

    Note:
    Both win32.mak and makefile are designed to not only build sfwwhichfmt, but also to build sfw98jpgtran and sfwinfo, two variations of a program which will *not* be publicly released.  Since I build all 3 of them in the same directory, I've chosen to not separate sfwwhichfmt into its own separate build files.  You'll just have to ignore the sfw98jpgtran, sfwinfo, and libjpeg stuff in makefile and win32.mak.  They have no bearing on sfwwhichfmt's build.

  • sfwwhichfmt.lnk

    Linker indirect command file -- automatically generated by win32.mak.

  • sfwwhichfmt.def

    Linker module definition file -- automatically generated by win32.mak.

  • sfwwhichfmt.obj

    The object file created by compiling sfwwhichfmt.c with the DMC compiler provided by Digital Mars.

  • sfwwhichfmt.res

    The resource object file created by compiling sfwwhichfmt.rc with the RCC resource compiler provided by Digital Mars.

  • readme_sfwwhichfmt.txt

    The readme file -- plain text version.

  • COPYING_(CC0_legal_code).txt

    The Creative Commons CC0 1.0 Universal (CC0 1.0) Public Domain Dedication legal code.

There are no project files. I did not use the Digital Mars IDDE, and I did not use MS Visual C++ or any other alternative development system.

All files were developed in the same directory. There was not a separate \RES directory for the resources.

Install Instructions

sfwwhichfmt doesn't write any registry entries and it doesn't install anything to the \windows directories. You simply extract files to the directory of your choosing then go from there.

The installation instructions to run sfwwhichfmt are:

  1. Extract sfwwhichfmt.exe from the sfwwhichfmt distribution -- sfwwhichfmt_win.zip -- using WinZip, ALZip, 7-Zip, your favorite unzipper, or by using Windows Explorer's built-in zip file viewer.

  2. Make sfwwhichfmt.exe more convenient to use by ensuring it is in the PATH or defining a macro or symbol to run it, using one of the following three techniques:

    1. Copy sfwwhichfmt.exe to some directory which is in the PATH.

      • Click Start / All Programs / Accessories / Command Prompt, and a "Command Prompt" window should appear.

      • Display the PATH environment variable by typing into the Command Prompt window everything on the following line after the > prompt, then press <Enter>:

        > path
      • Copy sfwwhichfmt.exe to some directory which is in that displayed PATH (using WinXP/Win7/Win10 CMD or Windows Explorer).

      This copying of sfwwhichfmt.exe into the PATH is the simplest solution for making sfwwhichfmt convenient to use. Once you do that, you can run it by typing sfwwhichfmt as the WinXP/Win7/Win10 command. For example:

      > sfwwhichfmt 76073_16.sfw
    2. In WinXP/Win7, create a DOSKEY macro to run sfwwhichfmt.exe.

      For example, assuming you extracted sfwwhichfmt.exe to the "p:\yourdir\bin" directory, define the sfwwhich macro as follows on WinXP/Win7:

      • Click Start / All Programs / Accessories / Command Prompt, and a "Command Prompt" window should appear.

      • Define the sfwwhich macro:

        > doskey sfwwhich="p:\yourdir\bin\sfwwhichfmt.exe" $*
      • Double-check your macro definition:

        > doskey /macros:all

      Now you can run sfwwhichfmt.exe by typing sfwwhich as the WinXP/Win7 command. For example:

      > sfwwhich 76073_16.sfw
    3. In Open DCL Lite, create a symbol to run sfwwhichfmt.exe.

      For example, assuming you extracted sfwwhichfmt.exe to the "p:\yourdir\bin" directory, and assuming you already have the Open DCL Lite console running, define the symbol as follows:

      $ sfwwhich*fmt == "shell p:\yourdir\bin\sfwwhichfmt"

      Then you can run sfwwhichfmt.exe by typing sfwwhich or sfwwhichfmt as the DCL Lite command. For example:

      $ sfwwhich 76073_16.sfw

If you want to examine the sfwwhichfmt source files and potentially enhance them, then the additional installation instructions are:

  1. Extract *ALL* the files from the sfwwhichfmt distribution -- sfwwhichfmt_win.zip -- to some directory using your favorite unzipper program.

    Alternatively, open the sfwwhichfmt_win.zip using Windows Explorer's native ability to open a .zip file from Explorer's folder view, then select *ALL* the files in the Detail pane and copy those files to some directory.

  2. Examine those extracted files as you see fit.

  3. Copy and modify them as you see fit.

  4. If you desire to install the Digital Mars C compiler and linker, see https://digitalmars.com.

The source can likely be adapted fairly easily to build in other development environments and to run on other operating systems (and maybe even other machine architectures).

Uninstall Instructions

Simply delete the files (described above) that were extracted from the sfwwhichfmt_win.zip distribution, and delete any directories created to contain those files.

Help

The following is the WinXP/Win7/Win10 CMD command that generates sfwwhichfmt's most extensive help, followed by the help listing it generates. This might help you decide if you want to download the sfwwhichfmt distribution or not.

> sfwwhichfmt -v -h

sfwwhichfmt v1.1.0  2015-02-07  Written 2012-2015 by Richard H. Jones.

Built using Digital Mars C/C++ 8.55.0.

*******************************************************************************

sfwwhichfmt is free software.  It costs $0.00, it is open source, and
the intention is for you to have maximum freedom to use it and/or
to modify it and incorporate its file format determination algorithm
essentials and its documentation into your own software and documentation --
regardless whether your software is commercial or not, and
regardless whether your software is open source or not.

You are especially welcome and encouraged to use it to determine the format
of Seattle FilmWorks / PhotoWorks .sfw files, and to include its core features
to add accurate .sfw file format determination to your own software.

To the extent possible under law, the author has dedicated all copyright and
related and neighboring rights to this software to the public domain worldwide
via the Creative Commons CC0 1.0 Universal (CC0 1.0) Public Domain Dedication.

sfwwhichfmt is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

You should have received a copy of the CC0 Public Domain Dedication
along with this software.  See the file COPYING_(CC0_legal_code).txt.

For a human readable summary of the CC0 legal code and for more CC0
information, see <http://creativecommons.org/publicdomain/zero/1.0/>.

*******************************************************************************

sfwwhichfmt determines the file format of a Seattle FilmWorks / PhotoWorks
.sfw file -- whether SFW94A, SFW98A, Uncompressed SFW94A, or SFW93A.

It will also determine the format of the other Seattle FilmWorks / PhotoWorks
files: .pwp, .pwm, and .alb.

usage: sfwwhichfmt [switches] inputfile

where: switches is one or more of the following:

         -h, --help, -?, ?, <no switches or other arguments>
                          Display this help.
         -v, --version    Display version, built using, warranty,
                            free software / open source / intention info,
                            and CC0 public domain dedication.
         -x, --extras     Display various "extra" information (see below).
         -e, --echo       Echo the command line so displayed data can be
                            matched with the command which generated it
                            when sfwwhichfmt is being driven by scripts
                            which send the stdout and stderr output to files.

       inputfile is the file whose format will be discerned.

The Seattle FilmWorks / PhotoWorks file formats will be listed on lines
beginning like one of the following examples:

    SFW format: SFW94A
    SFW format: SFW98A
    SFW format: Uncompressed SFW94A
    SFW format: SFW93A

    PWP format: SFW95B

    PWM format: SFW94A

    ALB format: SFW_ALB

unless either the -x or --extras switch is used, in which case the formats
are described a bit more thoroughly like one of the following examples:

    SFW format: SFW94A (ie, SFW mangled JPEG with Huffman coding)...
    SFW format: SFW98A (ie, SFW mangled JPEG with arithmetic coding)...
    SFW format: Uncompressed SFW94A (ie, SFW mangled BMP)...
    SFW format: SFW93A (ie, early SFW with JPEG starting at offset 0x1E...)

    PWP format: SFW95B (ie, SFW PhotoWorks multi-image PhotoMail file).

    PWM format: SFW94A (ie, SFW PhotoWorks Meta file).

    ALB format: SFW_ALB-10DD94 (ie, SFW PhotoWorks album).

Additionally, when the -x or --extras switch is used, the following extra
information is listed to get a better idea of what the .sfw (and .pwm) files
contain:

    - SFW header triplet names.
          These are my names for the pointer indices that reside
          from offset 0xC0 till just before 0xCC.  They are all
          12 bytes long, composed of three 4-byte entities:
              * triplet type,
              * offset (from beginning of file) to the associated block,
              * length of the associated block.

And the following is listed so you can make a permanent record of some of
the information entered into the PhotoWorks albums:

    - SFW Title.
          This is a title created when an image is added to a PhotoWorks
          album.  These are only listed if they are "unexpected",
          ie, when the Title field is NOT the same as "filename.filetype"
          of the file being evaluated.

    - SFW Description.
          This is a description which may have been optionally added to an
          image which has been added to a PhotoWorks album.  You can use
          sfwwhichfmt's output to save all your .sfw images' descriptions
          using some sort of shell piping or command output redirection.
          The SFW Description is only listed if it is not null.

Finally, when the -x or --extras switch is used, the following is listed
for the 3 main .sfw formats:

    - quality.
          This is a measure of the image quality on a scale of 0 to 100.

To minimize the clutter of error messages, the following extra file formats are
recognized and listed along with the Seattle FilmWorks / PhotoWorks formats:

    BMP format: BMP
    GIF format: GIF
    ICO format: ICO
    JPG format: JPEG
    PNG format: PNG
    PNM format: PBM/PGM/PPM
    SWF format: SWF (Flash, not SFW)
    TIFF format: TIFF

unless either the -x or --extras switch is used, in which case those formats
are listed as:

    BMP format: BMP (ie, Windows Bitmap).
    GIF format: GIF (ie, generic GIF).
    ICO format: ICO (ie, Windows Icon).
    JPG format: JPEG (ie, begins with hex FF D8 FF; could be JFIF, EXIF, etc).
    PNG format: PNG (ie, Portable Network Graphics).
    PNM format: PBM/PGM/PPM (ie, Portable BitMap, GrayMap, or PixMap).
    SWF format: SWF (ie, ShockWave Flash / Adobe Flash / Small Web Format...).
    TIFF format: TIFF (ie, Tagged Image File Format Bitmap).

Examples:

    1. Using WinXP/Win7/Win10 CMD, list the format of file 76073_16.SFW in the
       current directory (assuming sfwwhichfmt.exe resides somewhere in the
       path specified by the environment variable PATH):

       > sfwwhichfmt 76073_16.SFW

    2. Using WinXP/Win7/Win10 CMD, list the format of file 76073_16.SFW in the
       current directory and also list all the "extras" information
       (assuming sfwwhichfmt.exe resides in PATH):

       > sfwwhichfmt -x 76073_16.SFW

    3. Using WinXP/Win7/Win10 CMD, list the formats of all .sfw files in the
       current dir (assuming sfwwhichfmt.exe resides in "p:\yourdir\bin"):

       > for %F in (*.sfw) do "p:\yourdir\bin\sfwwhichfmt.exe" "%F"

    4. Using WinXP/Win7/Win10 CMD, list formats of all .sfw files on c: drive
       (assuming sfwwhichfmt.exe resides in the "p:\yourdir\bin" directory):

       > for /r "c:\" %F in (*.sfw) do "p:\yourdir\bin\sfwwhichfmt.exe" "%F"
       > for /r "c:\" %F in (*.#??) do "p:\yourdir\bin\sfwwhichfmt.exe" "%F"

       The 2nd for command is an attempt to find the SFW93A images whose
       filename is in the form of rrrrrrrr.#nn, where rrrrrrrr is roll number
       and nn is image number on that roll.

    5. Using WinXP/Win7/Win10 CMD, list formats of all .sfw, .pwp, and .pwm files
       in the current directory and list all the "extras" information for them:

       > for %F in (*.*w*) do "p:\yourdir\bin\sfwwhichfmt.exe" -x "%F"

       This (*.*w*) wildcard is a way of attempting to limit the files to
       Seattle FilmWorks / PhotoWorks files when examining a directory that
       contains lots of other image files (eg, .jpg, .bmp, etc) or lots of
       other clutter (.lis, .txt, etc).

    6. Using Open DCL Lite, list the format of file 76073_16.SFW in the
       current directory and also list all the "extras" information
       (after first defining a DCL Lite symbol to run sfwwhichfmt.exe):

       $ sfwwhich*fmt == "shell p:\yourdir\bin\sfwwhichfmt"
       $ sfwwhich -x 76073_16.sfw

    7. Using Open DCL Lite, do the same as example 5, listing the formats and
       "extras" of all .sfw, .pwp, and .pwm files in the currect directory
       (assuming sfwwhichfmt.exe resides in the "p:\yourdir\bin" directory),
       but also echo each command line:

       $ shell for %F in (*.*w*) do "p:\yourdir\bin\sfwwhichfmt.exe" -x -e "%F"

    8. Using WinXP/Win7 CMD, list the format of the current dir's 28048871.#20
       file, which is probably in SFW93A format, judging from the fact that
       it is in the rrrrrrrr.#nn format, where rrrrrrrr is the roll number and
       nn is the image number (and assuming sfwwhichfmt.exe resides in PATH):

       > sfwwhichfmt 28048871.#20

       If the file has been renamed to 28048871_20.sfw -- eg, 15 years ago
       by one of your relatives -- so that the PhotoWorks software could
       more easily convert all the directory's SFW93A images by first loading
       them all into a PhotoWorks album, then the following command line
       would be used to list the file format:

       > sfwwhichfmt 28048871_20.sfw

For more details on the Seattle FilmWorks / PhotoWorks file formats, see:

    sfwwhichfmt.c source
    http://jonesrh.info/sfw/index.html

Contact Info

See sfwwhichfmt.c for contact info.


This page was written in 2013 and 2015 by Richard H. Jones.  It was released into the public domain on 2013-03-11 using the Creative Commons CC0 1.0 Universal (CC0 1.0) Public Domain Dedication.

Page's last major update was on 2015-02-07 (when sfwwhichfmt updated to correct SFW93A detection).

Page's last updates were on 2018-08-24, 2019-03-18, 2020-05-21, 2021-03-28 (primarily to simplify some page internals, secondarily to update some links to https:, thirdly to clarify that sfw98jpgtran and sfwinfo will not be publicly released, fourthly to note that sfwwhichfmt works on Win10, etc), then 2022-06-22.

The contents are almost the same as what appears on the readme_sfwwhichfmt.txt included with the sfwwhichfmt v1.1.0 2015-02-07 release.