Showing posts with label Imagemagick. Show all posts
Showing posts with label Imagemagick. Show all posts

Monday, October 28, 2013

Debian Wheezy: resize/scale images from command line.

First of all you need to have installed imagemagick.
If no, install it from terminal as root so:

apt-get install imagemagick

Now you are ready to convert input.jpg file into output.jpg file for a 1000 pixels of width and 500 pixels of height....

convert -scale 1000x500 input.jpg output.jpg 

The scale method, in this case, depends of the height and the weight of your image.
So if your image is 2 pixels of width and 1 pixels of height the perform will gone exactly.

Differently the perform will be approximated.

If you want to force the scale performing to make a image of gived dimensions...

convert -scale 1000x500! input.jpg output.jpg

If you have multiple files to convert use this:

for i in $( ls *.JPG); do convert -resize 1300x500 $i $i; done
 
Bye.

Monday, September 12, 2011

Thumbnails creations overview: Imagemagick for pictures form videos

First of all, I need to create thumbnails of various types of document.
Pdf, video, doc, xls...... ecc.....
Pdf:
Ensure to have imagemagick already installed....
In case of not, you give:
 
apt-get install imagemagick

For thumbnail of pdf document you give:
convert -thumbnail 200x200 document.pdf document_preview.png
where 200x200 is the height for width you want to give to the  document_preview.png
In case of more than one pages for pdf document, you can give directly the page you want to obtain the preview image:
convert -thumbnail 200x200 document.pdf[0] document_preview.png

Video(avi):
Install ffmpeg
apt-get install ffmpeg
install ffmpeg.
So give the follow command:
ffmpeg -itsoffset -4 -i xxx.avi -vcodec mjpeg -vframes 1 -an -f rawvideo -s 95x155 yyy.jpg