If what you mean is setting a password to prevent someone from copying a picture off the web, it can't be done. If it's viewable it can be copied. There are many techniques employed like disabling right click, but these can be easily defeated also.
Now compressing a picture --
Lossless formats are formats containing all the information from the original photo.
When you save photos in lossless compressed format files, different methods are applied in order to get a smaller file, but this file contains all the original information in a more compact form. Nothing is lost.
Apart from bmp -a compressed variant of bmp is called rle- the lossless format that most photo software is able to handle is png.
Another often used format, that can be uncompressed or compressed using various algorithms, is tiff.
Gif is a lossless format too, but being limited to 256 colors, it is seldom a good choice for photos.
The disadvantage of these formats is that after applying a compression algorithm you must take what you get, you can not make your file smaller to your liking.
The advantage is that these formats are perfect to keep unaltered originals of your photos.
If you plan to share your pictures in Microsoft Office documents, on Web sites, or in e-mail messages, you may want to reduce the size or dimension of your pictures to work more efficiently. For example, if you take pictures with a digital camera that creates large files, putting those files into a Microsoft Word document can make the Word document difficult to manage because of its increased file size. You may want to reduce the file size of your pictures so that they load faster on Web sites or reduce the dimensions of your pictures so that they fit better in a browser window.
You can change both file size and picture dimensions by compressing the files to a smaller JPG format. Microsoft Office Picture Manager automatically determines the amount of compression after you specify how you intend to use the pictures. The aspect ratio (aspect ratio: The ratio between picture width and picture height. This ratio can be maintained even when resizing a picture.) of your pictures will always be maintained. If your picture is already smaller than the compression option you have chosen, no resizing or compression will be performed.
Say you have four pics to send to another computer user, each taken at 2048 x 1536 pixels resolution. They might amount to something over 2MB of data; far too much for regular emailing. In fact I tried four picture files at random from a digicam and they totalled 2073K. Now, what are the options?
First, decide what loss of quality you, or rather the receiver of your pictures, can tolerate, for the JPEG compression you are going to use is a so-called lossy process, inducing compression artefacts into your pictures that will be visible if the images are magnified too much. For all practical purposes, however, a great deal of compression can be applied before the pictures are essentially destroyed if the receiver merely wants to view them on screen.
If you ask the reasonable question, ‘why can’t I just Zip the files (using Winzip or similar) and compress them that way’, the answer is that zipping JPG files achieves very little by way of compression. Take a look at the table of test results. The only advantage of zipping (which you might decide to apply to your already compressed files) would be that of sending a single file instead of several. But then your receiver would need to unzip the bundle, and you’d have to be sure he was equipped to do so.
Better define what you want to accomplish and we can give a more concise answer.