Skip to content

Command Line Helpers

How to write/create a Linux .iso to a bootable USB device using dd command

sudo dd if=/path/to/linux.iso of=/dev/sda bs=1M status=progress

Reference: How to write/create a Ubuntu .iso to a bootable USB device on Linux using dd command

Minify PDF Files

References:

https://hkdb.medium.com/compress-pdf-files-w-linux-the-easy-way-5a8502e8c327

https://www.shellhacks.com/linux-compress-pdf-reduce-pdf-size/

Merge Images into a PDF file (A4)

sudo apt install imagemagick

i=150; convert out0001.png out0002.png -compress jpeg -quality 70 \
      -density ${i}x${i} -units PixelsPerInch \
      -resize $((i*827/100))x$((i*1169/100)) \
      -repage $((i*827/100))x$((i*1169/100)) multipage.pdf

i=150; convert *.jpg -compress jpeg -quality 70 \
      -density ${i}x${i} -units PixelsPerInch \
      -resize $((i*827/100))x$((i*1169/100)) \
      -repage $((i*827/100))x$((i*1169/100)) multipage_$(date +"%Y%m%d_%H%M%S").pdf

i=150; convert *.jpeg -compress jpeg -quality 70 \
      -density ${i}x${i} -units PixelsPerInch \
      -resize $((i*827/100))x$((i*1169/100)) \
      -repage $((i*827/100))x$((i*1169/100)) multipage_$(date +"%Y%m%d_%H%M%S").pdf

Reference: convert images to pdf: How to make PDF Pages same size

Troubleshooting (Merge Images into a PDF file (A4))

convert-im6.q16: attempt to perform an operation not allowed by the security policy `PDF' @ error/constitute.c/IsCoderAuthorized/421.

Reference: imagemagick - convert not allowed [duplicate]

Wine RIOT Window Disappears

# Close wine RIOT through system monitor
# Edit config file
# and change Left value to 0 (zero)
# and save the file
# start RIOT again
gedit "/home/burak/.wine/drive_c/users/burak/Local Settings/Application Data/Riot/Riot.ini"

Wine RIOT config file

Image Optimization via imagemagick (png --> jpg)

# Optimize
convert input.png \
  -sampling-factor 4:2:0 \
  -strip -quality 85 \
  -interlace JPEG -colorspace sRGB \
  output.jpg

# Optimize & Resize
convert input.png \
  -resize 552 \
  -sampling-factor 4:2:0 \
  -strip -quality 85 \
  -interlace JPEG -colorspace sRGB \
  output.jpg

# Determine progressive jpeg
# Interlace: None means not progressive
# Interlace: JPEG means progressive
identify -verbose input.jpg | grep Interlace