Tag Archives: file size

Parse file sizes in KB, MB, GB, and so forth in C#

The example Format file sizes in KB, MB, GB, and so forth in C# shows how to convert a number into a string formatted in KB, MB, etc. This example does the opposite: it parses a value such as “1.23 … Continue reading

Posted in algorithms, files, mathematics | Tagged , , , , , , , , , | Leave a comment

Compress JPG files in a directory in C#

I wrote this example to help produce reduced-size versions of some of the thousands of pictures I’ve collected over the years. Unfortunately pictures you take with a modern camera or phone tend to be enormous. Fortunately most of my relatives … Continue reading

Posted in algorithms, files, graphics, image processing, tools | Tagged , , , , , , , , , , , , , , , , , , | Leave a comment

Quickly pick JPG compression level in C#

The example Compress JPG files to a certain size in C# lets you adjust a file’s JPG compression level until it is no bigger than a specified size. It does that by starting at a compression level of 100 and … Continue reading

Posted in algorithms, files, graphics, image processing | Tagged , , , , , , , , , , , , , , , , , | 1 Comment

Compress JPG files to a certain size in C#

The example Optimize JPEG compression level and file size in C# shows how to save a JPG file with different compression levels. Using a smaller level makes the resulting file smaller but introduces more error into the image. If you … Continue reading

Posted in algorithms, files, graphics, image processing | Tagged , , , , , , , , , , , , , , , , | 1 Comment

Get file size and last modification time on an FTP server in C#

The FtpGetFileSize method shown in the following code gets a file’s size in bytes. The uri parameter gives the full path to the file as in ftp://www.somewhere.com/test.txt. Note that the URI must begin with ftp not http. // Use FTP … Continue reading

Posted in files, ftp, internet, web | Tagged , , , , , , , , , , , , , , | Leave a comment