Pages

Wednesday, January 14, 2015

Fetch a Average Color from an Image

One can fetch a average color from an image using Rmagick with the below snippet.

img =  Magick::Image.read("http://SOME_IMAGE_URL").first
pix = img.scale(1, 1)
avg_color_hex = pix.to_color(pix.pixel_color(0,0)
It will return the Color code(The maximum color used in that image).

Wednesday, January 7, 2015

Screens in Ubuntu

Screen is a terminal multiplexer, which allows a user to access multiple separate terminal sessions inside a single terminal window or remote terminal session. Sometimes you need to run a rake task or something else which keep on producing logs and you want to keep it running even you close your terminal.

1. Install Screen

sudo apt-get install screen screen-profiles screen-profiles-extras

2. Create Screen

screen -S name_of_screen

Run your Task in this screen.

3. Detach Screen

ctlr + a then d