Convert

From Notes_Wiki
Revision as of 04:27, 13 November 2012 by Saurabh (talk | contribs) (Created page with "=convert= We can use convert to convert from one image format to another. For example to convert '<tt>test.png</tt>' to '<tt>test.jpg</tt>' we can use: <pre> convert test.png...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

convert

We can use convert to convert from one image format to another. For example to convert 'test.png' to 'test.jpg' we can use:

convert test.png test.jpg

Convert command also supports many options. One can use 'convert -help' to see brief description and supported options. For details we need to use ImageMagick package documentation.



Creating ebook from scanned files

We can create 'pdf' ebook from scanned files with the help of convert which is part of ImageMagick package using following steps:

  1. First all the pages of book can be scanned in 'png' format with image names corresponding to page number like 'page001.png', 'page002.png' and so on.
  2. Edit all 'png' pages and remove the extra part of image which is not useful
  3. Use below command to create pdf which has pages in right order as per image file name
    convert *.png ebook.pdf
  • Note: Use at least 300 dpi during scanning to create a good usable ebook.


Converting train tickets to pdf format

Do not use this technique as tickets created do not have good resolution and are not useful

Using print to file and then pdf format from IRCTC using Mozilla Firefox in Linux leads to corrupted pdf which will print all black color instead of ticket details. One can verify whether pdf is printable or not by opening it in kpdf and using print preview.

To make proper pdf file:

  1. Use 'Print to file' option and choose postscript.
  2. Save file as 'ticket.ps'.
  3. Now use command 'convert ticket.ps ticket.bmp' to convert ticket to bitmap format. This will create two bmp files 'ticket-00.bmp' and 'ticket-1.bmp' containg first and second page of ticket.
  4. Delete file 'ticket-1.bmp'.
  5. Open file 'ticket-0.bmp' with Kolourpaint or GIMP and remove the advertizement. Save the file as 'ticket-0.bmp'. Note that we are using bmp format and not png/jpg etc. and png/jpg are not lossless formats.
  6. Now use 'convert ticket-0.bmp ticket.pdf' to get proper pdf file without ads which can be printed without any problem.