In many situations developers need to show the thumbnail images which are stored in the database. But they can’t do it like streaming the original image and resize it with applying CSS. It will cost lot of data and memory consumption. For the solution of that we are using thumbor.
Thumbor is a smart imaging service which provide cropping, resizing and flipping of images. It uses more advanced algorithms to detect the image parts to better cropping and resizing.
PrerequisiteThe stable version of thumbor is associate with the
Python Package Index. So that python needed to be installed before thumbor.For installing python first you have to get compressed file of python to your server.
wget https://www.python.org/ftp/python/3.4.3/Python-3.4.3.tgzThen decompress the file by using
tar xvzf Python-3.4.3.tgzNow the python can be installed by going to the directory and using following commands.
cd Python-3.4.3./configure --prefix=$HOME/.local make make install
Installation of thumborIf you want thumbor to resize the image within the safe environment simply you can install it in your own server using following command
pip install thumborThe thumbor service can be run just by typing
thumborFor constant running of thumbor use
nohup thumbor &
Resize imageAfter the successful installation of the thumbor the image can be edited just by using the server url, port and the image url. For example
(replace 127.0.0.1 with server ip address)
By default the thumbor running in the port 8888.The 150×150 tells the thumbor that height and width of the image should be 150.And finally the url of the image.The thumbor will resize and will returns the image with given height and width.
Change background color
The thumbor can change the background color of the image just by giving the filters along with the url.
Change RGB value
The image rgb value can be changed by providing the values with the url
The thumbor can do more like change the image brightness, contrast, blur the image and a lot. For detail reference about thumbor please visit here.