Alternatives for .sfw file format detection

There are several different ways to detect Seattle FilmWorks / PhotoWorks .sfw (and .#01 style) file formats. Sometimes, simple tools that are readily available (eg, Windows Notepad) are sufficient to get the job done adequately, after a little training of what to look for. On the other end of the spectrum, there are tools expressly designed to detect and identify many different file formats (eg, TrID) and tools designed expressly to identify the different .sfw file formats (eg, sfwwhichfmt).

The most accurate way to identify the Seattle FilmWorks / PhotoWorks .sfw (and .#20 style) file formats is with jonesrh's sfwwhichfmt, sfwinfo, or sfw98jpgtran. The sfwwhichfmt program will also detect the other known Seattle FilmWorks / PhotoWorks file formats: .pwp, .pwm, .alb, as well as a few other common, industry standard, image formats.  sfwwhichfmt is publicly accessible; the sfwinfo / sfw98jpgtran duo is not.

Another very accurate way to detect all the known Seattle FilmWorks / PhotoWorks file formats: .sfw, .pwp, .pwm, .alb, and .#nn, is Marco Pontello's TrID file identifier utility, optionally combined with jonesrh's "full-blown" TrID definitions for Seattle FilmWorks files.

But this "alternatives" page is focused primarily on other tools besides TrID, sfwwhichfmt, sfwinfo, and sfw98jpgtran.

Most of the alternatives mentioned here are command line utilities that involve searching for one or more of the SFW oriented strings (SFW98A, SFW98, SFWF, SFW94A, SFW94, SFW93A, and SFW9).

Some of them dump or display the entire file in hex.

And the crudest mechanism is to simply open the file in Windows Notepad (or another simple text editor) and look for the SFW oriented strings.

If you don't want to (or can't) download TrID or sfwwhichfmt, and if you don't want to use Online TrID, and if you already have one of the alternative programs mentioned in the Overview or in sections 2 thru 8, then that alternative may very well suffice to identify your .sfw files' formats well enough to decide what .sfw conversion utilities should be used to convert the .sfw files into .jpg (or some other more usable format).

I've created this documentation with listings from my private help system (which utilizes the Accelr8 Open DCL Lite v2.21 help system), followed by some editing of that help output to only include stuff pertinent to the searching for SFW strings in .sfw files, as well as deleting any of the utilities copyrighted help output. That approach was a quick way to document these alternatives and avoid unnecessary duplication.

1. Overview of searching for SFW oriented strings and signatures

A8$ help search_sfw

DMGREP was originally my most useful utility for quickly locating all 
SFW98A format .sfw files without having to write a special purpose program 
to do that.  And, it is still the best for locating all the SFW oriented
strings (not just the SFW98A string).  

However, the "PERLSEARCH -xSFW98A" mechanism is the best for locating strictly
the SFW98A format .sfw files in a directory tree.

An overview analysis follows:

    - The PERLSEARCH utility (ie, ActiveState Perl's \bin\search.bat) --
      in conjunction with the -xSFW98A enhancement -- is the best mechanism
      for detecting strictly the files that have the SFW98A magic id.
      In fact, for that purpose of detecting strictly SFW98A format files, 
      it's even better than sfwwhichfmt, sfwinfo, sfw98jpgtran, and TrID.
      * It works in DCL Lite and WinXP CMD shells.
      * It is not as readable as DMGREP when not using -f or -l switches.
      * Requires ActiveState Perl's \bin\search.bat.
      * Requires -xSFW98A enhancements to be inserted into .search startup file
        in user's %HOME% directory (but this is quite easy and the example
        is included herein).
      * It is open source and (probably) available in most all platforms.
      For more details, see section 5.

    - The DMGREP (Digital Mars GREP) command was originally the most useful.
      * It works in DCL Lite and WinXP CMD shells.
      * It is very readable.  It does *not* show non-printable garbage.
      * It lists the actual string which matches, so it will show both
        SFW98A and SFW98 and SFW94 and SFW94A if the pattern is "SFW9".
        Neither UnxUtils' or Borland's grep would do that.
      * It works even if the root directory of a tree does not have any
        *.sfw files.  The UnxUtils' grep would not recurse if there were
        no *.sfw files in the root of the tree.  Also, the Borland grep
        would not recurse in that situation.
      * Digital Mars GREP came with my Digital Mars C (which is not free).
      For more details, see section 2.

    - The SFWINFO utility, the information only variant of SFW98JPGTRAN,
      is the most complete analyzer of SFW94A and SFW98A file formats.
      * It is not as readable as DMGREP or PERLSEARCH -xSFW98A for an initial
        analysis.
      * It only operates on one file at a time
        (but can do an entire system in conjunction with a script 
        which uses WinXP CMD shell's "for /r" command to recurse entire
        directory trees).
      * It was originally planned to be publicly available GPL licensed 
        open source, but has now been frozen as a private jonesrh tool.

    - The SFWWHICHFMT utility is an extremely pruned down version of SFWINFO
      which has been enhanced to detect all Seattle FilmWorks / PhotoWorks
      file format signatures, yet is free, open source, and public domain.
      * It can detect all the Seattle FilmWorks / PhotoWorks file formats.
        It's detection capabilities are slightly better than TrID and
        slightly worse than PhotoWorks itself.
      * It is not as readable as DMGREP or PERLSEARCH -xSFW98A for an initial
        analysis.
      * It only operates on one file at a time
        (but can do an entire system in conjunction with a script which 
        uses WinXP / Win7 CMD shell's "for /r" command to recurse entire 
        directory trees).
      * It is open source and has been freely released to the public
        using the CC0 Public Domain Dedication.
      For more details, see jonesrh's sfwwhichfmt.

    - The TrID utility is almost as good as SFWWHICHFMT at detecting all the
      Seattle FilmWorks / PhotoWorks file formats.
      * It can handle wildcards to detect all files in a single directory
        (but can do an entire system in conjunction with a script 
        which uses WinXP / Win7 CMD shell's "for /r" command to recurse
        entire directory trees).
      * It can identify over 14800+ other formats!!!
      * There is also an Online TrID facility which can detect the format of
        a single file at a time.  Using Online TrID eliminates the need 
        to download a utility to your machine.  Of course, it has the
        disadvantage that you'll have to upload your (private) photo(s)
        to the Online Trid site.
      For more details, see TrID defs for SFW files.

    - The GSAR utility can be used for several different SFW string searches.
      * It can list hex byte offsets, matched strings and
        surrounding context, and filename.  So it is somewhat better than 
        DMGREP in that it can display a very useful hex offset.  
      * It can optionally display the matched string and surrounding context
        or it can leave these off and only display the offsets.
        When displaying the surrounding context, it is not quite as readable
        as DMGREP, though it still displays the hex byte offset.
      * It only operates on one directory at a time.
      * It is open source and (probably) available on most all platforms.
      For more details, see section 4.

    - The CMD FIND command was originally useful also.  
      * It, by default, lists all files processed, so you can see if all files
        are processed.  This is one way it is better than DMGREP.
      * It also lists all the strings, similar to what DMGREP does.
      * However, it only operates on one directory at a time.
      * And it does not display useful offsets.
      For more details, issue the following command to Windows CMD Prompt:
          $ HELP FIND

    - The DUMPSTR (ie, TDUMP -Q -S) command can list decimal (not hex) offsets
      and the matched strings as well as the filename (regardless whether
      there was a match or not).  However, it only operates on one file 
      at a time.
      * It can be used to find all the SFW98A format files.
      * It can be used to quickly find some of the SFW oriented strings.
      * TDUMP came with Borland C++.
      For more details, see section 3.

    - The CMD FINDSTR command can find the multiple references,
      like DMGREP and CMD FIND.  By default, it only lists the files
      that match.  And it operates on the directory tree correctly,
      like DMGREP.  It prints a bit too much garbage for me.
      However, it can isolate the search to "probably" the beginning
      of the file by using the beginning of line switch, /B.
      Also, it colors the filename different from the matched line.
      For more details, issue the following command to Windows CMD Prompt:
          $ HELP FINDSTR

Obviously, any utility which can dump and/or edit a file in hex, either 
manually or programatically could also be used, but I've only mentioned 
three below: XnView and IrfanView (see section 7) -- since they are
excellent candidates for doing .sfw to .jpg (and other format) conversions -- 
and HEXDUMP (see section 6).

I didn't think any of my other GREP variants (besides DMGREP) were very useful
for the SFW string detection: UnxUtils' AGREP, EGREP, FGREP, GREP, and 
Borland C++'s GREP.  And I purposefully chose not to use TECO MUNG.

For further help on some of the above tools summarized in the Overview and to see some detailed examples of various SFW string searches, continue reading sections 2 thru 8...

2. Using Digital Mars' GREP to search for SFW strings

A8$ help dmgrep

Digital Mars' GREP will search for strings in multiple files.
Some of its advantages are: it will search system and hidden files,
it will search binary files, it will search for wide characters strings.

It is quite useful for text searching in binary files, since it will show
all the matches without lots of excess garbage.

DMGREP is my DCL Lite verb to run Digital Mars' GREP.  The DMGREP verb 
is defined as:

    $ dmgrep :== shell c:\dm\bin\grep

DMGREP was originally my most useful utility for quickly locating all
SFW98A format .sfw files without having to write a special purpose program
to do that.  And it is still my most used utility for occasionally searching
for these SFW strings: 

    SFW98A, SFW98, SFWF, SFW94A, SFW94, SFW93A, SFW95B, SFW9

Examples:

    1. Search for all SFW98A format .sfw files in a directory.

           $ cd \progra~\photow~1\images\1997_7469
           $ dmgrep == "shell c:\dm\bin\grep"
           $ dmgrep SFW98A *.sfw
           7469_15.sfw:SFW98A.
           7469_04.sfw:SFW98A.
           7469_02.sfw:SFW98A.
              .
              .
           7469_24.sfw:SFW98A.
           7469_23.sfw:SFW98A.
           $

    2. Search for all SFW98A format .sfw files in a directory tree,
       listing each directory regardless whether that directory
       has any files that contain the search string or not.

           $ cd \progra~\photow~1\images
           $ dmgrep -r -v SFW98A *.sfw
           ---- '*.sfw'
           ---- '2005-xx_Birthday\*.sfw'
           2005-xx_birthday\22_Surprise 3.sfw:SFW98A.
           2005-xx_birthday\20_Phillips 6.sfw:SFW98A.
              .
              .
           ---- 'NY wedding\*.sfw'
           NY wedding\20010814_NY_wedding_IMG_0095.sfw:SFW98A.
           NY wedding\20010814_NY_wedding_IMG_0096.sfw:SFW98A.
              .
              .
           ---- 'June 97 - 02915\*.sfw'
           June 97 - 02915\02915_01.sfw:SFW98A.
           June 97 - 02915\02915_02.sfw:SFW98A.
           June 97 - 02915\02915_03.sfw:SFW98A.
              .
              .
           ---- 'Strange and Beautiful Roads\*.sfw'
           ---- 'Lexiaguo\*.sfw'
           $

       The -r does the recursive directory tree search.
       The -v displays each individual directory's wildcarded filespec.

3. Using Borland's TDUMP -Q -S to search for SFW strings

A8$ help dumpstr

DUMPSTR (or DUMPS for short) is my DCL Lite verb to issue 
Borland's TDUMP -Q -S to show the strings within a file.

My DCL Lite DUMPSTR verb is defined as:

    $ dumps*tr :== shell c:\borland\bcc55\bin\tdump -q -s

Some examples are:

  1. With quiet copyright, string search for any string which is at least
     4 characters long:

         $ dumpstr file_with_sfw98_and_thumbnail.sfw
          Display of File file_with_sfw98_and_thumbnail.sfw
               1: SFW98A
             288: :JPRSaaa
             311: SFWF
             709: ehgBJ
             757: Kq"4p
                .
          much mumbo-jumbo
                .
           41436: b|{Dko
           41520: :xxxx_yyyymm_portrait_Photoworks_bmp_to_q85_sfw98.sfw
           41695: SFW94
           41952: $3br
           41964: %&'()*456789:CDEFGHIJSTUVWXYZcdefghijstuvwxyz
           42183: &'()*56789:CDEFGHIJSTUVWXYZcdefghijstuvwxyz
           42323: [][S
                .
          more mumbo-jumbo
                .
           44398: @Pe+

  2. Search for any string of at least 7 characters, case insensitive,
     and don't list line #s or copyright.

         $ dumpstr -s7u file_with_sfw98_and_thumbnail.sfw
          Display of File file_with_sfw98_and_thumbnail.sfw
         :JPRSaaa
         :A`B:[l?
         bYoZ&qN*
            .
            .
         :xxxx_yyyymm_portrait_Photoworks_bmp_to_q85_sfw98.sfw
         %&'()*456789:CDEFGHIJSTUVWXYZcdefghijstuvwxyz
         &'()*56789:CDEFGHIJSTUVWXYZcdefghijstuvwxyz

  3. With quiet copyright, string search, case sensitive for SFW9:

         $ dumpstr -ss=SFW9 file_with_sfw98_and_thumbnail.sfw
          Display of File file_with_sfw98_and_thumbnail.sfw
               1: SFW98A
           41695: SFW94

  4. With quiet copyright, string search, case sensitive for SFW98A:

         $ dumpstr -ss=SFW98A file_with_sfw98_and_thumbnail.sfw
          Display of File file_with_sfw98_and_thumbnail.sfw
               1: SFW98A

     This approach can compete with the "DMGREP SFW98A filename.sfw" method
     of checking for a SFW98 format .sfw file, since it does show the exact
     offset in the file.  However, this program can only operate on 1 file
     at a time, so it would have to be driven by a shell for loop.

  5. With quiet copyright, string search, case sensitive for SFW9:

         $ dumpstr -ss=SFW9 file_with_sfw98_and_2_thumbnails.sfw
          Display of File file_with_sfw98_and_2_thumbnails.sfw
               1: SFW98A
           87688: SFW94
           94806: SFW94

     This shows the exact offsets of the SFW98A file identifier along with
     the exact offsets of the SFW94 string in the APP0 segments of the
     two SFW94 thumbnail images.

4. Using Unxutils' GSAR to search for SFW strings

A8$ help gsar

My DCL Lite verbs GSAR and UUGSAR will run UnxUtils' GSAR command-line
general purpose search and replace tool.

It is useful for the following when searching for strings in .sfw files:

    - searching in binary files since the binary
      search and replacement strings can be easily encoded using
      the :nnn sequence where nnn is the decimal number of a byte
      (as alternative to TECO and Cream),

    - searching in multiple or wildcarded files
      (as alternative to MUNG CHANGE, GAWK, EDC, and Cream),

    - automation of either text or binary searches,
      since it is inherently command line oriented and
      can operate on 1, several, or wildcarded files
      (as alternative to EDC, Cream, and UnxUtils SED),

    - displaying byte offset of matches in file,

    - showing context match surroundings in hex,

    - looking for SFW strings (SFW98A, SFWF, SFW94, etc) in .sfw files,

GSAR is probably not very useful for (non-replacement) searching of text files,
since DCL Lite's SEARCH command works far better for that purpose.

My GSAR and UUGSAR symbols are defined as:

    $ gsar :== shell c:\unxutils\usr\local\wbin\gsar
    $ uugsar :== shell c:\unxutils\usr\local\wbin\gsar

Examples:

       .
       .

    5. Search for "SFW98A", "SFW94A", "SFW94", "SFW9", and "SFWF" in
       *.sfw files, performing each as a separate search.

       This will only list the offset and # of matches for the files
       in the wildcard list which do match the string.

           $ ! Match for the SFW98A format .sfw files.
           $ gsar -sSFW98A -b *.sfw
           7469_02.sfw: 0x0
           7469_02.sfw: 1 match found
           7469_03.sfw: 0x0
           7469_03.sfw: 1 match found
           $ ! No match for SFW94A if all .sfw files in that directory
           $ ! begin with SFW98A.
           $ gsar -sSFW94A -b *.sfw
           $ ! Match for SFW94 which is in the APP0 of all SFW94 format
           $ ! thumbnails in a SFW98A format .sfw file.
           $ gsar -sSFW94 -b *.sfw
           7469_02.sfw: 0x15687
           7469_02.sfw: 0x17255
           7469_02.sfw: 2 matches found
           7469_03.sfw: 0x172d6
           7469_03.sfw: 0x18fd3
           7469_03.sfw: 0x19dcb
           7469_03.sfw: 3 matches found
           $ ! Match for both SFW98A at beginning and for all thumbnails
           $ ! in a SFW98A format .sfw file.
           $ gsar -sSFW9 -b *.sfw
           7469_02.sfw: 0x0
           7469_02.sfw: 0x15687
           7469_02.sfw: 0x17255
           7469_02.sfw: 3 matches found
           7469_03.sfw: 0x0
           7469_03.sfw: 0x172d6
           7469_03.sfw: 0x18fd3
           7469_03.sfw: 0x19dcb
           7469_03.sfw: 4 matches found
           $ ! Match for SFWF that is in the APP0 of SFW98A format .sfw files.
           $ gsar -sSFWF -b *.sfw
           7469_02.sfw: 0x136
           7469_02.sfw: 1 match found
           7469_03.sfw: 0x136
           7469_03.sfw: 1 match found
           $ ! Match for a SFW94A format .sfw file's:
           $ ! - beginning SFW94 signature,
           $ ! - SFW94 in the APP0 of SFW94A format main image, and 
           $ ! - SFW94 in each of 4 different thumbnails.
           $ gsar -sSFW94 -b 82956_01.sfw
           82956_01.SFW: 0x0
           82956_01.SFW: 0x161
           82956_01.SFW: 0x18dcd
           82956_01.SFW: 0x1a202
           82956_01.SFW: 0x1bfee
           82956_01.SFW: 0x1f07f
           82956_01.SFW: 6 matches found

    6. Search for "SFW9" in *.sfw files.

       This will list the offset, the minimum of 16 bytes surrounding context
       and # of matches for the files in the wildcard list which do match the
       string.  Compare to the 4th gsar command in Example 5.

           $ gsar -sSFW9 -b -c16 *.sfw
           7469_02.sfw: 0x0: SFW98A......+...
           7469_02.sfw: 0x15687:  + -..SFW94.....
           7469_02.sfw: 0x17255:  + -..SFW94.....
           7469_02.sfw: 3 matches found
           7469_03.sfw: 0x0: SFW98A......+...
           7469_03.sfw: 0x172d6:  + -..SFW94.....
           7469_03.sfw: 0x18fd3:  + -..SFW94.....
           7469_03.sfw: 0x19dcb:  + -..SFW94.....
           7469_03.sfw: 4 matches found

    7. Search for start of Q15-coder / MQ-coder table in podw.exe and
       show the byte offset and the surrounding context in hex of 300 bytes.
       This shows that the table used for arithmetically encoding the
       main image of a SFW98A format file is hard-coded in that executable.

           $ gsar -s:x81:x01:x01:x56 -bx300 podw.exe

5. Using ActivePerl's SEARCH.BAT to search for SFW strings

A8$ help perlsearch

PERLSEARCH is my DCL Lite verb to run the SEARCH.BAT that comes with
ActivePerl, ActiveState's quality-assured binary build of Perl.

PERLSEARCH's primary uses are:

   ** - Search for all SFW98A format files.
   ** - Search with PerlRegex expressions on both filenames and text.
      - Automation of repetitive tasks since it is command line oriented
        and can operate on 1 or more files, specified by a PerlRegex.
      - Can exclude certain directories
        (somewhat like DCL Lite SEARCH /EXCLUDE but without having to specify
        the *.*).
      - Can exclude certain files
        (somewhat like DCL Lite SEARCH /EXCLUDE but any directory is ignored).
      - Can limit to files older than so many days ago,
        or files younger than so many days ago.
      - Can limit to files more recent than another file.
      - Can grep the files or just list the filenames of matches.
      - Can prefix each line with its line # in file.
      - Can sort files in each directory before starting.
      - Has a couple of more human readable output settings.
        The -nnice one is especially readable.
      - Has at least 4 levels of message verbosity.
      - Can report why a file is not checked.
      - Has a -x special case.
      - Has very flexible startup file which can be used to establish defaults
        and implement complex new enhancements using -xnnnn switches.
  *** - Best working Perl example to learn nuances of programming with Perl.

My DCL Lite PERLSEARCH symbol is defined as:

    $ perlsearch :== shell c:\progra~1\activestate\perl\bin\search.bat

Perl's search.bat can be explicitly run from DCL Lite via:

    $ perlsearch [options] [-e] [PerlRegex ...]

and if Perl's \bin directory is in the PATH and .bat is in the PATHEXT, then
Perl's search.bat can implicitly be run from the MS-DOS or CMD Prompt via:

    $ search [options] [-e] [PerlRegex ...]

The options, -e, and PerlRegex (as well as all other options and typical usage)
are explained inside SEARCH.BAT.

-xSFW98A enhancement
--------------------
If the user's %HOME% directory contains a ".search" file similar to 
SEARCH.BAT's internal .search file:

    magic: 32 : $H =~ m/[\x00-\x06\x10-\x1a\x1c-\x1f\x80\xff]{2}/
    option: -skip '.a .elc .gz .o .pbm .xbm .dvi'
    option: -iskip '.com .exe .lib .pdb .tarz .zip .z .lzh .jpg .jpeg .gif .uu'
    <!~> option: -skip '~ #'
 
and if the following changes are made to that default SEARCH.BAT startup file
".search" in the user's %HOME% directory to allow the -xSFW98A switch 
(where SFW98A must be capitalized), then the -xSFW98A switch can be used 
to select only files with the SFW98A magic id, ie, files which are very likely
Seattle FilmWorks / PhotoWorks SFW98A format .sfw files.

    - Change the default magic directive to look for various executables,
      objects, and otherwise munged files from:

          magic: 32 : $H =~ m/[\x00-\x06\x10-\x1a\x1c-\x1f\x80\xff]{2}/

      to the 2 lines:

          <SFW98A> magic:  6 : substr($H, 0, 6) ne 'SFW98A'
          <!SFW98A> magic: 32 : $H =~ m/[\x00-\x06\x10-\x1a\x1c-\x1f\x80\xff]{2}/

      The 1st of the two lines is new and is what selects only the files 
      beginning with SFW98A.  The 2nd of the two lines is the same as the 
      original "magic" line, except for the prepending of <!SFW98A>.

PERLSEARCH commands to utilize this -xSFW98A enhancement might then be...

    Example 1: List SFW98A files in directory tree of current directory.

                   $ perlsearch -f -xSFW98A

    Example 2: List SFW98A files in explicit directory tree specified
               with -dir switch.

                   $ perlsearch -dir c:\yourdir -f -xSFW98A
                        *or*
                   $ perlsearch -dir c:/yourdir -f -xSFW98A

    Example 3: List SFW98A files on the entire drive.

                   $ perlsearch -dir c:\ -f -xSFW98A
                        *or*
                   $ perlsearch -dir c:/ -f -xSFW98A

    Example 4: Use -l switch (instead of -f) to fine-tune the search
               for files with a Description field containing "Last contact".

                   $ perlsearch -l -xSFW98A "Last contact"
                        *or*
                   > search -l -xSFW98A "Last contact"

    Example 5: Use neither -l nor -f switches, but fine-tune the search
               for files with a Description field containing "Last contact",
               then very nicely list some of the info.  

                   $ perlsearch -xSFW98A -nnice "Last contact"
                        *or*
                   > search -xSFW98A -nnice "Last contact"

               The idea in that example is to find the SFW98A format .sfw
               files which contain a string "Last contact", which was stored 
               in the .sfw file's Description field of some of my .sfw files.

6. Using Nord's HEXDUMP to see SFW signatures in a hex dump

A8$ help hexdump

HEXDUMP is my DCL Lite verb for running Joe Nord's "hexdump / hexdump -r"
utilities.  It is very useful to flexibly delete bytes from or insert bytes
into a binary file using a sequence similar to the following:

    $ hexdump -s0000 -b -w bin_filename.typ > bin_filename_typ_hexdump.lis
    $ ! Edit the bin_filename_typ_hexdump.lis file with a text editor.
    $ hexdump -r < bin_filename_typ_hexdump.lis > bin_filename_new.typ_maybe_new

This "hexdump / hexdump -r" mechanism is quite easy, even though it involves
multiple steps.

HEXDUMP's primary uses are:

    - Produce hex dump.
    - Reassemble a binary file (ie, reverse hex dump via "hexdump -r")
      using an edited hex dump.

But it could also be used to examine any of the Seattle FilmWorks / PhotoWorks
files: .sfw, .pwp, .pwm, .alb, .#nn.
I found HEXDUMP very useful to fairly quickly, manually, losslessly convert 
SFW93A format images which Ryan Finnin Day sent me -- ie, the 28048871.#01 thru
28048871.#24 files that resided in a directory named 28048871.ROL.  I dumped 
each of the files with a "hexdump -s0000 -b -w ..." command similar to the one
listed above, edited the output .lis file to eliminate the hex representing the
first 30 bytes of the file, then edited the hex that followed the APP0 length 
(0010) so it represents "JFIF\0".  The initial hex in the file then looked like:

    FFD8
    FFE00010 4A464946 00

and everything else immediately following the 00 remained the exact same 
in the edited .lis file.  Finally, I executed a "hexdump -r" command similar
to the one listed above.

To give you a specific example -- for image 20 on that roll, the sequence was:

    $ hexdump -s0000 -b -w 28048871.#20 > 28048871_h20_hexdump.lis
    $ ! Edit the 28048871_h20_hexdump.lis file to remove hex equivalent
    $ ! of first 30 bytes, replace the APP0 signature with "JFIF\0",
    $ ! ie, "4A464946 00".
    $ hexdump -r < 28048871_h20_hexdump.lis > 28048871_20.jpg

Voila!  The roll 28048871 image 20 is now readable by any reader of .jpg files
as 28048871_20.jpg.  Furthermore, the quality of the image is 100% of the 
original.  You could then use jpegcrop (or a similar lossless rotator)
to rotate the image, if necessary, and still preserve the 100% quality.

For more details on HEXDUMP, see Joe Nord's HexDump

NOTE: This section's documentation is for the 2003-09 version of HEXDUMP.
      I have not yet tested the more recent 2016-04 version of HEXDUMP.

7. Using XnView or IrfanView to see SFW signatures in a hex dump

Besides the above command line utilities, it's worthy of mention that the XnView and IrfanView GUIs both have a mode that can display a file in hex. Both of them are popular, mature GUIs, free for personal use, and can convert the Seattle FilmWorks / PhotoWorks .sfw files to .jpg (and other) formats, so both those programs are prime candidates to perform the .sfw -> .jpg conversion.

Their View in Hex mode and Show HEX view features, respectively, can be used to very accurately, albeit manually, analyze whether a .sfw file is:

  • (compressed) SFW94A, ie, mangled JPEG, Huffman compressed,
  • SFW98A, ie, ultra-obfuscated, mangled JPEG, arithmetically compressed with a non-standard, hybrid compression method,
  • Uncompressed SFW94A, ie, mangled BMP, or
  • SFW93A, ie, slightly reformatted JPEG.
using:

Hint for .#nn files (or any SFW93A format files):
If you have a directory of .#nn files, you can use XnView's Browser function to open that directory, open one of the .#nn files, use XnView's Tool / View in Hex mode function to see if the file begins with SFW93A, then exit that Hex mode listing by pressing the Esc key. If that file began with SFW93A, then its probably safe to assume all the .#nn files in that directory are SFW93A format. So individually double-click open a .#nn file, click File / Save As, add a suffix of _nn to the filename (just before the suggested .jpg), click Save, then repeat from the "open one of the .#nn files" to the "Save" for each .#nn file.

That's probably the 2nd quickest way to convert an entire directory of SFW93A format images to .jpg (unless you can figure out how to automate that sequence with XnView's Batch facility) -- at least with publicly available tools. Furthermore, it will be seamlessly performed at a 90% quality level, so you'll likely not be able to visually detect any loss of quality. XnView's quality level is much better than the PhotoWorks Batch Convert 75% quality level (which can not be increased).

Note:
The #1 quickest way to convert an entire directory of SFW93A or SFW94A format images to .jpg (**if** you have Vista / Win7 / Win8 / Win8.1 / Win10) is Nord's sfwjpg (circa 2016-04 or later).

But Nord's sfwjpg uses a 75% quality level.  So if any of the images are very important to you, and especially if you think you will enlarge any of the images, then you might want to go ahead and try converting the .#nn files with XnView to see if XnView's 90% quality level looks any better or is just wasted space.

8. Using Windows Notepad to see SFW signatures in ASCII

Almost any file can be opened with Windows Notepad (or some equivalent simple editor on your platform). On Windows:

  • Right-click on a .sfw file.
  • Select Open With.
  • Do one of the following:
    • Select Notepad.
    or:
    • Select Choose Program... and in the Open With dialog box, either:
      • select Notepad, or
      • select Browse, then find Notepad, unclick "Always use the selected program to open this kind of file", and click Open.
  • Click OK.

If the .sfw file begins with SFW98A, followed by mostly white space for a while mixed with some weird characters, then the string :JPRS, then after about 17 characters the string SFWF appears, then you very likely have a SFW98A format .sfw file.

If the .sfw file begins with SFW94A followed by mostly white space for a while mixed with some weird characters, then about 10-15 colon (:) characters, all separated primarily with white space, and inside the group of colons there is the string SFW94 (without the final A), then you probably have a SFW94A format .sfw file. If there is also a clearly visible date between the initial SFW94A string and the SFW94 string inside the colons, then that's even more confirmation that you have a (compressed) SFW94A format .sfw file.

If the .sfw file begins with SFW93A followed by a bunch of mumbo-jumbo, then you probably have a SFW93A format .sfw file.

If Notepad goes into a 100% CPU state while opening the .sfw file, my guess is it is an Uncompressed SFW94A format file. That's what happened on all 3 cases of Uncompressed SFW94A files that I have.

Note:
If none of the above ideas in sections 2 thru 8 appeal to you, then I'd first suggest trying Marco Pontello's TrID utilities. The desktop version of those utilities can be used either with or without jonesrh's "full-blown" TrID definitions downloadable from the TrID definitions for Seattle FilmWorks files page.  The manifestations of TrID are a very good method to accurately detect all the known Seattle FilmWorks / PhotoWorks file formats: .sfw, .pwp, .pwm, and .alb, plus they'll detect 14800+ other formats!!!  That's one nifty advantage.

However, if you:

  • need to display Descriptions which you've entered for images contained in a PhotoWorks album,
  • plan on adding accurate detection of all the Seattle FilmWorks / PhotoWorks file formats to your existing software that reads the .sfw and/or .pwp files, or
  • need to understand the internal structure of Seattle FilmWorks / PhotoWorks files for some other reason,
then I'd strongly suggest you download the sfwwhichfmt sources and executable from one of the links in the jonesrh's sfwwhichfmt section.

This page is copyright © 2012-2022, Richard H. Jones. All rights reserved.

Page's last update was on 2022-06-22.