Projects/Liberty/File Formats/Husqvarna Viking SHV

From KDE Community Wiki
Revision as of 23:50, 2 October 2012 by Purple-bobby (talk | contribs) (→‎Husqvarna Viking SHV - EXE Menu: variation pattern summary noted)

Husqvarna Viking SHV - EXE Menu

Sometimes Pfaff, Husqvarna, or Viking files come as an EXE program: a self extracting ZIP compressed file; for Designer I software. The instructions by Husqvarna say design is in Menu 1, position 1. Once decompressed, with the likes of Ark or WINE, a directory tree is produced, for example:

File_name/

  • MENU_SEL.PHV
  • MENU_01/
    • MENU_01.MHV
    • DES01_01.SHV
  • MENU_02/
    • MENU_02.MHV
  • MENU_03/
    • MENU_03.MHV
  • MENU_04/
    • MENU_04.MHV


The file MENU_SEL.PHV appears to contain a software notice, the name of the pattern (sixteen times), menu labels for four menus (each repeated sixteen times: I assume intended for different languages), some four row table (looks like weights for each bit: 120, 82, 44 and 6), and finally a 4 bit per pixel pixmap (8 bit line count, 8 bit pixels/line, lines x (pixels/2 round up) bytes).


In subdirectory MENU_01, the file MENU_01.MHV appears to contain a software notice, menu label repeated sixteen times, some values (of unknown purpose 0x77 119, 0xFB 251/-5, and 6), list of 36 bytes, and a 4 bit per pixel pixmap.

The important file is DES01_01.SHV, this contains stitches, the stitches appear to be the same format as VP3.

Offset Size Type Description
0 86 ASCII Signature = "Embroidery..." software notice
0x56 86 1 Byte N1 length of string
0x57 87 N1 ASCII Name of pattern (appears limited to 12 characters)
0x57+N1


After the header is an 16 colour image, there are two forms 8 bit sizes and 16 bit sizes. The 16 bit sizes are flagged with three bytes: 0xFF 0xFF 0x01. Big-endian is used for 2 and 4 byte numbers.

Offset Size Type Description
0 3 Byte 0xFF 0xFF 0x01
3 2 Count Height, lines in the pixel-map (unsigned big-endian)
5 2 Count Width, pixels in a line, two pixels are packed in a byte, odd count leaves empty nibble in last byte of line
7 2 Count Unknown width/2 round down
9 2 Count Unknown height/2 round down
11 2 Count Unknown width/2 round down
13 2 Count Unknown height/2 round down


Offset Size Type Description
0 1 Count Height, lines in the pixel-map
1 1 Count Width, pixels in a line, two pixels are packed in a byte, odd count leaves an empty nibble in last byte of each line
2 1 Count Unknown width/2 round down
3 1 Count Unknown height/2 round down
4 1 Count Unknown width/2 round down
5 1 Count Unknown height/2 round down


Followed by the bytes of the pixel-map.

Now the stitches, follow a summary and colour table.

Offset Size Type Description
0 1 Count Colour count, number of rows in colour table
1 1 Signed Unknown = -60 or 196 or bit-set [1100 0100]
2 1 Count Unknown = 40, may be weight in km/kg
3 1 Byte Unknown = 0x00
4 1 Byte Unknown = 0x90 or 0x10 = bit-set [x001 0000]
5 2 Byte Unknown = 0 0
7 2 Signed Right extent in 0.1 mm
9 2 Signed Top extent in 0.1 mm
11 2 Signed Left extent in 0.1 mm
13 2 Signed Bottom extent in 0.1 mm
15 4 Count total stitch count


Each colour table row appears:

Offset Size Type Description
0 4 Count stitch count, related to number of stitches of this thread
4 1 Byte Unknown, colour index
5 3 Byte Unknown = 0x02 00 00, this could be colour name string
8 2 BCD Thread part-number
10 2 Signed Start X in 0.1 mm
12 2 Signed Start Y in 0.1 mm


The stitches are pairs (dx, dy) of signed 8 bit offsets (from previous current position) with an escape code. When dx is 0x80 -128, dy gives the command.

Code Description
0x80 0x01 Start 16 bit jump stitch
0x80 0x02 End 16 bit jump stitch, enables stitches to be rewound
0x80 0x03 Unknown, may be deleted stitch
0x80 0xA0 Start 8 bit jump stitch
0x80 0x00 End 8 bit jump stitch


The jump stitch, going forward, Start then relative X displacement, relative Y displacement, End. When rewinding or backing up, the End will be seen, then Y displacement, X displacement, and Start.