Saturday, June 22, 2013

Converting pdf figure into vectored eps figure!

I used linux "convert" command to convert pdf figures into eps files, but the output figure quality was very bad. Probably its not a vectored eps figure. Therefore, I searched more and found that eps figures created by pdftops are vectored.

To convert file.pdf into file.eps, run the following command in the terminal:

pdftops file.pdf file.eps 

Wednesday, June 12, 2013

How to create vectored eps file from LibreOffice Draw!

While writing papers in Latex, we need to have vectored eps files for good quality figures. LibreOffice Draw does not have any option to save as eps in the "save as" list. However, you can export a figure (or selection to avoid white space around the figure) as eps file.

Following are the steps:
  • Create a new figure or  open existing figure in LibreOffice Draw. You can even open Microsoft Office figures in LibreOffice Draw. 
  • Select the figure you want to save. Most of the times we want to save the whole figure, so we select all (ctrl+A). If you do not select the figure, LibreOffice Draw will store it as a page with unnecessary white space around the figure.
  • Click File->Export; a window will pop-up
  • At the bottom, from "File type", select eps format.
  • Check the "Selection" box.
  • Save at your desired location by clicking on save
*Note: For some figures the LibreOffice may have problem predicting size during exporting. It happened to me with tables without boundary. Try adding boundaries to avoid that. You can select line color white if you do not want the border to be visible.

Wednesday, January 2, 2013

Quick guide for basic usage of git (on bitbucket)

The procedure for routine work on git.

Step 1: Clone the repository on your local machine by running the command given on the bitbucket site.

  • git clone https://mksaini@bitbucket.org/mksaini/test.git


Step 2: At any time, before you start editing the code, update your local repo with latest commits with the following command:

  • git pull origin master


Step 3: Make your changes in the files and commit the changes

  • git commit -m "Committing changes" -a
Step 3.1: In case you have added a new file or folder to the repo, or you want to commit only particular file or folder, you need to specifically add that before running the above mentioned commit command (in that case, the commit command should be run without option "a"):
  • git add file/folder  


Step 4: Push the changes to the remote repo, i.e., reflect the commit in the remote repo:

  • git push -u origin master
The procedure for putting code in a new repo:

Step 1: Create a new repo on bitbucket (it is better to use the same name for the repo your local project folder)

Step 2: Go to you project folder and delete any previously present git files in there
  • rm -rf .git/
Step 3: Initialise git
  • git init
Step 4: Configure it for the remote repository. You can find the command to do that on bitbucket itself. To get that, select you repo, and then select "I am starting from scratch":
  • git remote add origin https://username@bitbucket.org/your_repo.git
Step 5: Add all
  • git add *
Step 6: Commit
  • git commit -m "My first commit"
Step 7: Push the changes to the remote repo (i.e. save on bitbucket)
  • git push -u origin master

Monday, July 23, 2012

Adding existing C++ Makefile project to Ecplise for editing the files!


On linux based systems we generally compile C++ projects with Makefile. The default editors for the source code are gedit or vi/vim. However, these are not so user friendly for editing complex codes.

Therefore, many a times we want to use Eclipse for editing source files and comiple it using a Makefile. It can be done by adding the project to Eclipse in the following steps:

  1. Open Eclipse with its default workspace.
  2. Go to File->New->Makefile Project with Existing Code
  3. Browse to the main folder in which you have your project files
  4. Give appropriate project name. I generally like the name to be the same as the root folder.

Friday, March 23, 2012

How to convert windows figures (generated using PowerPoint, VISIO etc.) to EPS vector file!

Many times we find it more comfortable to draw figures on Windows programs such as VISIO and PowerPoint. The problem with these programs is that they don't have any option to save the drawings as EPS. A generally opted solution by many of us is "SAVE AS .jpg" and then use GIMP to convert to EPS.

THIS IS A VERY BAD APPROACH. 

EPS figures that are generated from jpeg are as bad as jpg, because they are not actually vectored, its just a single vector which does not scale when we zoom-in the images. 

Following are the STEPS that you can take to create proper vectored EPS figure from windows programs:
  1. Choose the "Save As" option and save the drawing in either "Enhanced Metafile (*.emf)" or " "Enhanced Windows Metafile (*.emf)", whichever is available.
    • Please remove PowerPoint (or Windows) specific special effects such as shadows or gradients. They may appear as SOLID BOX in final EPS.
    • To avoid the empty space of the slide around the drawing, group all the contents of the slide, right click, and save as *.emf. This will only save the selected group/objects in the emf file. 
  2. Convert the *.emf file into EPS file using Metafile To EPS Converter"
Please check the final drawing. You may have to do some adjustments sometimes because of compatibility issues. With VISIO it works fine.

Enjoy!
-Mukesh
    

Tuesday, February 7, 2012

Loss-less conversion of the video files to mp4 (libx264) using ffmpeg


ffmpeg -i input.* -vcodec libx264 -qscale 2 -deinterlace output.mp4
*-any format

Thursday, January 19, 2012

How to rotate videos on ubuntu!

Using mencoder:

  • To rotate by 90 degree clockwise
    • mencoder -vf rotate=1 -o output.mp4 -oac pcm -ovc lavc -fps 30 -ofps 30 input.mp4
      • It is important to specify both input and output frame rate (with fps, ofps), else you will get the  error.
  • To flip horizontally
    • mencoder -vf flip -o output.mp4 -oac pcm -ovc lavc -fps 30 -ofps 30  input.mp
Using ffmpeg
  • To rotate the video by 90 degrees, we can use the following command
    • ffmpeg -i input.mp4 -vf "transpose=1" output.mp4
      • "transpose=1" => 90 degree clockwise
      • "transpose=2" => 90 degree anti-clockwise
    • You may get the following error while running the command-"No such filter: 'transpose'". In this case, you should you need to install Libavfilter.
  • To vertically flip the video 
    • ffmpeg -i input.mp4 -vf  vflip output.mp4
  • To horizontally flip the video
    • ffmpeg -i input.mp4 -vf  hflip output.mp4