This one is a little bit an extension to Saving For The Web. In particular it deals with making images for the manual, and how to optimise images.
- Images for the Manual
- Tools for making screenshots
- The appropriate file format for the job.
- Optimising Images in quality and size.
- Editing the metadata of a file
Now, if you wish to make an image of the screen with all the dockers and tools, then Saving For The Web 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’s several screenshot utilities available.
Windows has a build-in screenshot tool. It is by default on the PrtSc key. On laptops you will sometimes need to use the fn key.
Both Gnome and KDE have decent screenshot tools showing up by default when using the PrtSc key, as well do other popular desktop enviroments. If, for whatever reason, you have no
With imagemagick, you can use the following command:
import -depth 8 -dither <filename.png>
While we should minimize the amount of gifs in the manual for a variety of accesibility reasons, you sometimes still need to make gifs and short videos. Furthermore, gifs are quite nice to show off features with release notes.
For making short gifs, you can use the following programs:
- Peek – This one has an appimage and a very easy user-interface. Like many screenrecording programs it does show trouble on Wayland.
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.
- GUI screenshots
- This should use png, and if possible, in gif.
- Images that have a lot of flat colors.
- This should use png.
- Grayscale images
- These should be gif or png.
- Images with a lot of gradients
- These should be JPG.
- Images with a lot of transparency.
- These should use 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 wel 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.
Greyscale 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)
When in doubt, use PNG.
Now, while most image editors try to give good defaults on image sizes, we can often make them even smaller by using certain tools.
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 options is to use PNGCrush as mentioned in the linux section.
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:
A PNG compressor using lossy techniques to reduce the amount of colors used in a smart way.
To use PNGquant, go to the folder of choice, and type:
pngquant --quality=80-100 image.png
Where image is replaced with the image file name. When you press enter, 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:
A lossless PNG compressor. Usage:
pngcrush image.png imageout.png
This will try the most common methods. Add
-bruteto try out all methods.
Another lossless PNG compressor which can be run after using PNGQuant, it is apparantly originally a fork of png crush. Usage:
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
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.
Sometimes, personal information gets embedded into an image file. Othertimes, we want to embed information into a file to document it better.
There’s 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.
On Linux, you can also install exiftool.
sudo apt-get install libimage-exiftool-perl
Change the directory to the folder where the image is located and type:
where image is the file you’d like to examine. If you just type exif tool 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 meta-data gets stripped.
You can also use ImageMagick’s identify:
identify -verbose image
Stripping metadata from the example
image.png can be done as follows:
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
First extract the metadata to a profile by converting:
convert image.png image_profile.icc
Then strip the file and readd the profile information:
convert -profile image_profile.icc image.png
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.
Setting an exif value:
convert -set exif:ImageDescription "An image description" image.png image_modified.png
Setting the PNG chunk for description:
convert -set Description "An image description" image.png image_modified.png
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.
You can use dcterms:license for defining the document where the license is defined.
For the 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 http://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.
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="http://creativecommons.org/licenses/by-sa/4.0" -UsageTerms="This work is licensed under a <a rel="license" href="http://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
Another way of doing the marking is:
exiftool -Marked=true -License="http://creativecommons.org/licenses/by-sa/4.0" -attributionURL="docs.krita.org" attributionName="kritaManual" image.png
- With imagemagick you can use the profile option again.
First extract the data(if there is any):
convert image.png image_meta.xmp
Then modify the resulting file, and embed the image data:
convert -profile image_meta.xmp image.png
The XMP definitions per license. You can generate an XMP file for the metadata on the creative commons website.