Convert jpg to pdf in linux (and vice-versa)

  1. install imageMagick
    sudo apt-get install imagemagick
  2. in the command line:
    1. To convert JPG -> PDF:
      convert input.jpg output.pdf
    2. To merge 2 image files in one pdf:
      convert input_1.jpg input_2.jpg output.pdf
    3. to decrease the quality (and therefore the file size):
      convert input_1.jpg -quality 90 output.pdf
    4. to resize the file:
      convert input_1.jpg -resize 50% output.pdf
    5. to convert PDF -> image (it generates one image per PDF page)
      convert input.pdf output.png

+ info/ source: