forked from bash0/cewe2pdf
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCLP file format.txt
46 lines (35 loc) · 3.2 KB
/
CLP file format.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
Copyright (c) 2020 by BarchSteel
The CLP file format (*.clp) used in CEWE FOTO
=============================================
The CEWE software uses its own format for the clipart, also called decorations. They can easily be identified by looking at the file names in the program folder under Resources\photofun\decorations.
Let's look a presumably simple file: \Resources\photofun\decorations\line_single_black.clp
The file contents is pure text, but it does to look like any known file format. It seems to be some sort of encoding and/or scrambling. If we look carefully, we see that for the encoding of the data only numbers and lower-case letters: 0-9, a-z (0x30-0x39 und 0x61-0x7A) are used. The total number of code points is
If we count the 10 characters for numbers plus 26 for the Arabic letters, we only get 36 unique code-points for the encoded text. That is a 36/256 = 14% coding efficiency, which is strangle low.
If look around a little bit in this folder, we find the file 'cliparts_default.xml' which contains a line:
<clipart file="line_single_black.svg" designElementId="63457" designElementType="clipart"/>
It looks like the .clp file is somehow related to a .svg fie.
Let's look at one of the included files
"Resources\photofun\categories\SVGTemplates\gifts\002-M-SF\002-M-SF1.svg"
It starts with the following text:
<?xml version="1.0" encoding
If we look at the same file with a Hex-Editor, we see these bytes:
3C 3F 78 6D 6C 20 76 65 72 73 69 6F 6E 3D 22 31 2E 30 22
Now let's look again at the line_single_black.clp:
The file starts with this:
a3c3f786d6qc2076v65727369x6hf6e3d
We immediately see similarities, if we organize the text with proper spacing:
a 3C 3F 78 6D 6qC 20 76 v65 72 73 69 x6hF 6E 3D
Many of the bytes appear identically in the .svg file.
The sequence '3C 3F 78 6D' is clearly '<?xm' which is the plain-text start of the svg-file. The first character 'a' is maybe some header for the .clp-file and is not needed.
And if we look at 6qC, it almost looks like 6C which would the next character to complete '<?xml', so the 'q' is somewhat extra in there. The same goes for 'v','x', and 'h'. If just remove them, we end up with a hexadecimal representation of the start of a valid file.
After looking around at a few other .clp files we can come up with these rules for decoding a .clp to a .svg file:
Decoding:
Discard the first character. It is always an 'a'. This is some sort of header.
Discard all characters expect 0-9, and a-f. This will result in a valid hexadecimal string.
Decode the hexadecimal string to is binary representation.
Using custom clip-art files
---------------------------
You can use your own .clp files in the CEWE software, but it is not known, if this will work if you really order a photo book with a custom clip-art.
You have been warned, so first copy your .svg or .clp file to the folder Resources\photofun\categories
Both format will work.
Then edit 'cliparts_default.xml' and add <decoration> section while using one of the existing sections as tempalte for your clip-art file. Use the .svg extension even if your real file has as .clp extension. Be sure to change the designElementId="1234" to a number that is not used anywhere else in the software. (Re-)Start the CEWE software.