Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to create an image on a webpage that cannot be copied or saved by the end-user [closed]

On some web-pages, background images cannot be copied or saved. The browser I use does not recognize it as an image.

The question I have is: I want to know how it is possible to create an image on a webpage that cannot be copied by the user.

For example: On this github help page, the background image on which the title is written cannot be copied and saved in the browser I currrently use.

Could it be that the image is a graphic created by javascript code or some other language?

like image 377
GradDev Avatar asked Jan 03 '17 08:01

GradDev


People also ask

Is it possible to save a copy of an image from the Internet?

Click on the image that you want to save. Right-click and select “Open link in new tab.” Once the image opens on a new tab, right-click and select “Save image as…” Hit Save.

How do I stop HTML from saving images?

on("contextmenu", "img", function(e) { return false; });


1 Answers

The header image in the link is generated from a BASE64 Encoded image string in its CSS. Any modern browser can understand this type of image and parse it. In this case the image is an encoded SVG (Scalable Vector Graphics) image, but it could also be a JPEG, PNG, GIF or BMP image.

In the source you will see a div with a background image that looks like a very long garbled string:

<div style="background-image: url(data:image/svg+xml;base64, BASE64-ENCODED-IMAGE-STRING">

(replace BASE64-ENCODED-IMAGE-STRING with the original one from the page source)

On this website for example, you can generate a BASE64 encoded image string.

However, this does NOT mean that the image cannot be saved or copied by a user!

Using this website, for example, you can decode the image in a form that an end user can save/copy: http://freeonlinetools24.com/base64-image.

as @aavrug pointed out below, this can also be done using the developer's tools in any browser.

as other users pointed out, some browser do give the option to save the background image when using right mouse click

As @Viktor Mellgren points out: Also, there is always screenshot

Conclusion

Once an image is in the browser, it can be saved by an end user. To better protect your images, look at Watermarking them using specialized tools or scripts:

  • Photoshop example
  • PHP example script to add watermarks
like image 150
Cagy79 Avatar answered Nov 16 '22 00:11

Cagy79