Category Archives: bash

Converting Excel workbook to 300dpi high definition publishable tiff (after converting to pdf)

I got really frustrated when trying to convert my charts and excel worksheets into publishable content for my paper. Went through several stack overflow questions and used ghostscript to make it possible.

All softwares used in this post are free — $0. It is ideal for Ph.D students or home use for publishing.

  1. Install ghostscript, using homebrew just run brew install GhostScript and you are good.
  2. Install Gimp. From homebrew all you have to do is: brew install Caskroom/cask/gimp
  3. Open your excel worksheet. Set the page setup to be vertical or horizontal, select your area as print area, and then save as pdf. Make sure you save the workbook as pdf. E.g. now I have saved the workbook to be figure1.pdf
  4. In your command line, type  gs -q -dSafer -dBatch -dNOPAUSE -sDEVICE=tiff32nc -r300 -sOutputFile=figure1.tif figure1.pdf -c quit
  5. Open the figure1.tif in Gimp, select the area you want, and then choose image -> fit canvas to selection
  6. In file->export as simple export the file as figure1.tiff you are all set. If you look at the properties it has 300dpi.

You can easily use bash to do batch processing for pdf files, but for more accurate image selection you still need gimp.

Hope this will help other people!


403 forbidden permission denied (publickey) error etc when pushing files to Github fix.

Tried to push a project onto github and faced sooooooo much annoying errors.
1. Use ssh instead of https
ssh-keygen -t rsa -C ""
2. Press enter all the way until the end.
3. Vi into your public key usually at ~/.ssh/
4. copy all text from public key and put it into your github account settings–ssh keys.
5. push using ssh you should be all set and you should not see any of the errors again.