Large image to clipboard freezes computer

16

1

So I was messing around with some height map images and found this one:

http://upload.wikimedia.org/wikipedia/commons/1/15/Srtm_ramp2.world.21600x10800.jpg

This image is 21600x10800 when I right click "copy image" from my browser (I am using chrome) it slows down my computer until it freezes. After that I must restart. I am curious to why this happens I presume it is the size of the image, all though its only about 6mb when saved.

I am also using Windows 8.1

Joban Dhillon

Posted 2014-05-21T19:13:08.273

Reputation: 263

Answers

21

'Copy Image' is copying the raw image data, rather than the image file itself, to your clipboard.

The raw image data will be 21600 x 10800 x 3 (24 bit image) = 699,840,000 bytes of data. That's approximately 700MB of data your browser is trying to poke onto the clipboard.

JPEG compresses the raw data using a lossy algorithm and can get pretty good compression. Hence the compressed file is only 6MB.

The reason it makes your computer slow is that it is probably filling your memory up with at least the 700MB image data that your browser is using to show you the image, another 700MB (along with whatever overhead the clipboard incurs) to store it on the clipboard and a not insignificant amount of processing power to convert the image into a format that can be stored on the clipboard.

Chances are that if you have less than 4GB or less of physical RAM then those copies of the image data are forcing your computer to page memory out to the swap file in an attempt to fulfil both memory demands at the same time. This will cause programs and disk accesses to be sluggish as they use the disk and try to use the data that may have just been paged out.

In short: don't use the clipboard for huge images unless you have a lot of memory and a bit of time to spare.

Like pretty graphs? This is what happens when I load that image in Chrome and then copy it to the clipboard on my machine with 12GB of RAM:

enter image description here

It starts off at the lower point using 2.8GB of RAM, loading the image punches it up to 3.6GB (approximately maybe the 700MB), then copying it to the clipboard spikes way up there at 6.3 GB of RAM before settling back down at the 4.5-ish you'd expect to see for a program and two copies of a rather large image.

That's a whopping 3.7GB of image data being worked on at the peak, which is probably the initial image, a reserved quantity for the clipboard and a perhaps a couple of conversion buffers. That's enough to bring any machine with less than 8GB of RAM to its knees.

Strangely doing the same in Firefox just copies the image file rather than the image data without the scary memory surge.

Mokubai

Posted 2014-05-21T19:13:08.273

Reputation: 64 434

Mokubai has the right of it. This image would make most computer's clipboards freak out. If you need to get that image to a location, you should either save it, or right click and use the "Copy image location" command. – TorpedoBench – 2014-05-21T19:40:57.830

I had a buddy do it on Windows 7. He reported only a 1-3 second lag. I just gotta ask him what browser and how much RAM. – Joban Dhillon – 2014-05-21T22:00:29.097

Yeah. On my machine it was almost instant, but then I have a fairly large amount of RAM. If you have less than 8GB then I would not be surprised if your machine struggled. – Mokubai – 2014-05-21T22:05:31.217

@Mokubai: I'm not entirely convinced. Wouldn't it need to download a 700 MB file to get 700 MB to the clipboard? And, as I've tried out, that file is definitely smaller than 700MB. – shortstheory – 2014-05-30T11:05:13.497

1@shortstheory the file itself is only 7mb but it is highly compressed as it is a jpg image. The actual image data is approximately 700mb. What you see in the 7mb download is a compressed representation of the picture, for any program to actually view the image it must be uncompressed first and it is that data (not the file itself) that is being put on the clipboard. – Mokubai – 2014-05-30T11:54:42.987