17

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?

Cagy79
  • 1,610
  • 1
  • 19
  • 25
GradDev
  • 391
  • 3
  • 15
  • 1
    You can convert your image to `base64Encode` online https://www.base64-image.de/ – Super User Jan 03 '17 at 08:54
  • use the css property 'background-image' : http://www.w3schools.com/cssref/pr_background-image.asp – Developer Jan 03 '17 at 08:54
  • 4
    remember, you can copy the base 64 code and paste in url bar of web browser and then right click on image to save the image. – Atul Sharma Jan 03 '17 at 09:01
  • This migh help too if your are looking for ways to complicate image download by end users: [protect image download](http://stackoverflow.com/questions/21110130/protect-image-download) – web-tiki Jan 03 '17 at 09:56
  • 9
    In Firefox (v50.1) I can select “*View Background Image*” in the context menu of the header section with the tartan pattern background and FF does indeed display it as a stand-alone image that I can save to a file like any other image. – David Foerster Jan 03 '17 at 09:57
  • 17
    Also, there is always screenshot – Viktor Mellgren Jan 03 '17 at 10:18
  • 2
    -1: You describe a behaviour without specifying for which software stack the description is even valid. As a lot of answers show, it does not hold in many environments. The question does not try to solve a specific problem but asks for an explanation for the flawed premise that an image could be "unsavable". – I'm with Monica Jan 03 '17 at 14:13
  • 16
    Basically, you can't. – aslum Jan 03 '17 at 15:49
  • 1
    @ViktorMellgren And even if you are only displaying the image on a machine that you own/control, you can still take a photo of the screen with a camera... – Bakuriu Jan 03 '17 at 16:03
  • 1
    In Chrome you can look at the network tab in the console and double click and image to display it. It's basically impossible. If you are sending an image to the browser, then you have to send the image to the browser, and it can be copied or saved by the end user. – Matt Burland Jan 03 '17 at 18:45
  • @MattBurland Such is the contradiction of DRM. – JAB Jan 03 '17 at 21:13
  • What are you talking about? I right-clicked on the image and selected "View Background Image", then I pressed Ctrl-S, and it saved the image. – user253751 Jan 03 '17 at 23:54

8 Answers8

55

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:

jpmc26
  • 28,463
  • 14
  • 94
  • 146
Cagy79
  • 1,610
  • 1
  • 19
  • 25
22

All images can be saved:

enter image description here

You can convert image to base64 string as another answers says, but is still can be saved and copied.

And how?

Just copy image string here http://codebeautify.org/base64-to-image-converter and you will get downloadable image.

Dave
  • 2,764
  • 2
  • 15
  • 27
  • 1
    No need to do that much of effort just see in the style pannel and from there you can access the encoded link. So, you can also save it from there. – aavrug Jan 03 '17 at 09:03
  • @aavrug thats true – Dave Jan 03 '17 at 09:04
  • Yup. This is one of those things where the legitimate user and the attacker can't be distinguished; allowing the user to have a copy of the image is exactly what you have to do to get it to show up on their screen. – jpmc26 Jan 04 '17 at 00:29
10

Knowledge is power:

  1. Open Chrome and go to https://guides.github.com/activities/hello-world/
  2. Right-click on the desired "image"
  3. Click "Inspect"
  4. Look in the Styles tab
  5. Right-click on element.style -> background-image -> url -> blue hyperlink containing data:image
  6. Click "Open link in new tab"
  7. Ctrl+s

Basically, if your web browser renders something then it is save-able/download-able, period.

MonkeyZeus
  • 20,375
  • 4
  • 36
  • 77
7

Since everyone explained how to grab the base64 code of the image and paste it into a converter, there is another option. Even simpler: Open the page in question with Firefox. Select 'View Page Info' from the context menu. Select the 'Media' tab. Select the image from the list.

No need to convert the base64 code. Firefox already provides you with the image and a 'Save As...' button.

sbecker
  • 553
  • 4
  • 12
6

Every image send to the browser, can be copied, one way or the other. You can make it harder for non-tech-savy people by disabling right-click oncontextmenu and mouse drag ondrag. This will prevent the user on right-clicking the image and saving it, and dragging it to the desktop.

But, as I said, and many others are saying too, is that it will always be possible to download the info that is send to the browser - one way or the other.

curly_brackets
  • 5,491
  • 15
  • 58
  • 102
  • 5
    To expand on this: An image that is displayed to the user has *got* to be copyable. The image starts out on the webserver, and ends up displayed on the screen - for that to happen it has to be copied from the webserver to the memory of the browser. Once that has happened, it is always going to be possible to copy it from the memory of the browser to the hard disk of the client. (You can make it more or less difficult, but not impossible.) – Martin Bonner supports Monica Jan 03 '17 at 10:14
  • @MartinBonner: If one uses Javascript that generates on demand only those portions of the image that aren't obscured by other material, one could prevent anyone from saving the background except by combining screen shots that expose different parts of it. Doing so would likely require that one also use Javascript to generate whatever material would be obscuring the parts of the image that shouldn't be displayed. If it's possible for someone to see all the parts of a background image (e.g. by changing screen dimensions so different parts get obscured) it will be possible for someone to... – supercat Jan 03 '17 at 15:54
  • ...combine screen shots, but one could discourage even those efforts by slowly changing the brightness, contrast, white balance, etc. so different screen shots wouldn't quite match. – supercat Jan 03 '17 at 15:55
  • @supercat: So just run the javascript to generate all portions of the image. – Martin Bonner supports Monica Jan 03 '17 at 16:01
  • @MartinBonner: Trying to emulate control behavior with Javascript is often a nuisance for programmers and users alike. If scrolling text should appear in a translucent window, it's easier to render the translucent "background" of the window on the Javascript canvas and draw the text in a transparent window, than to try to draw everything on the same canvas. If one draws the window background by painting at 50% opacity a watermark pattern that varies between e.g. 45% and 55% gray, any attempt to amplify the contrast to match the rest of the image would also amplify the watermark. – supercat Jan 03 '17 at 16:10
  • @supercat I'm curious how you would accomplish this. Css background positions, manipulating size? The full image is still exposed in the browser's memory unless you break the images into pieces on the server side. That'd be tedious for developers, and ultimately, as you pointed out, fairly trivial to overcome. – SethWhite Jan 03 '17 at 21:46
2

Well, that's base64 encoded image string: try it here at: b64.io When I dropped the image in question to this site, I got this:

/* file size: 3.2ko | already optimized | base64 size: 4.2ko */
.index {
    background-image: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSI0NDAiIGhlaWdodD0iNDQwIj48cmVjdCB4PSIwIiB5PSIwIiB3aWR0aD0iMTAwJSIgaGVpZ2h0PSIxMDAlIiBmaWxsPSJyZ2IoMTI3LCA1NCwgNjApIi8+PHJlY3QgeD0iMCIgeT0iNSIgd2lkdGg9IjEwMCUiIGhlaWdodD0iMTUiIG9wYWNpdHk9IjAuMTA2NjY2NjY2NjY2NjY2NjciIGZpbGw9IiNkZGQiLz48cmVjdCB4PSIwIiB5PSIyOSIgd2lkdGg9IjEwMCUiIGhlaWdodD0iMTgiIG9wYWNpdHk9IjAuMTMyNjY2NjY2NjY2NjY2NjUiIGZpbGw9IiMyMjIiLz48cmVjdCB4PSIwIiB5PSI1NyIgd2lkdGg9IjEwMCUiIGhlaWdodD0iMTAiIG9wYWNpdHk9IjAuMDYzMzMzMzMzMzMzMzMzMzQiIGZpbGw9IiMyMjIiLz48cmVjdCB4PSIwIiB5PSI4MiIgd2lkdGg9IjEwMCUiIGhlaWdodD0iMTMiIG9wYWNpdHk9IjAuMDg5MzMzMzMzMzMzMzMzMzMiIGZpbGw9IiNkZGQiLz48cmVjdCB4PSIwIiB5PSIxMTMiIHdpZHRoPSIxMDAlIiBoZWlnaHQ9IjEyIiBvcGFjaXR5PSIwLjA4MDY2NjY2NjY2NjY2NjY2IiBmaWxsPSIjMjIyIi8+PHJlY3QgeD0iMCIgeT0iMTM3IiB3aWR0aD0iMTAwJSIgaGVpZ2h0PSIxMyIgb3BhY2l0eT0iMC4wODkzMzMzMzMzMzMzMzMzMyIgZmlsbD0iI2RkZCIvPjxyZWN0IHg9IjAiIHk9IjE2OSIgd2lkdGg9IjEwMC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N0IHg9IjM5OCIgeT0iMCIgd2lkdGg9IjE2IiBoZWlnaHQ9IjEwMCUiIG9wYWNpdHk9IjAuMTE1MzMzMzMzMzMzMzMzMzQiIGZpbGw9IiMyMjIiLz48cmVjdCB4PSI0MzEiIHk9IjAiIHdpZHRoPSI5IiBoZWlnaHQ9IjEwMCUiIG9wYWNpdHk9IjAuMDU0NjY2NjY2NjY2NjY2NjciIGZpbGw9IiNkZGQiLz48L3N2Zz4=);
}

Well, I am able to view the image and save it to disk as well, without any issue (from the github link that you mentioned). I am not sure if it is working for me due to some Firefox plugin, or it simply works with Firefox.

When I right click on background image, I see option "View Background Image and when I view the image I see this:

data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSI0NDAiIGhlaWdodD0iNDQwIj48cmVjdCB4PSIwIiB5PSIwIiB3aWR0aD0iMTAwJSIgaGVpZ2h0PSIxMDAlIiBmaWxsPSJyZ2IoMTI3LCA1NCwgNjApIiAgLz48cmVjdCB4PSIwIiB5PSI1IiB3aWR0aD0iMTAwJSIgaGVpZ2h0PSIxNSIgb3BhY2l0eT0iMC4xMDY2NjY2NjY2NjY2NjY2NyIgZmlsbD0iI2RkZCIgIC8+PHJlY3QgeD0iMCIgeT0iMjkiIHdpZHRoPSIxMDAlIiBoZWlnaHQ9IjE4IiBvcGFjaXR5PSIwLjEzMjY2NjY2NjY2NjY2NjY1IiBmaWxsPSIjMjIyIiAgLz48cmVjdCB4PSIwIiB5PSI1NyIgd2lkdGg9IjEwMCUiIGhlaWdodD0iMTAiIG9wYWNpdHk9IjAuMDYzMzMzMzMzMzMzMzMzMzQiIGZpbGw9IiMyMjIiICAvPjxyZWN0IHg9IjAiIHk9IjgyIiB3aWR0aD0iMTAwJSIgaGVpZ2h0PSIxMyIgb3BhY2l0eT0iMC4wODkzMzMzMzMzMzMzMzMzMyIgZmlsbD0iI2RkZCIgIC8+PHJlY3QgeD0iMCIgeT0iMTE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wIiB3aWR0aD0iMTAiIGhlaWdodD0iMTAwJSIgb3BhY2l0eT0iMC4wNjMzMzMzMzMzMzMzMzMzNCIgZmlsbD0iIzIyMiIgIC8+PHJlY3QgeD0iMzU1IiB5PSIwIiB3aWR0aD0iMTMiIGhlaWdodD0iMTAwJSIgb3BhY2l0eT0iMC4wODkzMzMzMzMzMzMzMzMzMyIgZmlsbD0iI2RkZCIgIC8+PHJlY3QgeD0iMzc3IiB5PSIwIiB3aWR0aD0iNSIgaGVpZ2h0PSIxMDAlIiBvcGFjaXR5PSIwLjAyIiBmaWxsPSIjZGRkIiAgLz48cmVjdCB4PSIzOTgiIHk9IjAiIHdpZHRoPSIxNiIgaGVpZ2h0PSIxMDAlIiBvcGFjaXR5PSIwLjExNTMzMzMzMzMzMzMzMzM0IiBmaWxsPSIjMjIyIiAgLz48cmVjdCB4PSI0MzEiIHk9IjAiIHdpZHRoPSI5IiBoZWlnaHQ9IjEwMCUiIG9wYWNpdHk9IjAuMDU0NjY2NjY2NjY2NjY2NjciIGZpbGw9IiNkZGQiICAvPjwvc3ZnPg==

As others have said, you can use base64 encoded image string as image and modern browsers understand it. If you decode this, it's like: data:<Type>, <Encoding>, <Encoded data string>

So the image in question is a SVG image, when you open this in browser and try to save it using: Command+S/Ctrl+S, it will correctly identify image type to be svg.

Ravish
  • 2,383
  • 4
  • 37
  • 55
2

Most importantly: don't put anything in the Internet you absolutely don't want people to download. Downloading images that you're not supposed to be able to download was one of the first tricks I learned in the early Netscape era and I'm not alone in this.

If you want to sell image content, publish only a partial sample in low quality or add watermarks. Add some copyright notes stating that images are your property and it's not allowed to publish them anywhere else without your consent (or compensation) so that the buyer doesn't distribute them at will.

Using base 64 encoding or such has its benefits. First of all the user cannot accidentally misclick the image as desktop background. And secondly one has to do some work to get the image so they're probably aware that they're not supposed to do it and probably consider whether it's worth the trouble. Also if it hampers image search engines then it seriously limits "unauthorized" copying.

I have no statistics to back my words but in my experience UI design guys (and such) take a lot of content from image search results. And from UI sketches these images accidentally get into production or marketing etc. So basically if your image ends up in image search engines, the Internet owns it.

2

Also, is it possible that it's not an image but a graphic created by some code in javascript or some other language?

Option 1

Use svg tags in html. This still is not at all copy proof, but reduces options for copying to:

  • Looking at the source html and copying it
  • Screenshots

Most graphic tools, photoshop, etc, have a vector or svg mode that can export the images you created in that mode as html tags that look like:

<svg width="100" height="100">
  <circle cx="50" cy="50" r="40" stroke="green" stroke-width="4" fill="yellow"></circle>
</svg>

The user will not be able to right-click and save this image, but they will be able to inspect and steal the code itself.

Option 2

Use Javascript and HTML canvas to draw the image programmatically.

Ways the user can copy:

  • Steal the JS code from the browser (super easy, but only useful if they're planning on displaying the image on some platform that supports canvas)
  • Screenshot

.

var canvas = document.getElementById('myCanvas');
var context = canvas.getContext('2d');
var centerX = canvas.width / 2;
var centerY = canvas.height / 2;
var radius = 70;
context.beginPath();
context.arc(centerX, centerY, radius, 0, 2 * Math.PI, false);
context.fillStyle = 'green';
context.fill();
context.lineWidth = 5;
context.strokeStyle = '#003300';
context.stroke();

My two cents, either use watermarks or low res versions of the images you're worried about. Anything you put on a website is trivial for anyone who knows what they're doing to copy. The above options are fun and interesting to think about, but ultimately are a lot of work for devs and defeated by a single key stroke.

Last thought

One last idea that might mitigate the ability of the average joe to copy, would be to require ten different keys to be held in order to see the image in particular. Like the other options, this is circumventable by anyone who knows what they're doing, but a normal user would have trouble hitting PrtScn while his other fingers are occupied. Not the best UX... but hey :)

Community
  • 1
  • 1
SethWhite
  • 1,891
  • 18
  • 24