InfoHeap
Tech
Navigation
  • Home
  • Tutorials
    • CSS tutorials & examples
    • CSS properties
    • Javascript cookbook
    • Linux/Unix Command Line
    • Mac
    • PHP
      • PHP functions online
      • PHP regex
    • WordPress
  • Online Tools
    • Text utilities
    • Online Lint Tools
search

ImageMagick tutorials

  • Install Imagemagick on Mac
  • Install Imagemagick on Ubuntu
  • Create animated gif using Mac preview
  • Create animated gif on command line
  • Edit animated gif speed
  • Find image width and ppi
  • Find image unique colors and bit depth
  • Resize image dimention
  • Compress images
  • Crop image
 
  • Home
  • > Tutorials
  • > Linux/Unix Command Line
  • > ImageMagick

Get image width and ppi using imagemagick identify on command line

By admin on Dec 4, 2015

Imagemagick identify is pretty handy utility to get information about an image. You need to have imagemagick installed on your Mac or Linux for the purpose of this tutorial. Here are some scenarios to get image information:

Print image size (pixels) and PPI

Image size (pixels)

$ identify -format "Pixel Size: %w x %h\n"  img1.png
Pixel Size: 487 x 259

Image PPI (pixels per inch)

$ identify -format "PPI: %x x %y\n"  img1.png
PPI:72 x 72

Note: to find actual image size, you can divide pixel width by width PPI.

Print image width and height in inches

Width in inches

$ identify -format "%w/%x\n" img1.png | bc -l
6.76388888888888888888

Height in inches

$ identify -format "%h/%y\n" img1.png | bc -l
3.59722222222222222222

Suggested posts:

  1. How to compress screenshot images using imagemagick convert
  2. How to check if a user has password on Linux
  3. WordPress mysql query to get all custom keys and values for a post
  4. How to install node.js on Ubuntu Linux
  5. Php look ahead and look behind regex examples
  6. How to edit animated gif speed (FPS) using imagemagick convert
  7. Mac brew – how to relink installed binaries for a package
  8. Bash check if file begins with a string
Share this article: share on facebook share on linkedin tweet this submit to reddit
Posted in Tutorials | Tagged ImageMagick, Linux, Linux/Unix Command Line, Mac, Tutorials, Ubuntu Linux
  • Browse content
  • Article Topics
  • Article archives
  • Contact Us
Popular Topics: Android Development | AngularJS | Apache | AWS and EC2 | Bash shell scripting | Chrome developer tools | Company results | CSS | CSS cookbook | CSS properties | CSS Pseudo Classes | CSS selectors | CSS3 | CSS3 flexbox | Devops | Git | HTML | HTML5 | Java | Javascript | Javascript cookbook | Javascript DOM | jQuery | Kubernetes | Linux | Linux/Unix Command Line | Mac | Mac Command Line | Mysql | Networking | Node.js | Online Tools | PHP | PHP cookbook | PHP Regex | Python | Python array | Python cookbook | SEO | Site Performance | SSH | Ubuntu Linux | Web Development | Webmaster | Wordpress | Wordpress customization | Wordpress How To | Wordpress Mysql Queries | InfoHeap Money

Copyright © 2025 InfoHeap.

Powered by WordPress