Slike za priročnik

This one is a little bit an extension to Shranjevanje za splet. In particular it deals with making images for the manual, and how to optimise images.

Orodja za izdelavo posnetkov zaslona

Now, if you wish to make an image of the screen with all the dockers and tools, then Shranjevanje za splet won’t be very helpful: It only saves out the canvas contents, after all!

So, instead, we’ll make a screenshot. Depending on your operating system, there are several screenshot utilities available.

Windows

Windows has a build-in screenshot tool. It is by default on the Print Screen key. On laptops you will sometimes need to use the Fn key.

Linux

Both Gnome and KDE have decent screenshot tools showing up by default when using the Print Screen key, as well do other popular desktop environments. If, for whatever reason, you have no

ImageMagick

Z imagemagick lahko uporabite naslednji ukaz:

import -depth 8 -dither <imedatoteke.png>

While we should minimize the amount of GIFs in the manual for a variety of accessibility reasons, you sometimes still need to make GIFs and short videos. Furthermore, GIFs are quite nice to show off features with release notes.

Za izdelavo kratkih GIF-ov lahko uporabite te programe:

  • Peek – This one has an AppImage and a very easy user-interface. Like many screenrecording programs it does show trouble on Wayland.

macOS

The Screenshot hotkey on macOS is Shift + Command + 3, according to the official apple documentation.

Ustrezna oblika zapisa datoteke za namen

Different file formats are better for certain types of images. In the end, we want to have images that look nice and have a low filesize, because that makes the manual easier to download or browse on the internet.

Posnetki zaslona up. vmesnika

This should use PNG, and if possible, in GIF.

Images that have a lot of flat colors.

To bi moralo biti PNG.

Sivinske slike

To bi moralo biti GIF ali PNG.

Slike z veliko prelivov

To bi morale biti JPG.

Slike z veliko prosojnosti.

To bi moralo biti PNG.

The logic is the way how each of these saves colors. JPEG is ideal for photos and images with a lot of gradients because it compresses differently. However, contrasts don’t do well in JPEG. PNG does a lot better with images with sharp contrasts, while in some cases we can even have less than 256 colors, so GIF might be better.

Grayscale images, even when they have a lot of gradients variation, should be PNG. The reason is that when we use full color images, we are, depending on the image, using 3 to 5 numbers to describe those values, with each of those values having a possibility to contain any of 256 values. JPEG and other ‚lossy‘ file formats use clever psychological tricks to cut back on the amount of values an image needs to show its contents. However, when we make grayscale images, we only keep track of the lightness. The lightness is only one number, that can have 256 values, making it much easier to just use GIF or PNG, instead of JPEG which could have nasty artifacts. (And, it is also a bit smaller)

Ko ste v dvomih, uporabite PNG.

Optimizacija slik glede kakovosti in velikosti

Now, while most image editors try to give good defaults on image sizes, we can often make them even smaller by using certain tools.

Windows

The most commonly recommended tool for this on Windows is IrfranView, but the dear writer of this document has no idea how to use it exactly.

The other option is to use PNGCrush as mentioned in the linux section.

Linux

Optimizacija PNG

There is a whole laundry list of PNG optimisation tools available on Linux. They come in two categories: Lossy (Using psychological tricks), and Lossless (trying to compress the data more conventionally). The following are however the most recommended:

PNGQuant

A PNG compressor using lossy techniques to reduce the amount of colors used in a smart way.

Če želite uporabiti PNGquant, pojdite v mapo po izbiri in vnesite:

pngquant --quality=80-100 slika.png

Where image is replaced with the image file name. When you press the Enter key, a new image will appear in the folder with the compressed results. PNGQuant works for most images, but some images, like the color selectors don’t do well with it, so always double check that the resulting image looks good, otherwise try one of the following options:

PNGCrush

Stiskanje PNG brez izgube. Raba:

pngcrush slika.png slika-ven.png

This will try the most common methods. Add -brute to try out all methods.

Optipng

Another lossless PNG compressor which can be run after using PNGQuant, it is apparently originally a fork of png crush. Usage:

optipng slika.png

where image is the filename. OptiPNG will then proceed to test several compression algorithms and overwrite the image.png file with the optimised version. You can avoid overwriting with the --out imageout.png command.

Optimizacija GIF

Optimizacija JPEG

Now, JPEG is really tricky to optimize properly. This is because it is a lossy file format, and that means that it uses psychological tricks to store its data.

However, tricks like these become very obvious when your image has a lot of contrast, like text. Furthermore, JPEGs don’t do well when they are resaved over and over. Therefore, make sure that there’s a lossless version of the image somewhere that you can edit, and that only the final result is in JPEG and gets compressed further.

macOS

  • ImageOptim – A Graphical User Interface wrapper around commandline tools like PNGquant and gifski.

Urejanje metapodatkov datoteke

Sometimes, personal information gets embedded into an image file. Othertimes, we want to embed information into a file to document it better.

There are no less than 3 to 4 different ways of handling metadata, and metadata has different ways of handling certain files.

The most commonly used tool to edit metadata is ExifTool, another is to use ImageMagick.

Windows and macOS

To get exiftool, just get it from the website.

Linux

On Linux, you can also install exiftool.

Debian/Ubuntu

sudo apt-get install libimage-exiftool-perl

Ogled metapodatkov

Change the directory to the folder where the image is located and type:

Slika exiftool

where image is the file you’d like to examine. If you just type exiftool in any given folder it will output all the information it can give about any file it comes across. If you take a good look at some images, you’ll see they contain author or location metadata. This can be a bit of a problem sometimes when it comes to privacy, and also the primary reason all metadata gets stripped.

You can also use ImageMagick’s identify:

identify -verbose slika

Odstranjevanje metapodatkov

Stripping metadata from the example image.png can be done as follows:

ExifTool

exiftool -all= slika.png

This empties all tags exiftool can get to. You can also be specific and only remove a single tag: exiftool -author= image.png

OptiPNG

optipng -strip slika.png S tem boste obrezali in stisnili datoteko PNG.

ImageMagick

convert slika.png –strip

Extracting metadata

Sometimes we want to extract metadata, like an ICC profile, before stripping everything. This is done by converting the image to the profile type:

ImageMagick’s Convert

Najprej izvlecite metapodatke v profil s pretvorbo:

convert slika.png profil_slike.icc

Nato odstranite datoteko in preberite informacije o profilu:

convert -profile profil_slike.icc slika.png

Vdelava metapodatkov opisa

Description metadata is really useful for the purpose of helping people with screenreaders. Webbrowsers will often try to use the description metadata if there’s no alt text to generate the alt-text. Another thing that you might want to embed is stuff like color space data.

ExifTool

ImageMagick

Nastavljanje vrednosti exif:

convert -set exif:ImageDescription "An image description" image.png image_modified.png

Nastavitev koščka PNG za opis:

convert -set Description "An image description" image.png image_modified.png

Vdelava metapodatkov licence

In a certain way, embedding license metadata is really nice because it allows you to permanently mark the image as such. However, if someone then uploads it to another website, it is very likely the metadata is stripped with imagemagick.

Uporaba lastnosti

You can use dcterms:license for defining the document where the license is defined.

ImageMagick

Za GDPL:

convert -set dcterms:license "GDPL 1.3+ https://www.gnu.org/licenses/fdl-1.3.txt" image.png

This defines a shorthand name and then license text.

For Creative Commons BY-SA 4.0:

convert -set dcterms:license "CC-BY-SA-4.0 https://creativecommons.org/licenses/by-sa/4.0/" image.png

The problem with using properties is that they are a non-standard way to define a license, meaning that machines cannot do much with them.

Uporaba XMP

The creative commons website suggest we use XMP for this. You can ask the Creative Commons License choose to generate an appropriate XMP file for you when picking a license.

We’ll need to use the XMP tags for exiftool.

So that would look something like this:

exiftool -Marked=true -License="https://creativecommons.org/licenses/by-sa/4.0" -UsageTerms="This work is licensed under a <a rel="license" href="https://creativecommons.org/licenses/by-sa/4.0/">Creative Commons Attribution-ShareAlike 4.0 International License</a>." -Copyright="CC-BY-SA-NC 4.0" image.png

Drug način za označevanje je:

exiftool -Marked=true -License="https://creativecommons.org/licenses/by-sa/4.0" -attributionURL="docs.krita.org" attributionName="kritaManual" image.png
With imagemagick you can use the profile option again.

Najprej izvlecite podatke (če obstajajo):

convert slika.png meta_slika.xmp

Then modify the resulting file, and embed the image data:

convert -profile meta_slika.xmp slika.png

The XMP definitions per license. You can generate an XMP file for the metadata on the creative commons website.