Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Obfuscating images

Tags:

image

jpeg

delphi

I want to distribute a few images and not allow others to see them unless they are using my program. My intention will be to use JPG files in which I will alter the header so other image viewers cannot read them anymore. For example I can delete the bytes 7-10 which are the magic signature for JPG. Later, my program will reconstruct the header and show the JPG file.

Question: how do I do this on the fly, without reading the “broken” JPG file, restoring the header, saving the good file to disk and then re-loading it as a “good” JPG file?

like image 505
Server Overflow Avatar asked Apr 10 '09 19:04

Server Overflow


1 Answers

Load the "broken" file into a TMemoryStream, patch the bytes in-memory, and use TGraphic.LoadFromStream() to load the fixed JPG file.

like image 162
mghie Avatar answered Oct 05 '22 04:10

mghie