Transferring large PSD files quickly using Diff-Patch

psd1Recently for a small design work a creation of a Photoshop PSD document was required. Being a high resolution image the file size went up to something around 85MB. Zipping the document brought down the size to a manageable 35MB (but still quite large for my net connection) . As all designers know, frequent modifications are a part of the process, and I surely needed to do one on the original PSD; which meant I had to send the whole modified PSD file again to the client, even though the actual modifications were quite minor. As I use a 384Kbps broadband line, it takes quite a while to upload the file. Make a couple of more revisions and you can see how much precious  time is wasted in transferring the document. As I’m not a designer by profession, I’m unaware of any tools that might ease this process. So I thought if using a binary diff and patch utility would help me make my job easier.

Diff and Patch
A binary diff program is a file comparison utility that outputs the differences between two binary files. The output is called a ‘patch’ which can then be applied to the original file to get the modified version of the file. Basically what I wanted to do was send only the difference (patch) between the original PSD and the modified PSD to the client, wherein the client would reconstruct the modified PSD from the original (which I had already sent him)  and the patch file.

Downloading the Diff utility
I downloaded the jojoDiff utility and tried to see if it might help me to get the difference of two PSD files.To my surprise it worked. The patch for the 85MB PSD came to only 2MB. After trying some combination’s on various PSD files to see the accuracy and speed of the diff utility, I decided to send the client the patch program (with a Windows batch file to automate the process) and the patch file itself, saving us both quite a huge amount of time.

How all this works
The jojoDiff package contains two programs jdiff-w32.exe and jpatch-w32.exe, the first one gets the difference of two binary files outputting a patch file, and the second combines the patch file with the original to give us the second file. My original PSD and the revision were named work_0.psd and work_1.psd respectively. The work_0.psd file size came to 85MB and the work_1.psd file size to 156MB. To get the difference between the two PSD’s you need to run jdiff-w32 from the command prompt as follows.

jdiff-w32  work_0.psd  work_1.psd  patch.p

This will output a patch.p file in the same directory, which in my case came to a size of 2MB. Now you only need to send the patch.p file (instead of the modified file) to the client.  To reconstruct the work_1.psd from the patch file and the original work_0.psd enter the following command.

jpatch-w32  work_0.psd  patch.p  work_1.psd

This will create the modified work_1.psd file.

The program may take anywhere from seconds to minutes depending on the complexity of the PSD design and file sizes.  You can send as many patch’s to the client as the number of revisions you make to the original PSD. The advantage besides the file size is that the client can construct any revised PSD from the original and the particular patch file sent.

Below is shown a flowchart of the whole process along with the file sizes I encountered in my work.

diffpatch

Conclusion
This process has worked wonderfully for me. I’ve tried this method on a dozen or more PSD’s to check the accuracy of the output to good results; although I’ve not used this on other image types. Many times when the PSD files sizes are small the patch file can get larger than the original, its really useful when the PSD’s are large. To ensure correctness it is also better to send to the client a low resolution GIF image of the modified PSD along with the patch file.

I request the readers who try this method to let me know the accuracy and speed of the process.

One thought on “Transferring large PSD files quickly using Diff-Patch

  1. This was a really great tip! I know inrcemental backups are the hot topics on all lips lately, which basically would be the same, however I never thought of doing this with clients aswell.

    I am sure there are more tools out there where you can merge the pather and the diff file into 1, making your client only need to click one scary exe file. However it is more easy to use original exe file since you may point your client to the sourceforge page for download, making it more secure. EXE files are not a popular flavour in emails theese days.

    Great site and great tip!

Comments are closed.