Tuesday, March 31, 2015

Adding alpha (transparent) background to jpeg images, logos

- Some posters, powerpoints, have non-white backgrounds. Company logos with transparency look nicer on these. However, sometimes logos are only available in the jpeg format.

- Tools like GIMP/KolourPaint will easily flood-fill the white as alpha, except for the closed figures like "O,e" letters. This can be done by hand, than the result saved as png with alpha channel.

- However, jpeg images are full of shades of white, so the result can be very messy sometimes.

- Solution: use advanced software such as ImageJ, to change the contrast so any intensity value say, above 250/255, will be brought to 255. Then automatic flood-fill of the other software programs will be a lot more efficient.

Note: as of 03/2015, ImageJ does not natively support the alpha channel, so other paint software is still required to finish the job.

Friday, March 20, 2015

bash merge multiple pdf files

A) Using mutool

apt-get install mupdf-tools
mutool merge [options] file1 [pages] file2 [pages] ...

Options:

-o output
The output filename.
-O options
See mutool create for details on this option. 
 
Source: https://mupdf.com/docs/manual-mutool-merge.html
  

B) Using pdfunite. If needed, install poppler package

example uses:

pdfunite in-1.pdf in-2.pdf in-n.pdf out.pdf
pdfunite *.pdf out.pdf

Src:http://stackoverflow.com/questions/2507766/merge-convert-multiple-pdf-files-into-one-pdf

Friday, March 13, 2015

bibtex medphys aapm enquote error

- when using the custom home-brew style medphys.bst
- after pasting the pre-compiled bibliography
- if the compilation crashes and says, \enqoute() already defined,
- you simply forgot to comment out \bibliographystyle(medphys)

Saturday, March 7, 2015

convert bunch of images to video using ffmpeg

sample code:

avconv -framerate 7 -i img%03d.png -qscale 1 -c:v libx264 -pix_fmt yuv420p out.mp4

-use avconv, cause ffmpeg command is deprecated
-framerate is the desired visual result in fps units, can be a fraction like 1/5
-i is the regexp to retrieve pics
-qscale is quality: 1 for best, 31 for worst
-c:v is the video codec
-pix_fmt is the color space setting, yuv240p is the most portable
NOTE: the order of the arguments is important: some come before -i, some after -i


Src: https://trac.ffmpeg.org/wiki/Create%20a%20video%20slideshow%20from%20images

keywords: video, mpg, mpeg, mp4, movie, film

install ffmpeg video tool

sudo apt-get install ffmpeg

sudo apt-get install libavcodec-extra-53
sudo apt-get install libavcodec-extra57

Src: http://ubuntuforums.org/showthread.php?t=200562
keywords: video, mpg, mpeg, mp4, movie, film 

Tuesday, February 24, 2015

makebst \enquote command error

The makebst program can crete custom commands within .bbl files.
If such a command, like \enquote{} is giving a compilation error,

try to delete the temporary (non-source) files and recompile the .tex

Monday, February 23, 2015

SVN diff

The difference between working copy and HEAD; the changes which would need to be made to what is now in the repository (HEAD), to produce your working copy:
svn diff -r HEAD --old=
Of possible interest, the difference between BASE and HEAD; changes that have been checked into the repository since you last updated working copy:
svn diff -r BASE:HEAD 
And of course the difference between BASE and working copy; the changes you have made since you last updated working copy:
svn diff 

There are three versions being discussed: BASE, working copy, and HEAD.
  • BASE: as last checked out / updated. What working copy would revert to after using svn revert
  • working copy: local modifications to which has been checked out / updated as recently as BASE
  • HEAD: latest modifications in repository. Equivalent to BASE iff no changes have been committed since was checked out / updated as working copy.
 Src: http://stackoverflow.com/questions/3773345/check-diff-against-file-on-the-server