+ Reply to Thread
Results 1 to 4 of 4

Thread: How to detect that a PNG has an alpha channel from command line?

  1. #1
    Member m^2's Avatar
    Join Date
    Sep 2008
    Location
    Kce, PL
    Posts
    1,037

    How to detect that a PNG has an alpha channel from command line?

    The first thing that I tried was Image Magick. Weirdly, it's 'identify' tool always shows that PNGs are 8-bit ones.
    I have a lot of PNGs and want to find the ones with alpha to split the transparency layer out.

  2. #2
    Programmer schnaader's Avatar
    Join Date
    May 2008
    Location
    Hessen, Germany
    Posts
    320
    You could give this one a try (from Stack Overflow):

    Code:
    identify -format '%[channels]' foo.png
    This should print "rgba" if an alpha channel is present, "rgb" else.
    http://schnaader.info
    Damn kids. They're all alike.

  3. #3
    Member m^2's Avatar
    Join Date
    Sep 2008
    Location
    Kce, PL
    Posts
    1,037
    It works, thank you.

  4. #4
    Member caveman's Avatar
    Join Date
    Jul 2009
    Location
    Strasbourg, France
    Posts
    60
    pngcheck displays if a picture is in 32-bits or 24-bits mode the same goes for grey+alpha (16-bits) and gray (8-bits, 4 bits, 2-bits and even 1-bit), for instance:
    OK: xx.png (210x210, 32-bit RGB+alpha, non-interlaced, 71.9%).
    OK: yy.png (559x702, 24-bit RGB, non-interlaced, 38.9%).

+ Reply to Thread

Similar Threads

  1. command-line calculator for Windows?
    By Alexander Ratushnyak in forum Off-Topic
    Replies: 5
    Last Post: 30th January 2012, 01:40
  2. Replies: 35
    Last Post: 20th August 2011, 17:53
  3. UCLC (Ultimate Command Line Compressors) Benchmarks
    By osmanturan in forum Data Compression
    Replies: 1
    Last Post: 26th February 2009, 04:47
  4. a small plea for the command line compression developers
    By SvenBent in forum Data Compression
    Replies: 2
    Last Post: 14th June 2008, 03:51
  5. DARK - a new BWT-based command-line archiver
    By encode in forum Forum Archive
    Replies: 138
    Last Post: 23rd September 2006, 22:42

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts