• Compress jpeg files online. How to compress a JPG file. Basic image optimization

    If you need to increase the disk space on your device or simply change the weight of an image, you need to know how to reduce the size of a jpg file.

    This photo format is the most common.

    JPG compression is supported by all devices and allows you to save image information without loss or distortion.

    The weight of a jpg file can be found in the photo properties, and the volume of the picture can be easily changed using editing programs and online services.

    Method number 1. Reducing the size of a picture in Paint.NET

    Paint is the simplest standard program for editing raster and vector images. Available for all users of Windows operating systems.

    Main tools available in the application:

    • adding inscriptions;
    • filling elements;
    • trimming, pasting;
    • copying fragments, etc.

    After changing the width and height of the photo, the size changes.

    Follow the instructions to reduce the size of the Paint image:

    • Right-click on the desired image and select Edit. The photo will automatically open in Paint in editing mode;
    • On the main toolbar, find the resize button and click on it. A dialog box will open. To reduce the size of the final file, you need to change the size to a smaller one.
      You can edit using percentages or pixels. By saving, you will reduce the size of the image.

    Remember! After changing the width parameter, you need to change the height proportionally. Otherwise, the picture may become too stretched and disproportionate.

    Method No. 2. Resizing in Photoshop

    The photo file size can also be reduced in a professional raster image editing program - Photoshop. Follow the instructions:

    • Open the application and import the required graphic file for further work;
    • Find the Image tab on the main toolbar, click on it. Select Image Size from the drop-down list, as shown in the figure below;
    • Change the image dimension parameters (width and height), and also make sure that the checkbox next to Maintain photo proportions is checked;
    • Try reducing the photo by 10-15 percent. Thus, its final weight will also decrease.

    Method No. 3. Using MS Office programs

    The test Word processor version 2010 and earlier versions have an image compression function. This function has been removed in the latest versions of the program.

    Add a picture to the document page, then in the tab that appears, select “Open with”, and then the MS Picture Manager application.

    In the window that opens, click on the “Image” tab and select “Compress image”. The higher the compression ratio, the smaller the final file size will be.

    Save the resulting changes.

    Important! After compression, the quality of the illustration may deteriorate.

    Method number 4. Using online services

    An excellent web service for working with photos is the resource irfanview.com. It allows you to work with a huge number of different image formats.

    To reduce the size, you can open the image menu and edit its height and width.

    Also in the resizing window, you can select additional parameters for better compression: sharpening, sharpening filter, special keys for reducing/increasing the size and changing the image resolution.

    The saving option can also reduce the size. The best option for setting them up is shown in the figure below.

    This window appears while the final image is being saved.

    Method No. 5. Reducing size on Mac devices

    A free application for working with pictures and photos called iPhoto is available for Mac OS users.

    If the program is not installed on your device, download it from the official store. It's completely free.

    The utility allows you to easily work with images of all currently common formats.

    1. Click on the events tab twice;
    2. Select the required picture;
    3. In the settings window, adjust the photo size: you can adjust the width, height and resolution. The lower these parameters, the correspondingly lower the file size;
    4. Save the image.

    Thematic videos:

    In this video I show 2 of the easiest ways - how to reduce the size of a JPG file (image).

    Reducing JPEG (JPG) file size

    In this video you will learn how to reduce the size of a JPEG (JPG) image using simple programs.

    How to reduce jpg file size, resize photo

    In this video we will learn how to reduce the size of a jpg file, resize

    In the current age of mobile technology, optimization of images in PNG and JPG, JPEG formats has become relevant again, as it was relevant in those days when the Internet was just entering our lives and was universally slow and dial-up. Mobile Internet, of course, is not entirely correct to compare with dial-up, but in places where the connection is poor, the access speed is quite low. And even in those days, the user had nowhere to go, and had to wait for the page to load. Now the Internet has grown, there is a large selection of sites. The user became capricious and impatient, and the average page load time decreased greatly. It’s easier for the user to find another faster site.
    Yes, and search giants like Google or Yandex began to pay attention to how quickly sites load, giving preference in the search results to those that are faster. The weight of the page also plays an important role in this, which, in turn, strongly depends on the weight of the images located on it. It's pretty obvious that having compact, compressed images is beneficial to everyone. Therefore, here I want to talk about how to prepare your PNG and JPG, JPEG files for uploading to hosting.

    Basic image optimization

    This involves trimming unnecessary fields, reducing color depth, removing comments and saving the image in a suitable format. To do this, you can use Adobe Photoshop, or, if you don't have it, MS Paint or GIMP.
    Even basic cropping of the image will reduce its weight quite well.

    How to make an image smaller in MS Paint

    Using MS Paint as an example, I’ll show you how to reduce an image to the required size.
    Let's take for example the NGINX logo and its nginx.png image measuring 2000x417 pixels, which needs to be cropped to 1024 in width, because This is the width of the page layout, and there is no point in doing more.

    The output is an image that has undergone minimal basic optimization. It's time to move on to compressing her weight.

    File Optimizer for PNG and JPG,JPEG compression

    The easiest and fastest way to achieve optimal image compression without loss of quality is to use the File Optimizer program

    Official website and program description :

    Download File Optimizer you can with

    Description . It is an effective optimizer not only for images, but also for .pdf, .docx, txt and other text, audio and video files, as well as archives. You can find a complete list of supported extensions on the official project page.
    Here are some of the utilities used in the work: AdvanceCOMP, APNG Optimizer, CSSTidy, DeflOpt, defluff, Gifsicle, Ghostcript, jhead, jpegoptim, jpegtran, Leanify, mozjpeg, MP3packer, mp4v2, OptiPNG, PngOptimizer, PNGOUT, pngquant, pngrewrite, pngwolf, TruePNG, tidy-html5, ZLib, zRecompress. I think even this partial list is quite impressive.

    Installing and using File Optimizer

    First, download the latest version of the program either in the form of an installer or an archive with files. By the way, the archive has a version for 32-bit and 64-bit versions of Windows.

    The interface is quite simple and intuitive.
    Doesn't need any settings, but you can customize some formats for yourself using the Options button...
    Usage . You either drag and drop the required files and even folders (directories) into the program window, or select the ones you need through the Add files... menu.
    To optimize files, click Optimize all files

    The optimized files will replace the source files, and the category hierarchy will also be preserved. Opposite each file, statistics will be shown, how much the optimized version weighs as a percentage of the original file size.
    After completing the work, statistics on the number of processed files will be displayed below in the status line, as well as how much was saved.

    In my opinion, File Optimizer does its job very well.
    The only negative is that if the list of files is large, you can wait a long time for results, but it’s worth it.

    If you are interested in details of optimization methods that can be configured in your own way, then we will talk about setting up and using utilities for image compression

    Compress PNG without losing quality

    Let's look at 3 programs for PNG optimization:

    • Adobe Photoshop
    • OptiPNG
    • PNGOUT

    Let's compare them in terms of image compression quality. We will compress nginx.png from the previous section. The original weight is 27.5 KB.

    Compress PNG using Adobe Photoshop

    The first one on the list is Photoshop, which is well known to everyone. A multifunctional processor for a designer that can do almost everything, including compressing images.
    Open in Photoshop File-Save for Web or use a combination Alt+Shift+Ctrl+S

    As a result, we get 22.7 KB, i.e. shrank by 17.5%

    Unfortunately, most graphics programs are unable to unlock the full potential of the algorithms used to compress PNGs. The main reason is that to determine the optimal compression strategy, they use heuristic algorithms that allow them to estimate the effectiveness of certain parameters without performing compression, which, as a result, produces a large percentage of errors. Therefore, to compress PNG we use utilities specially created for this purpose, namely OptiPNG and PNGOUT.

    Using OptiPNG to Compress PNG

    How to install and use OptiPNG

    Downloaded the .exe, uploaded it to C:\Windows, took the desired PNG file, and put it in some folder. Now, using FAR Manager or another file manager with console support, go to this folder and enter the command into the console

    Optipng -o7 nginx.png

    The command forces you to compress the PNG in the folder. Later we’ll look at a simple option on how to do compression in one click.
    But first, let's take a look at the result.

    18.8 KB, i.e. shrank by 31.6%, almost a third. Not bad at all, isn't it? Photoshop turned out much worse.

    Using PNGOUT to Compress PNG

    How to install and use PNGOUT

    Everything is exactly the same as for OptiPNG. Download PNGOUT.exe, drop it into C:\Windows, open the folder with PNG in a file manager, for example, Far Manager, and write in the command line

    Pngout nginx.png

    The result is below

    The result is 23.4 KB, i.e. managed to compress by 15%. Very good.

    In general, I’ll say right away that I had different results with different files, in some places PNGOUT worked more efficiently, in others OptiPNG, so I advise you to run the images one by one through both utilities.

    How to quickly compress PNG in OptiPNG and PNGOUT

    Create a png.reg file and write the registry data there

    Windows Registry Editor Version 5.00 @="Run OptiPNG on Folder" @="cmd.exe /c \"TITLE Running OptiPNG on %1 && FOR /r \"%1\" %%f IN (*.png) DO optipng -o7 \"%%f\" \"" @="Run PNGOUT on Folder" @="cmd.exe /c \"TITLE Running PNGOUT on %1 && FOR /r \"%1\" %%f IN (*.png) DO pngout \"%%f\" \""

    Then you run this file and write the data to the Windows registry.
    Now, when you click on a folder with PNG files that need to be compressed, select the commands you need, compression will occur automatically for all images at once.

    To remove everything from the context menu, write the following code into png.reg and run it

    Windows Registry Editor Version 5.00 [-HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Folder\shell\OptiPNG] [-HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Folder\shell\OptiPNG\command] [-HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Folder\shell\PNGOUT] [ -HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Folder\shell\PNGOUT\command]

    JPG, JPEG compression without quality loss

    To optimize JPG, JPEG, by analogy with PNG, there are utilities: jpegtran and jpegoptim. Of course, you can use Photoshop, but for JPG and JPEG compression I highly recommend using them.

    How to install, configure and use jpegtran

    jpegtran is a powerful utility that allows you to perform simple JPG compression without loss of quality, compression with a certain level of anti-aliasing, and even conversion to Progressive JPEG.
    You can download jpegtran here http://jpegclub.org/jpegtran/ (look for and download jpegtran.exe).

    How to compress JPG, JPEG using jpegtran

    Upload jpegtran.exe to C:\Windows
    Then open the folder with the desired JPEG in Far Manager and enter in the console

    Jpegtran -copy none -optimize -outfile min.1.jpg 1.jpg # Basic optimization 1.jpg # -copy none removes metadata from JPG # -optimize optimizes the image

    Progressive JPG, JPEG

    This is a type of JPG that, when the page loads, first shows the general outline, then loads and brings the image quality to maximum. It is very convenient for slow mobile Internet, and therefore it is necessary to use it.

    Jpegtran -progressive -outfile 1.jpg 1.jpg # Transforms the 1.jpg format to Progressive

    How to check if an image is a Progressive JPEG

    Advanced features of jpegtran

    Here are all possible options for using jpegtran

    Jpegtran --help usage: jpegtran inputfile outputfile Switches (names may be abbreviated): -copy none Copy no extra markers from source file -copy comments Copy only comment markers (default) -copy all Copy all extra markers -optimize Optimize Huffman table ( smaller file, but slow compression) -progressive Create progressive JPEG file Switches for modifying the image: -crop WxH+X+Y Crop to a rectangular subarea -flip Mirror image (left-right or top-bottom) -grayscale Reduce to grayscale ( omit color data) -perfect Fail if there is non-transformable edge blocks -rotate Rotate image (degrees clockwise) -scale M/N Scale output image by fraction M/N, eg, 1/8 -transpose Transpose image -transverse Transverse transpose image -trim Drop non-transformable edge blocks -wipe WxH+X+Y Wipe (gray out) a rectangular subarea Switches for advanced users: -arithmetic Use arithmetic coding -restart N Set restart interval in rows, or in blocks with B -maxmemory N Maximum memory to use (in kbytes) -outfile name Specify name for output file -verbose or -debug Emit debug output Switches for wizards: -scans file Create multi-scan JPEG per script file

    How to quickly automatically compress JPEG using jpegtran in Windows

    You won't be able to compress via the context menu due to the way the utility works, however, you can set up compression of multiple JPEGs at once automatically.
    To do this, we need to create a file with the extension .bat (to help) and write it there

    Cd/d. for %%j in (*.jpg) do call:sheensay "%%~nxj" "%%~nj.jpg" goto:eof:sheensay jpegtran -copy none -optimize -progressive "%~1" "%~2 "

    How to install, configure and use jpegoptim

    How to compress JPG, JPEG using jpegoptim

    Upload jpegoptim.exe to C:\Windows. Then open the folder with JPG images using Far Manager and enter into the console

    Jpegoptim *.jpg --strip-all --all-progressive

    How to optimize several JPGs, JPEGs at once using jpegoptim

    Unlike jpegtran, the jpegoptim utility allows you to work with it from the context menu quite well.
    Let's create a file jpegoptim.reg, for example, using Far Manager, and write there

    Windows Registry Editor Version 5.00 @="Run jpegoptim on Folder" @="cmd.exe /c \"TITLE Running jpegoptim on %1 && FOR /r \"%1\" %%f IN (*.jpg) DO jpegoptim *.jpg --strip-all --all-progressive \"%%f\" \""

    We launched it and entered the data into the registry. Now you can compress many JPEG files using the context menu, just put the desired images in one folder, RMB and “Run jpegoptim on Folder”.

    If you want to remove jpegoptim from the registry and context menu, write jpegoptim.reg

    Windows Registry Editor Version 5.00 [-HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Folder\shell\jpegoptim] [-HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Folder\shell\jpegoptim\command]

    Save, run, make changes to the registry.

    How well do jpegtran and jpegoptim compress jpg, jpeg

    Let's move on to the tests. Take, for example, the caching.jpg file. In the original it weighs 29.5 KB

    Jpegtran tests for JPG, JPEG compression quality

    jpegtran -copy none -optimize -progressive caching.jpg caching.jpg

    The output was 29.1 KB, compression saved 1.36%

    Jpegoptim tests for JPG, JPEG compression quality

    jpegoptim caching.jpg --strip-all

    This is not visible in Windows Explorer; the compression was several hundred bytes.

    Well, the original file was pretty well prepared so the compression didn't have any noticeable effect, but when you process your unoptimized images, you'll sometimes be surprised at how much size savings you can make.

    How to set up png and jpg, jpeg compression automatically

    If you have read to this section, but are still dissatisfied with the options offered, I suggest you assemble a portable harvester yourself - a service for compressing pictures, photos, images that will work as you need right on your desktop.

    Must be pre-installed jpegtran, jpegoptim, optipng, pngout yu
    Installation instructions are above.

    So, for this we need to properly assemble the folder architecture. Let's say you have an images folder with its own hierarchy of subfolders with PNG and JPG that you need to process.
    Create a folder optimus, put the images folder with all its subfolders and files into it.
    Open , open optimus in it, create a go.bat file there and write it there

    @ECHO OFF CLS SetLocal EnableExtensions EnableDelayedExpansion set home_path=%~dp0:: Name of the folder in which the raw images are located set folder=images echo Processing *.JPG files via jpegtran:: Create a folder in which the compressed jpg will be stored. In our case, this is jpeg_images xcopy /y /t /c /i "%folder%" "jpg_%folder%" :: For each .jpg, we optimize using jpegtran. Output.jpg will be written to jpeg_images for /r %folder% %%a in (*.jpg) do (set fn=%%a& jpegtran -copy none -optimize -progressive -outfile %home_path%jpg_!fn:%~dp0 =! %home_path%!fn:%~dp0=!) echo Processing of *.JPG files via jpegtran is completed:: We indicate that the run should now be carried out in a new folder jpeg_images set folder = jpg_%folder% echo Processing of *.JPG files via jpegoptim for /r %folder% %%a in (*.jpg) do (set fn=%%a& jpegoptim %%~a --strip-all) echo Processing of *.JPG files via jpegoptim completed echo Processing of *.PNG files via optipng xcopy /y /t /c /i "%folder%" "png_%folder%" for /r %folder% %%a in (*.png) do (set fn=%%a& optipng -o7 %% ~a -out %home_path%png_!fn:%~dp0=!) echo Processing of *.PNG files via optipng is completed set folder=png_%folder% echo Processing of *.PNG files via pngout for /r %folder% %%a in (*.png) do (set fn=%%a& pngout %%~a) echo Processing of *.PNG files via pngout completed pause

    The code is commented out in important parts. In fact, nothing complicated, you can figure it out if you need it.

    Now save go.bat and run it.

    If there are a lot of files, image compression will take some time. Wait until the console notifies you that the process has completed.

    Compression takes place by separating JPG files separately, which are now located in jpg_images, and PNG files separately, which are located in png_images.

    If you need to change quality or other parameters, see the description of the utilities above and change the code to suit your needs.

    How to Optimize and Compress GIF

    In conclusion

    In this article, I tried to cover as fully as possible the methods of optimizing PNG and JPG. If you have any questions or additions, write in the comments, we’ll discuss

    Hello. Quite often, when working with graphic files (pictures, photographs, and indeed any images), they need to be compressed. Most often this is necessary to transmit them over the network or post them on a website.

    And despite the fact that today there are no problems with hard drive capacity (if it’s small, you can buy an external HDD of 1-2 TB and this will be enough for a very large number of high-quality photographs), storing images in a quality that you will not need - not justified!

    In this article I want to look at several ways to compress and reduce the size of a picture. In my example, I will use the first 3 photographs I came across on the World Wide Web.

    Most popular image formats

    1) bmp is an image format that provides the best quality. But you have to pay for quality with the space taken up by pictures saved in this format. The dimensions of the photos they will occupy can be seen in screenshot No. 1.

    Screenshot 1. 3 pictures in bmp format. Pay attention to the file size.

    2) jpg is the most popular format for pictures and photographs. Provides fairly good quality with amazing compression quality. By the way, please note that a picture with a resolution of 4912×2760 in bmp format takes up 38.79 MB, and in jpg format only 1.07 MB. Those. The image in this case was compressed by about 38 times!

    Regarding the quality: if you don’t enlarge the picture, it’s impossible to recognize by eye where is bmp and where is jpg. But when you enlarge a jpg image, blurriness begins to appear - these are the consequences of compression...

    Screenshot No. 2. 3 pictures in jpg

    3) png - (portable network graphics) is a very convenient format for transmitting pictures on the Internet (* - in some cases, pictures compressed in this format take up even less space than jpg, and their quality is higher!). They provide better color reproduction and do not distort the picture. It is recommended to use for pictures that should not lose quality and that you want to upload to some site. By the way, the format supports a transparent background.

    Screenshot No. 3. 3 images in png

    4) gif is a very popular format for pictures with animation (more about animation:). The format is also very popular for transmitting pictures on the Internet. In some cases, it provides images that are smaller in size than in jpg format.

    Screenshot No. 4. 3 pictures in gif

    Despite the huge variety of graphic file formats (and there are more than fifty of them), on the Internet, and in general, these are the files (listed above) that most often come across.

    How to reduce the size of a picture in Adobe Photoshop

    In general, of course, for the sake of simple compression (conversion from one format to another), installing Adobe Photoshop is probably not justified. But this program is quite popular and those who work with pictures even less often have it on their PC.

    1. Open the picture in the program (either through the “File/Open...” menu, or the “Ctrl+O” button combination).

    3. Set the saving settings:

    Quality: depending on the selected quality (and you can set compression from 10 to 100), the size of the picture will depend. Examples of compressed images at different qualities will be shown in the center of the screen.

    After that, just save the picture - its size will become an order of magnitude smaller (especially if it was in bmp)!

    Result:

    The compressed image began to weigh approximately 15 times less: from 4.63 MB it was compressed to 338.45 KB.

    Other image compression programs

    1. Fastone image viewer

    One of the fastest and most convenient programs for viewing pictures, easy editing, and, of course, compressing them. By the way, it allows you to view pictures even in ZIP archives (many users often install the AcdSee program for this).

    In addition, Fastone allows you to reduce the size of dozens and hundreds of images at once!

    1. Open the folder with pictures, then select with the mouse those that you want to compress, and then click on the “Tools/Batch Processing” menu.

    We move the pictures from the left side to the right (those that we want to compress);

    We select the format into which we want to compress them;

    That's all - after that, just press the start button. By the way, in addition to this, you can set various settings for image processing, for example: crop edges, change resolution, put a logo, etc.

    3. After the compression procedure, Fastone will provide a report on how much hard drive space was saved.

    2.XnVew

    A very popular and convenient program for working with photographs and pictures. By the way, I edited and compressed the pictures for this article in XnView.

    Also, the program allows you to take screenshots of a window or a specific part of it, edit and view pdf files, find similar pictures and delete duplicates, etc.

    1) To compress photos, select those that you want to process in the main program window. Then go to the Tools/Batch Processing menu.

    2) Select the format into which you want to compress the pictures and click the start button (you can also set compression settings).

    3) The result is quite poor, the image is compressed by an order of magnitude.

    Was in bmp format: 4.63 MB;

    Now in jpg format: 120.95 KB. “To the eye,” the pictures are practically no different!

    3. Riot

    Another very interesting program for compressing images. The idea is simple: you open any image (jpg, gif or png) in it, then immediately see two windows: in one the original image, in the other the output. The RIOT program automatically calculates how much the image will weigh after compression, and also shows you the compression quality.

    What’s also captivating about it is the abundance of settings; pictures can be compressed in different ways: make them sharper or turn on blur; You can turn off a color or only shades of a certain color range.

    By the way, a great opportunity: in RIOT you can specify what file size you need and the program itself will automatically select the settings and set the image compression quality!

    Here's a small result of the work: the image was compressed to 82 KB from a 4.63 MB file!

    Online services for image compression

    In general, I personally don’t really like compressing images using online services. Firstly, I think it takes longer than a program, secondly, there are not so many settings in online services, and thirdly, I would not like to upload all the pictures to third-party services (after all, there are also personal photos that you only show in close family circle).