Inkscape and Perl

I’ve talked about it before. People who make SVG images do not correctly enter their text in their SVG editor. Result: The text does not appear or in the wrong place (Figure 1). If you then analyze the problem in the Inkscape program, you will see how bad the text has been entered (Figure 2).

That’s no problem at all if an image contains 4 text objects. But if there are 32 text objects in the text, re-typing all of this text in Inkscape will be far too much work. However, the text is already in the code. Only the code is incorrect so the text is displayed incorrectly.

I have been looking for a solution to this problem for quite some time. The problem can be divided into two sub-issues:
1. A method of extracting text quickly from an XML file.
2. A method to put this text as a whole into the old file, but embedded in the correct code. This text will appear in Inkscape, but not in the correct place. This should then be dragged to the right place and then aligned.
With the text editor Vim, you can quickly extract text from an XML file. This can be done using a macro. I will not discuss it here.
I’ve solved problem 2 with some Perl code. See below:

After running perl script.pl, 32 text objects are created using the for loop (line 17). One for each element from the $a array (line 9) This text can then be copied and thereafter be pasted into the SVG file, as I have already described above. Also note line 27. The style of the text object must be right (good font type, good font size, etc.)
Using scripts can save some time when you want to make changes to images. See below for the result:

Posted in tekening, wikipedia | Leave a comment

OmegaT

OmegaT is a CAT program. This stands for Computer Assisted Translation. So it is a tool for translators. I have tried it recently and these are my findings.

First of all, the workflow. This needs to be mentioned because there are several steps that need to be taken before you can start the actual translation.

First start by creating a new project: Project/New. This opens a new window. In this window you must determine what the language of the document is that you want to translate. Also, you must add the language in which the document shall be translated. Automatically, new maps will be created in which the new project shall be stored.

Then you must add the so-called source document. This is the document that needs to be translated. A warning is necessary. OmegaT cannot import Word documents (.doc en .docx). These must be converted into an .odt document.

We have arrived at the actual translation stage. OmegaT divides the text into segments. You translate the text going from segment to segment.

What helps with translating, is by enlarging the so-called font: Tools/Font/Size. With this you can enlarge the text. What also helps, is switching on the option View/Mark Untranslated Segments. By way of colour is indicated which parts of the text you haven’t translated.  See image below.

When you have translated the text, you still have to make the translated document. This you do by: Project/Create Current Translated Document. You can find the just created translated document in the project folder which you have made at the start. Go to this map and under the map target you find your translated document.

And now the review. This program is clearly in alpha phase. To give an example: it is not possible to open a once created project. This makes the program unsuitable for large documents.

And what to think of the option Translate/Machine Translate/Automatically Fetch Translations. By this I understand that the program automatically makes translations of the text. This does, however, not happen.

In my opinion, this program is unfinished. But for small translations like this text, the program is well suited.

OmegaT vertaalprogramma

Posted in Linux | Leave a comment

Subtitle Editor Gaupol

In my last post I have discussed several subtitle editors. Including
the program Gaupol. I wasn’t enthousiastic about this program but I
have tested it now extensively. This after reading the manual on
github.org:
https://github.com/otsaloma/gaupol/blob/master/doc/creating-subtitles.md.

This is what I have done. I have downloaded a video of the Carpenters
and I have tried to make subtitles for it. This is how it is done with
Gaupol.
You let the video run in Gaupol. Each time that you hear the start of a
new sentence in the video, you press the key “j”. You can make small edits to this starting point with the letters “q” and “w”. With it you create a series of subtitles. Next, you type the text of the subtitles in the program. After that you you run the video another time but this time you determine with the letter “k” when a subtitle ends. With the keys “e” and “r” you can make small adjustments to the endpoint. The whole process is really very simple and that makes Gaupol my favorite subtitle editor.

I have made a drawing with the keys which you have to use for this program. In this program you can see an anchor near the letters j and k. This is done to indicate that with these keys you can respectively determine the beginning and the end of each subtitle. The letters above them indicate that you can manually adapt these begin- and endpoints.

Drawing with the keys relevant for Gaupol

Posted in Linux, video | Leave a comment

Subtitle Editors

I have tried to make subtitles for a video with subtitle editors. I have tried several: Subtitle Composer, Gnome Subtitles, Gaupol, Subtitle Editor and Aegisub.

Aegis subtitle editor

I found the experience horrible. It was almost impossible to achieve anything. Consulting websites and watching Youtube videos on the subject didn’t help. It has taken me more or less a day before I understood how to do it. This is mostly caused by the bad interface of
these programs. Nevertheless, once you have understood it, you can achieve great results.

I found Gnome Subtitles to be the best program. This program excels by its simplicity. And it therefore easy to use (once you have understood it).

The most surprising program was Subtitle Editor. Once you have understood the interface (and that takes time), the program offers you a few interesting extras. First of all, it is possible to import text files. These will be automatically converted to .srt files (subtitle format). A feature that Gnome Subtitles not have. The program has no buttons with which to control it. Instead you can make socalled keyboard shortkeys. When you have to create subtitles only once, it is too much work. But when you have to do that more often, this feature is most helpful.

The program Aegisub is the most elaborate of all the programs that I have tried. Someone who is already familiar with audio software, will comprehend this program quite easily. It offers you the possibility to format your text (italic, bold, color etc. etc.). For those who will make subtitles more than once, this will probably be the program you end up working with.

Gaupol doesn’t have the feature to program certain keys of your keyboard. That means that you have to use the mouse to control your program. Eventually, this is too much a drawback to me.

Subtitle Composer is a good program but without the many extras which Subtitle Editor has. I therefore choose for Subtitle Editor.

But how do you make subtitles? This you do by delaying the video. This offers you the time to add the text at the right place.

A last remark: in may editors you must use Insert (after) when you want to add a subtitle.

Posted in Linux, video | Leave a comment

High Pass Filter to Gimp

I wanted to edit a photo with the High Pass Filter but I noticed it wasn’t installed yet. The reason for that was that I had made the switch to Ubuntu Linux. I had to search the internet and finally found the plugin that I was looking for, here: http://registry.gimp.org/node/7385.

I had some trouble getting this installed on my computer but the search program Catfish offered the solution. I let the program search for all. scm files (the extension name of all Gimp plugins) and I observed that the plugins on my computer in this location are: /usr/share/gimp/scripts/.

I use the High Pass Filter when I want to sharpen a portion of a picture. One can think of a landscape photo where the foreground is in focus but the background not. The High Pass Filter can rectify this.

A good explanation of the High Pass Filter gives Rolf Steinort from Bremen on his site Meetthegimp.org. Here is the video:
https://blog.meetthegimp.org/episode-164-high-pass-sharpening/

In his video he used not the plugin but he does it manually. He does a number of actions:

  1. He makes 2 new layers of the original picture.
  2. He selects the uppermost layer.
  3. Colours/Inversion of this layer.
  4. Then placing layer mode on Grain Merge. The result is a gray area.
  5. Then Filters/Blur/Gaussian Blur.
  6. Merge with the layer underneath.
  7. Put this layer on layer mode Overlay.
  8. With opacity you are able how much the picture is to be sharpened.

These are quite a few actions and for those who have not understood, I refer to the video created by Mr. Steinort.

But this is what you need to understand. It feels probably counterintuitive that you can sharpen a photo with Blur. That this is possible is the due to the fact that you have made an inversion of the picture at the beginning. In practice, this means that if there is 80% blue in the picture is, that after inversion this is 20%. 20% red becomes 80% red. And 10% green becomes 90 percent green. So you invert the values of the colours in the picture. And this is what you blur.

Paleis Het Loo inverted

Inverted image

Posted in foto, Linux | Leave a comment

Exiv2: exif tool for photos

Many programs give you the ability to view the exif data of a photo. According to Wikipedia is the Exchangeable image file format (officially Exif, according to JEIDA/JEITA/CIPA specifications) a standard that specifies the formats for images, sound, and ancillary tags used by digital cameras (including smartphones), scanners and other systems handling image and sound files recorded by digital cameras. With it you can view with what camera the photo has been made, the shutter speed, the diaphragm etc. etc.

This can be done with most image viewers and photo editing software like Gimp. But it can also be done with the the command line interface (cli) with the command exiv2. Really necessary? No, but on the other hand it gives you more information than most programs.

Posted in foto | Leave a comment

Exiftool

In order to obtain information on the contents of a video file, you can use the exiftool. Like below. Use the command in the terminal, then see the output of this command.

$ exiftool opening_keynote,_what_a_difference_5_years_makes,_the_new_open_world,_jim_zemlin.mkv

ExifTool Version Number : 10.23
File Name : opening_keynote,_what_a_difference_5_years_makes,_the_new_open_world,_jim_zemlin.mkv
Directory : .
File Size : 102 MB
File Modification Date/Time : 2017:04:13 06:02:42+02:00
File Access Date/Time : 2017:05:03 22:02:06+02:00
File Inode Change Date/Time : 2017:05:03 22:01:53+02:00
File Permissions : rw-r--r--
File Type : MKV
File Type Extension : mkv
MIME Type : video/x-matroska
EBML Version : 1
EBML Read Version : 1
Doc Type : matroska
Doc Type Version : 4
Doc Type Read Version : 2
Timecode Scale : 1 ms
Muxing App : Lavf57.25.100
Writing App : Lavf57.25.100
Duration : 0:32:06
Codec ID : V_MPEG4/ISO/AVC
Video Frame Rate : 30
Image Width : 1280
Image Height : 720
Display Width : 1280
Display Height : 720
Track Number : 2
Track Language : eng
Video Codec ID : A_OPUS
Track Type : Audio
Audio Channels : 2
Audio Sample Rate : 48000
Tag Name : DURATION
Tag String : 00:32:06.361000000
Image Size : 1280x720
Megapixels : 0.922
Posted in video | Leave a comment

Extracting part of a video with a One Line Command

It is possible to extract part of a video with a program like OpenShot video editor or Kdenlive. But it is also possible with the command line interface (abbreviated as cli). It is only a small amount of code. This is the code that you have to use:

ffmpeg -ss 00:00:30 -i orginalfile -t 00:44:05 -vcodec copy -acodec copy newfile

In this case, the first 30 seconds of the video will be cut and all that follows after 44:05. If you want the output file in a different format, you will have to replace “copy” by a different format. Don’t forget to give the “newfile” an extension.

By following the link below, you will find more about this:

https://askubuntu.com/questions/59383/extract-part-of-a-video-with-a-one-line-command

Posted in video | Leave a comment

Illustrations from Lynda.com

I make summaries of the courses of Lynda.com. The creators of the courses often use illustrations and diagrams to elucidate their lessons. It is possible to make screenshots of these illustrations and subsequently import them into Word. I choose to recreate these screenshots with Inkscape. The quality of the illustrations is thus guaranteed.

Below is such a recreated illustration. It can be found in the course: Microsoft Dynamics CRM Essential Training.

process of service

Posted in tekening | Leave a comment

Qgis

Qgis (previously called Quantum Gis) is a program which is used to make maps. Much data of scientific institutes is freely available on the internet. By combining these (graphic) data and adding one’s own images, legenda en symbols, one can create new informative maps.
Qgis is in skilled hands a powerful program with which beautiful maps can be formed.

interface

interface

For more information:

Posted in Uncategorized | Leave a comment