The exact file size. How is information measured and how to determine the size of a file or folder? Bit and byte - the minimum units of information

On Windows 7, 8, XP, and 10 systems, there is a system, hidden pagefile.sys file called the page file. It is used as virtual RAM ( RAM) supplementing the physical when it is not enough. Users are wondering how to set it correctly and what is its optimal size? This will be discussed in this article.

It also stores unused data of programs and applications ( for example, when they are folded and unused). Since the file is located on the hard disk, all accesses to it are directly related to the disk, which is much slower than RAM. Therefore, the system uses it only in extreme cases ( that is, when there is not enough physical RAM).

There is no universal instruction for correctly setting the size of this file, since everyone's computer resources are spent differently, and PC characteristics are also different. Therefore, you need to focus on your needs.

If you disable the paging file, then if there is not enough RAM, a corresponding error will appear and the applications used will unexpectedly terminate their work. To avoid this, you need to set the optimal size of the paging file. I will show you how to do this using Windows 7 as an example. These instructions will be relevant for other versions and bit depths ( x32 and x64).

Criteria for optimal paging file size

By default, Windows automatically determines its size using its own formula. This is not always effective. In some cases, changing the swap file can greatly improve performance.

You need to determine how much RAM you consume when working on a PC. Then you need to compare this data with the physical amount of RAM and, if it is lacking, supplement it with the size of the swap file. I will show you with an example how this can be done.

Launch all possible programs, applications, games and everything that theoretically you would use at the same time. Then start the task manager ( ctrl+alt+delete), and see the amount of memory used. This is the amount of RAM that needs to be given to the computer.

Based on these data, you can set the optimal size. In the image above, the memory consumption is 1.60 gigabytes. At a maximum of 2. This means that the paging file is not used in this case and can be disabled. But this is just an example!

Disabling the paging file is generally not recommended, but you should only do this if you are absolutely sure that you will not be able to use more memory than the amount of physical memory and if memory dumps are unnecessary. It should also be borne in mind that some applications require the mandatory presence of this file and will not work without it.

If the value were greater than the maximum ( i.e. more than 2), then it would be necessary to set the size equal to the amount of consumed memory + headroom ( 50% ). Approximately such numbers will be safe. In most cases, it is not possible to know exactly this maximum, and therefore approximate rules are used that insure against RAM shortage errors.

The less physical, RAM, the more virtual. Below is a table that shows the values ​​​​if the computer did not use more than 4 gigabytes of RAM.

It all depends on the needs of the user. For someone, 16 gigabytes may not be enough, but for someone, even 1 gigabyte will be enough and no errors will occur.

Note that the maximum and minimum sizes are set to the same. This is done in order to get rid of fragmentation. Only relevant if you have an HDD.

You can also conduct an experiment "at random". Reduce the size of the paging file until an out-of-memory error occurs and stops at the size when it was not there.

After reading various forums, I came to the conclusion that with 8 gigabytes of RAM, most users never had problems with the swap file, and if they did, they simply turned it on at the minimum size. In other cases ( when there is less memory) were common errors. Draw your own conclusions.

Increasing and disabling the paging file Windows 7

For novice users, I will show you how to change it. You must restart your computer for the changes to take effect.

Go to Start Menu >> Control Panel ( large icons) >> Counters and performance tools.

Go to visual effects settings.

In the "Advanced" tab, you can go to the paging file settings window. This indicates its size or complete shutdown.

Ready to answer questions in the comments.

How did you decide to use the swap file?

I propose to consider what kind of animals these are - JPG and RAW photo formats, what they affect and when you should pay attention to them. What is the photo size and file weight, how they are measured and what they depend on.

Almost all photo cameras can save photos in JPG format (even phone and tablet cameras). In all SLR and non-SLR cameras, as well as in advanced compacts, in addition to JPG, there is at least RAW and RAW +, and sometimes TIFF.

To deal with the formats, first you need to agree on what is meant by the concepts of "size" of a photo and "weight" of a file (photo). I propose to consider these concepts on more tangible objects ... for example, on goodies.

1 | What is a pixel:


The size of objects is measured in meters, the size of a photo is measured in pixels (px).

If you measure the size of this vase with berries, then it will be about 10 centimeters high and 13 centimeters wide ... approximately. That is, we are accustomed to measuring objects in centimeters (meters, kilometers, and so on). If we talk about the photo of the same vase, then the original size of the photo is 7360 pixels (px) wide by 4912 pixels (px) high. This is the maximum photo size my Nikon camera is capable of. To place this photo on the site, the size of the photo is reduced to 1200px by 798px (why, I'll tell you a little later).

What is a pixel? Photographs taken with digital cameras or digitized on a scanner are a combination of tiny colored squares - pixels. If you zoom in on any photo, you will see these pixels. The more such pixels in the photo, the more detailed the picture.


A fragment of the photo magnified a thousand times - squares of pixels are visible.

2 | Is it possible to convert pixels to centimeters:

This is exactly what happens when you need to print photos on paper. One more indicator is needed here - the pixel density (resolution) that the printer (or other photo printing machine) can print. The printing standard for photographs is 300 dpi (dpi is the number of dots per inch). For example, for printing in beautiful glossy magazines, photos with a resolution of 300 dpi are used.

So that you do not puzzle over dividing the photo size by resolution and do not convert inches to centimeters, any photo viewing and editing program (for example, Photoshop) has a function to view the size of the photo image in centimeters. You will need it to understand what is the maximum size of a photo in good quality (with a resolution of 300 dpi) that you can print on paper or other material.

For example, this photo of Frangipani tropical flowers can be printed in the size of 61 cm by 32 cm.


Photo size in pixels and centimeters in Photoshop

To find out the size of a photo in pixels and centimeters in Photoshop, you need to press the key combination Alt + Ctrl + I or go to the menu Image (Image) Image size (Image size).

Let's get back to the reality of digital photos - to pixels and photo sizes in pixels. What happens if you reduce the number of pixels in a photo? The answer is that the quality of the photo will deteriorate. For example, I took the photo of the same bowl of berries at the beginning of the article and reduced the size of the photo to 150 pixels wide. With such a decrease, the program destroys some of the pixels. The photo has become miniature:

Now let's try to "stretch" the photo to the entire page:


Stretched picture looks blurry and fuzzy

As you can see, the detail is not the same, since some of the pixels (and details along with them) are missing.

Of course, if you use this thumbnail as a small icon or a small image in a Power Point presentation, it will look quite normal, but for printing in a half-page magazine it is clearly not suitable.

3 | What photo size (how many pixels) is optimal:

If you plan to someday print a photo, then save photos in the highest possible resolution, which only your camera will allow (carefully study the instructions for your camera to correctly adjust the photo size).

In some cases, you need to reduce the size of photos. As I wrote above, for the site, I reduce the photo size to 1200 pixels on the long side. If you upload a photo in full size, the pages of the site will take a very long time to load, and many visitors may not like this (not to mention Google and Yandex search engines).

The size of photos is measured in pixels (px). The size of the photo on the monitor screens depends on the number of pixels, and what size the photo can be printed.

4 | File size or "photo weight":

Now let's deal with the "weight of the photo". It so happened historically that there is a lot of confusion in this matter and the file size is quite often called the "photo weight", which is more convenient than correct. File sizes are measured in megabytes (MB) or kilobytes (KB). And here it is worth remembering that, unlike kilograms, where 1 kg = 1000g, 1 megabyte = 1024 kilobytes.

How it looks in practice: imagine the situation that your camera has a memory card that says 64GB (gigabyte). If you look at how many exactly these bytes are there (right-click "properties" on the computer), it turns out that there are 63567953920 bytes on this memory card and this is equal to 59.2 GB. How big your camera creates files will determine how many photos will fit on that memory card. For example, I have 830 files with photos in RAW format (read about formats below).

What determines the file size:

  • Firstly, on the size of the photo (what is measured in pixels): the file with the first photo of the berries (photo size 7360x4912 px) is 5.2 MB, and it, reduced to 150 px, will "weigh" 75.7 KB (in 69 times less).
  • Secondly, from the format (JPG, TIFF, RAW), which you can read about below.
  • Thirdly, the file size (or "photo weight") depends on the number of details: the more details, the "heavier" the photo (which is most relevant for the JPG format).

Lots of details - more photo weight

For example, in this photo with monkeys from Sri Lanka, there are many small clear (in the language of photographers, "sharp") details and the file size with this photo is 19.7MB, which is significantly larger than berries in a vase on a white background (5.2MB).

If you ask what size photo I can print from a 2MB photo. No one can answer you until they know the number of pixels. And it’s better, of course, to also look at the photo, since some craftsmen like to get a photo from the depths of the Internet, increase the number of pixels programmatically, and then want to print it on the cover of a magazine. It turns out as in the example above with a stretched photo of a vase 150 px wide.

File size (often referred to as "photo weight") is measured in megabytes (MB) or kilobytes (KB) and depends on the format, pixel size, and detail of the photo.

5 | Photo formats:

And, finally, we come to the issue of image formats and the type of file compression, which also determine the size of the photo file.

Almost all photo cameras can save photos in JPG format(even the cameras of phones and tablets). This is the most common image format and is "understood" by all computers and image viewers. In JPG format, photos can be uploaded to social networks, posted on a blog, added to Word, Power Point files, and so on. JPG can be processed in Photoshop, Lightroom and other image editing programs.

From my practice: if I want to take a photo for a social network and quickly upload it, then I either take a picture on my phone or put the jpg file format in my camera.

The thing to remember about jpg format is that it is a compressed format and it has compression levels. The higher the compression ratio, the smaller the file size by reducing the detail and quality of the photo. Therefore, multiple editing and re-saving (re-compression) of the same photo in jpg format is not recommended.


When saving a file in jpg format, the compression level is selected (example from Photoshop).

In all SLR and non-SLR cameras, as well as in advanced compacts, in addition to JPG, there is at least RAW, and often also TIFF.

A little theory:

  • TIFF(Eng. Tagged Image File Format) - a format for storing raster graphic images (including photographs). TIFF has become a popular format for storing high-color images. It is used in printing, widely supported by graphic applications.
  • RAW(English raw - raw, raw) - a digital photograph format containing raw data received from a photomatrix (the thing that replaced film in digital cameras).

Personally, I never photograph in TIFF format. I can’t even think of why I need this if there is RAW. I can use uncompressed TIFF to save photos that I still plan to finalize in Photoshop.

6 | Advantages and disadvantages of the RAW format:

I almost always have a RAW format in my camera, since I'm going to process (edit) photos in Lightroom or Photoshop. RAW has a number of significant disadvantages:

  • There is no way to view files without prior conversion. That is, to view photos in RAW format, you need a special program that supports this image format.
  • Larger file size than when saving in JPEG (from my Nikon D800 camera, the file size with a photo in RAW format is 74-77 MB). This means fewer photos will fit on the flash drive.
  • RAW cannot be uploaded to social networks, a blog, and sometimes even sent by mail. First, RAW needs to be converted with a RAW converter (eg Adobe Camera Raw) that supports the file type of your camera model.

Why do professional photographers often prefer RAW over JPG? Because RAW:

Save this article on Pinterest
  • gives more options for image correction: white balance, contrast, saturation, brightness and noise level,
  • allow you to more accurately correct images without the appearance of defects,
  • allows fine correction of lens imperfections (vignetting, chromatic aberration).

So, if you plan to carefully process pictures in Photoshop or Lightroom, subtly feeling "artifacts" and halftones, "overexposure" and "dips" in the shadows, then shoot in RAW. Just remember that in order to get a good result, you will need to understand the settings and operation of RAW converters. Think about whether you need this headache? Maybe you should shoot in JPG and devote more time to rest, and not to the computer?

To measure length, there are such units as millimeter, centimeter, meter, kilometer. It is known that mass is measured in grams, kilograms, centners and tons. Time running is expressed in seconds, minutes, hours, days, months, years, centuries. The computer works with information and there are also appropriate units of measurement for measuring its volume.

Bit and byte - the minimum units of information

We already know that a computer perceives all information.

Bit- this is the minimum unit of measurement of information, corresponding to one binary digit ("0" or "1").

A bit is only 0 ("zero") or only 1 ("one"). With one bit, two states can be written: 0 (zero) or 1 (one). A bit is the smallest unit of memory, nothing less. This cell can store either a zero or a one.

Byte consists of eight bits. Using one byte, you can encode one character out of 256 possible (256 = 2 8). Thus, one byte is equal to one character, that is, 8 bits:

1 character = 8 bits = 1 byte.

Letter, number, punctuation mark are symbols. One letter, one symbol. One number is also one character. One punctuation mark (either a period, or a comma, or a question mark, etc.) is again one character. One space is also one character.

In addition to the bit and byte, of course, there are other, larger units of information.

Byte table:

1 byte = 8 bits

1 Kb (1 Kilobyte) = 2 10 bytes = 2*2*2*2*2*2*2*2*2*2 bytes =
= 1024 bytes (approximately 1 thousand bytes - 10 3 bytes)

1 MB (1 Megabyte) = 2 20 bytes = 1024 kilobytes (approximately 1 million bytes - 10 6 bytes)

1 GB (1 gigabyte) = 2 30 bytes = 1024 megabytes (approximately 1 billion bytes - 10 9 bytes)

1 TB (1 Terabyte) = 240 bytes = 1024 gigabytes (approximately 1012 bytes). Terabyte is sometimes called ton.

1 Pb (1 Petabyte) = 2 50 bytes = 1024 terabytes (approximately 10 15 bytes).

1 exabyte= 260 bytes = 1024 petabytes (approximately 1018 bytes).

1 Zettabyte= 270 bytes = 1024 exabytes (approximately 1021 bytes).

1 Yottabyte= 2 80 bytes = 1024 zettabytes (approximately 10 24 bytes).

In the table above, the powers of two (2 10 , 2 20 , 2 30 , etc.) are the exact values ​​of kilobytes, megabytes, gigabytes. But the powers of the number 10 (more precisely, 10 3 , 10 6 , 10 9 , etc.) will already be approximate values, rounded down. Thus, 2 10 = 1024 bytes represents the exact value of a kilobyte, and 10 3 = 1000 bytes is the approximate value of a kilobyte.

Such an approximation (or rounding) is quite acceptable and generally accepted.

The following is a byte table with English abbreviations (in the left column):

1 Kb ~ 10 3 b = 10*10*10 b= 1000 b – kilobyte

1 Mb ~ 10 6 b = 10*10*10*10*10*10 b = 1 000 000 b - megabyte

1 Gb ~ 10 9 b - gigabyte

1 Tb ~ 10 12 b - terabyte

1 Pb ~ 10 15 b - petabyte

1 Eb ~ 10 18 b - exabyte

1 Zb ~ 10 21 b - zettabyte

1 Yb ~ 10 24 b - yottabyte

Above in the right column are the so-called "decimal prefixes", which are used not only with bytes, but also in other areas of human activity. For example, the prefix "kilo" in the word "kilobyte" means a thousand bytes. In the case of a kilometer, it corresponds to a thousand meters, and in the example of a kilogram, it is equal to a thousand grams.

To be continued…

The question arises: does the byte table have a continuation? In mathematics, there is the concept of infinity, which is denoted as an inverted eight: ∞.

It is clear that in the byte table you can continue to add zeros, or rather, powers to the number 10 in this way: 10 27 , 10 30 , 10 33 and so on ad infinitum. But why is this necessary? In principle, while terabytes and petabytes are enough. In the future, perhaps even a yottabyte will not be enough.


Finally, a couple of examples on devices that can store terabytes and gigabytes of information.

There is a convenient "terabyte" - an external hard drive that connects via USB to a computer. It can store a terabyte of information. It is especially convenient for laptops (where changing the hard drive can be problematic) and for backing up information. It is better to make backup copies of information in advance, and not after everything is gone.

Flash drives come in 1 GB, 2 GB, 4 GB, 8 GB, 16 GB, 32 GB, 64 GB and even 1 terabyte.



Probably, you often see on sites a signature indicating the file size. This indicator is not signed by anyone. This issue is solved by writing a function in php. As a result, it will output a line like:

File size: 2.3 MB
It is very convenient in case of downloading any materials from the site. So let's get started.

Create a PHP function that determines the file size

The function will be quite simple and clear. It uses three built-in functions:

file_exists- check for the presence of the specified file or directory.

filesize- determine the file size. Returns the result in bytes. If the file is larger than 2 GB, then, depending on the server, it may display incorrect results.

round is a built-in function that shortens the displayed value to an integer and one tenth after the delimiter point.
The function checks for the presence of the file itself, then sequentially tries to determine how large the file size is - if more than 1024 bytes, then the result should be displayed in MB, if more than 1024 MB, then it should be output in GB. And at the end of each step, the built-in round function rounds the result from many digits to an integer value and one tenth with a delimiter.

Now let's create a function file. Such files are usually kept in a separate folder. For example function.

PHP code(file functions.php)

// function arguments will be the path to the file
function get_filesize($file)
{
// go file
if(!file_exists($file)) return "File not found";
// now determine the file size in several steps
$filesize = filesize($file);
// If the size is greater than 1 KB
if($filesize > 1024)
{

// If the file size is more than Kilobyte
// it's better to display it in Megabytes. Converting to MB
if($filesize > 1024)
{
$filesize = ($filesize/1024);
// And if the file is larger than 1 megabyte, then check
// Isn't it larger than 1 gigabyte
if($filesize > 1024)
{
$filesize = ($filesize/1024);

return $filesize." GB";
}
else
{
$filesize = round($filesize, 1);
return $filesize." MB";
}
}
else
{
$filesize = round($filesize, 1);
return $filesize." KB";
}
}
else
{
$filesize = round($filesize, 1);
return $filesize." bytes";
}
}
?>
We have created a function. The next step is to apply it.

PHP code

include_once "function/function.php"; // include file with function

// insert a path or a variable with a path to process it with a function
$size = get_filesize("images/photo.jpg");
echo "File size: ".$size.""; // display the result with the size
?>
Everything is ready! Use on health!
Thanks for attention! And good luck with your work!

Each file and each folder with files occupies a certain place on the computer. That is, all files and folders have a volume, in other words, weight or size.

We are used to such concepts as grams and kilograms, meters and kilometers. The computer also has its own units of measurement. In them we will measure files and folders. In other words, we will determine how much this or that file or folder "weighs". This "weight" is calculated in bytes, kilobytes, megabytes and gigabytes.

Now let's get down to practice. Look at this size chart:

This is a very simple circuit. It is decoded like this:

1 KB = 1024 bytes; 1 Mb = 1024 Kb; 1 GB = 1024 MB

And now in more detail:

  • One KB (kilobyte) contains 1024 bytes
  • One MB (megabyte) contains 1024 KB (kilobytes)
  • One GB (gigabyte) contains 1024 MB (megabytes)

Why do we need dimensions? For example, in order to determine whether we can write a file / folder to a disk or flash drive.

In order for us to be able to determine this, we need to know how much information fits on a disk or flash drive. Let's use the scheme:

Flash drive - from 1 GB

CD disk - 700 MB

DVD disc - from 4 GB

The standard size of a DVD disc is 4.7 GB. There are also double sided DVDs. This means that the record can be on two sides - both on one and on the second. These drives have a capacity of 9.4 GB. Dual-layer discs also exist, but are less common. Such disks have the following volumes: 1-sided 2-layer - 8.5 GB; 2-sided 2-ply - 17.1 GB.

How to find out the size of a file or folder

To find out the size of a file or folder with files, move the cursor (arrow) over it and hold for a few seconds. A small window will appear with the characteristics of the file or folder. As you can see in the picture, this characteristic indicates the size:

If nothing appears when hovering over a file or folder, then right-click on that file or folder. From the list that opens, select "Properties". A window will open showing the size of this file or folder.

Now let's practice determining the size:

Task:

We have a 30 MB file. Can we burn it to disk? 1 GB flash drive?

Solution:

A CD can fit 700 MB. Our file is 30 MB in size. 700 MB is more than 30 MB. Conclusion: the file will fit on a CD.

A DVD disc holds 4.7 GB. One Gigabyte equals 1024 Megabytes. That is, about 5000 MB is placed on one DVD disc. And 5000 MB is much more than 30 MB. Conclusion: our file will fit on a DVD.

We were given a 1 GB flash drive. One GB contains 1024 MB. 1024 is more than 30. Conclusion: the file will fit on a 1 GB flash drive.



What else to read