gestor (1).pdf

1
developerWorks® ibm.com/developerWorks/ Graphics from the command line Page 4 of 15 Listing 3. Sample output from pnginfo sample.png... Image Width: 640 Image Length: 480 Bitdepth (Bits/Sample): 8 Channels (Samples/Pixel): 3 Pixel depth (Pixel Depth): 24 Colour Type (Photometric Interpretation): RGB Image filter: Single row per byte filter Interlacing: No interlacing Compression Scheme: Deflate method 8, 32k window Resolution: 0, 0 (unit unknown) FillOrder: msb-to-lsb Byte Order: Network (Big Endian) Number of text strings: 0 of 0 I am not aware of equivalent individual tools for other formats such as BMP, GIF, and JPEG. However, ImageMagick comes to the rescue once more, this time with a tool called identify. # identify -verbose sample.png Listing 4. Sample output from identify Image: sample.png Format: PNG (Portable Network Graphics) Geometry: 640x480 Class: DirectClass Type: true color Depth: 8 bits-per-pixel component Colors: 142360 Filesize: 555.6k Interlace: None Background Color: grey100 Border Color: #DFDFDF Matte Color: grey74 Dispose: Undefined Iterations: 0 Compression: Zip signature: 361fe70ae623ef6f1fca44e0d29d157c2d701039fcf0f8625862925d881e13a4 Tainted: False User Time: 0.190u Elapsed Time: 0:01 You can see that identify displays a bunch of useful information about the image file, such as the size of the image in pixels, the color depth of the image, and the image format. pnginfo I'd been a user of libtiff for quite some time when I started using PNG. At the time, there was no tiffinfo equivalent for PNG files, which is why I wrote pnginfo. (You can download pnginfo from the link in Resources). identify also has a -format command-line flag that allows you to specify only the information you want to output. For example, if you were only interested in the image dimensions, you might use a command like this: # identify -format "%wx%h" sample.png

Upload: michael-alfonso

Post on 09-Nov-2015

213 views

Category:

Documents


0 download

TRANSCRIPT

  • developerWorks ibm.com/developerWorks/

    Graphics from the command line Page 4 of 15

    Listing 3. Sample output from pnginfo

    sample.png... Image Width: 640 Image Length: 480 Bitdepth (Bits/Sample): 8 Channels (Samples/Pixel): 3 Pixel depth (Pixel Depth): 24 Colour Type (Photometric Interpretation): RGB Image filter: Single row per byte filter Interlacing: No interlacing Compression Scheme: Deflate method 8, 32k window Resolution: 0, 0 (unit unknown) FillOrder: msb-to-lsb Byte Order: Network (Big Endian) Number of text strings: 0 of 0

    I am not aware of equivalent individual tools for other formats such as BMP, GIF, and JPEG.However, ImageMagick comes to the rescue once more, this time with a tool called identify.

    # identify -verbose sample.png

    Listing 4. Sample output from identify

    Image: sample.png Format: PNG (Portable Network Graphics) Geometry: 640x480 Class: DirectClass Type: true color Depth: 8 bits-per-pixel component Colors: 142360 Filesize: 555.6k Interlace: None Background Color: grey100 Border Color: #DFDFDF Matte Color: grey74 Dispose: Undefined Iterations: 0 Compression: Zip signature: 361fe70ae623ef6f1fca44e0d29d157c2d701039fcf0f8625862925d881e13a4 Tainted: False User Time: 0.190u Elapsed Time: 0:01

    You can see that identify displays a bunch of useful information about the image file, such as thesize of the image in pixels, the color depth of the image, and the image format.

    pnginfo

    I'd been a user of libtiff for quite some time when I started using PNG. At the time, there wasno tiffinfo equivalent for PNG files, which is why I wrote pnginfo. (You can downloadpnginfo from the link in Resources).

    identify also has a -format command-line flag that allows you to specify only the information youwant to output. For example, if you were only interested in the image dimensions, you might use acommand like this:

    # identify -format "%wx%h" sample.png