Showing posts with label imagemagick. Show all posts
Showing posts with label imagemagick. Show all posts

Sunday 10 November 2013

JPEG To PDF With Imagemagick

ImageMagick is an awesome toolkit with several powerful features for image creation and manipulation. You can use ImageMagick to translate, flip, mirror, rotate, scale, shear and transform images, adjust image colors, apply various special effects, or draw text, lines, polygons, ellipses and Bezier curves. Here, I will show how you can use ImageMagick suite to convert JPEG to PDF quickly.

First make sure imagemagick suite is installed in your system.

Ubuntu/Debian
$ sudo apt-get install imagemagick


CentOS/Fedora
$ sudo yum install imagemagick


Below are some of the examples of using convert which is a part of ImageMagick to convert Jpeg to PDF.

Single Image
$ convert image.jpg image.pdf


Multiple Images
$ convert 1.jpg 2.jpg 3.jpg output.pdf


Resize and Convert
$ convert -resize 80% image.jpg image.pdf


Negate and Convert
$ convert -negate image.jpg image.pdf


You can actually use different available switches to get your output as expected. I usually use PdfTk in conjunction with this technique to work in different scenarios and it really works great. I hope this helps :)


Read more...

Tuesday 21 February 2012

Remove EXIF Data From Pictures Using Linux Terminal [How To]

Exchangeable image file format (Exif) is a standard that specifies the formats for images, sound, and ancillary tags used by digital cameras (including smartphones), scanners and other systems handling image and sound files recorded by digital cameras.



Taken from wikipedia, above information says basically what the EXIF data is. Such EXIF data are usually found in JPEG and TIFF images and much deeper information is given by wikipedia. Now that you understand what EXIF data is, we will now see how we can remove EXIF data.

We like to remove the EXIF data to hide what the picture was build or taken with. For example, a photographer would like to remove the EXIF data after doing some photoshop stuffs on the image so that high-tech people would not find any EXIF presence of photoshop. (This is just an example).

The tool we will be using to remove EXIF data is not other than a part of ImageMagick package, mogrify. So we will use the mogrify command to remove or strip out the EXIF data from the image and then we will see how we can strip EXIF data from multiple files at once.

To strip EXIF from an image, type the following command:

mogrify -strip IMAGE_NAME.JPG

Now, to strip EXIF from folder containing several images, type the following command:

find ~/Desktop/test/ -name '*.jpg' | xargs mogrify -strip

Or use the for loop as below:

for i in ~/Desktop/test/*.JPG; do mogrify -strip $i; done


I hope this helps you. :)


Read more...

Saturday 5 November 2011

Image Resizing Using Linux Command Line

Image resizing is one of those things in linux that should not be done using GUI. Better than GUI, there is a part of ImageMagick package for effective resizing of any image.

For resizing images, you need to have ImageMagick installed in your linux system. ImageMagick is a software suite to create, edit, and compose bitmap images. It can read, convert and write images in a variety of formats (about 100) including GIF, JPEG, JPEG-2000, PNG, PDF, PhotoCD, TIFF, and DPX. You can use ImageMagick to translate, flip, mirror, rotate, scale, shear and transform images, adjust image colors, apply various special effects, or draw text, lines, polygons, ellipses and Bezier curves.

For ubuntu and debian based distros, type the following in console for installation:
sudo apt-get install imagemagick

Now, to resize any image, we can either use mogrify or convert command(these commands are far more complex and useful than just resizing, check man mogrify for more details of their functionalities.) that is part of ImageMagick suite.

For example, to resize an image you can use the following command:

mogrify -resize 50% image_name.jpg

That would reduce the size to 50% of the original size.

To resize to certain pixel, you can specify the expected dimension as below:

mogrify -resize 800x600 image_name.jpg


Read more...