Skip to content

Technical Info.

A simplified flowchart of the stamping process is shown here:

1.Calculating stamp area -> 2.Storing the original JPEG sub-bitstream -> 3.Stamping -> 4.Encoding the stamped area only -> 5.Gathering all together

The 2nd step makes reverse operation possible. The 4th step is required for lossless stamping.

Note! The JPEG file format makes Lossless and Reversible stamping possible. PhotoStamper works with JPEG image files only.

 

1. Stamping pictures

Based on user preferences for a stamp (font size, background presence, etc.) PhotoStamper calculates the coordinates of the picture area which is going to be changed. Since JPEG is based on the 8×8 DCT algorithm, the coordinates are rounded to be divisible by 8.

From the original bitstream the program extracts a sub-bitstream which corresponds to the stamped area and stores it as a custom JPEG data marker. Along with the substream the application stores stamped area coordinates in this marker. It also computes and stores in the marker check sums both for the original bitstream and for the extracted sub-bitstream. It prevents the program to work with modified or corrupted data later on during restoration of the original picture.
The extracted bitstream is decoded and the actual stamp is placed on top of the decoded image producing the stamped image.

Using the encoding parameters of original picture PhotoStamper encodes the stamped image by JPEG encoder and embeds the new bitstream into the original one instead of the extracted sub-bitstream.

During the last step – gathering all together – along with the stamped JPEG image and the PhotoStamper’s marker all original extra data (Adobe marker, EXIF data, …) are copied into the file.

Note. PhotoStamper copies all JPEG markers to the output image file (including EXIF, IPTC and all application-specific markers)

 

2. Undo or Restoring original pictures

First of all PhotoStamper checks a presence of its own marker in the picture file. Then it validates the bitstream check sums to make sure the picture is not modified after last stamping. After that PhotoStamper just substitutes a sub-bitstream corresponding to the stamped area with original substream stored in the custom marker.
The program also removes its custom marker from the image.

 

3. Stamping already stamped pictures

The application restores an original image first (see [2] for more details).
It applies a new stamp to the restored original image (see [1] for more details).

4. Picture Date and Time

For stamping PhotoStamper tries to get date and time from the image’s EXIF data first.
If EXIF data are not available the picture file creation time is used instead.