Tag: pictures

How to convert .webp images to GIMP

What are .webp files

Files with the .webp extension are image files in a format developed by Google.

To date, the WebP format has not been widely used, but it is supported by many web browsers and image viewers and editors.

How to Open WebP in GIMP

Recent versions of GIMP support WebP format (previously a special plug-in was required). But in the “Open With” context menu, you may not find GIMP:

This is not a problem, click “Other” and in the window that opens, find GIMP:

You can also click the buttons:

  • Add to list” – so that GIMP appears in the list of suggested programs when opening this file format
  • Set as default” – to make GIMP the default program for opening WebP files

Another option is to go to the GIMP menu and go to File → Open:

Once a WebP image is opened in GIMP, it can be exported to any format supported by GIMP. To do this, select “File” → “Export As…”:

Select File Type” and press the “Export” button:

Related: Batch image processing in GIMP

Batch image processing in GIMP

In addition to creative work with images in GIMP, sometimes you need to do fairly simple things, but with a large number of files. Sometimes even with a very large number of files. Such actions are called “Batch File Processing” or “Batch Image Manipulation” when the same operation is performed on multiple images. Such an operation can be converting, resizing, adding blur, changing sharpness, rotating an image, adding a watermark, compressing, renaming.

In order to perform the same operation on many files, we need a GIMP plugin called BIMP (Batch Image Manipulation Plugin).

How to install BIMP on Windows

To install BIMP on Windows, go to the official website and download the installation file: https://alessandrofrancesconi.it/projects/bimp/

Install like any other setup file on Windows.

How to Install BIMP on Linux

Installation on Debian, Linux Mint, Ubuntu, Kali Linux and derivatives:

sudo apt install libgimp2.0-dev libgegl-dev git
git clone https://github.com/alessandrofrancesconi/gimp-plugin-bimp
cd gimp-plugin-bimp

If you want to install the plugin only for the current user, then run the command:

make && make install

Or if you want to install the plugin for all users in the system, then run the command:

make && sudo make install-admin

Installation on Arch Linux, Manjaro, BlackArch and their derivatives:

pikaur -S gimp-plugin-bimp

You can find information about pikaur in the article “Automatic installation and update of AUR packages”.

How to use BIMP

After copying, a new item “Batch Image Manipulation…” will appear in the File menu.

When you click on this menu item, the following window will open:

Click “Add images”, you will have options to choose from:

  • Add single images
  • Add folders
  • Add all open images

In the “Output folder” specify the directory where you want to save the images after processing.

By clicking the Add button, you can select the operations that will be performed in batch mode. These operations can be combined, i.e., several actions can be performed simultaneously on a group of files.

Basic Operations:

  • Resize
  • Crop
  • Flip or Rotate
  • Color correction
  • Sharp or Blur
  • Adding a watermark
  • Change format and compression
  • Rename with a pattern
  • Other GIMP procedure

Custom File Operations in Batch Mode in GIMP

The most interesting of all the above operations is the “Other GIMP procedure” item:

That is, you can select any operations that GIMP can do, set the necessary parameters (if any). And all this can be combined with the above functions or among themselves. In general, everything is very cool.

If you have scripts in languages that GIMP supports, then those scripts are also on this menu and can be used.

How to convert many .pdf files to pictures

When trying to convert a lot of .pdf to .jpg, I ran into a difficulty – the impossibility of importing .pdf files into this plugin, because .pdf is not among the supported formats. However, it can be done. First, open all .pdf files in GIMP (you can select all the necessary files and drag them into the GIMP program window to do this quickly, in one go). Next, in the plugin, select “Add all open images”. And everything is ready – you can perform any batch processing of these files, including saving them in the desired format.

See also:

BIMP Example – Bulk convert WebP to GIMP

The WebP image format is not very convenient because not all applications support it. Therefore, it may be necessary to convert a large amount of WebP to JPG or PNG using GIMP.

From the File menu, open “Batch Image Manipulation…”.

Add files to convert – WebP format is supported.

Set a folder to save the processed images in the new format:

Click “Add” and select “Change format and compression”.

Select the format and format options (image quality):

When everything is ready, click the “Apply” button:

Wait for processing to complete:

Related: How to convert .webp images to GIMP

How to make images on a site (including WordPress) maintain the correct aspect ratio

How to maintain aspect ratio with HTML IMG tag

An image inserted into a page has the correct proportions by default unless you change it.

When viewing images on a mobile phone, the images are scaled, that is, resized to fit completely on the screen.

Web pages work in a similar way, including sites running WordPress.

But I noticed one issue of displaying large images for which the size is set. On larger screens, these images still display correctly, that is, they retain the correct aspect ratio. But on mobile phones, when the screen width is less than the image width, the image is displayed with distortion, it is stretched vertically, for example:

To fix this problem, add the following rule to the style file:

img{
	object-fit: contain;
}

How to fix wrong image aspect ratio in WordPress

You need to add the specified image style to your WordPress theme's stylesheet. To do this, go to WordPress Dashboard → Appearance → Theme File Editor.

Open the style.css file for editing (it is open by default when you switch to the Theme File Editor).

If you can't use the Theme File Editor, that's not a problem – below is how to edit the style.css file without using the Theme Editor.

Look in the style.css file for the tag:

img {
	……………..
}

In some themes it is already present, in some themes it is not.

If this tag is missing, then add to the style.css file

img {
	object-fit: contain;
}

Another site of mine already has an img tag with the following content:

img {
	max-width: 100%;
	height: auto;
}

In this case, I add a new style to the existing ones, it turned out:

img {
	max-width: 100%;
	height: auto;
	object-fit: contain;
}

After the changes made, images on small screens retain their aspect ratio, even if they do not fit the width of the screen.

Note: If the image is still stretched after making changes to the style file, you need to wait for the site cache to refresh or reset the cache manually. To redownload files from the web server without using the web browser cache, press Ctrl+F5 on the site page. If caching is enabled on your server or at the WordPress level, you need to flush this cache, or wait for it to be updated.

How to edit style.css file without Theme File Editor

If for some reason you cannot use the Theme Editor, then you can edit the style.css file in any other way.

You need access to your site's file system. The specific way to access site files depends on the host and usually webmasters know what to do.

The style.css file is located at the following address:

SITE_FOLDER/wp-content/themes/THEME_NAME/style.css

GIMP copies not all layers (SOLVED)

GIMP is a powerful image editor, comparable to PhotoShop in features, but completely free.

You may have come across a situation where you have edited an image, perhaps added text and other layers and are trying to copy the resulting image, for example, to create a new file from it or paste into another image. However, only individual elements or the original background are copied.

It's all about the layers of the processed image.

For example, if you select and copy an area in an image with several layers (in this case, with three layers), then only one of the layers will be copied to the clipboard.

This is due to the behavior of the GIMP: although we see and, it seems to us, copy all layers, in fact, this operation applies only to the active layer.

To select the contents of all layers at once, select the area you need, right-click on it, and in the context menu that opens, select Edit → Copy Visible.

You can also use the keyboard shortcut Ctrl+Shit+C for this.

As a result, the area will be copied to the clipboard as you see it on the screen, and not a separate layer.

Loading...
X