In bash, how can I count the number of bytes in a bitmap file? (E.g. png)

In bash, I can count the number of bytes in a text file as follows:

cat textfile.txt | wc -c

However, I cannot point the catcontents of a bitmap file (such as PNG) to standard input.

How to count the number of bytes in a bitmap file?

The identifier rather does not take into account the number of bytes used to store it on the disk, since I understand that it can differ between operating systems - Im calculates the number of bytes that will be transmitted if the file was transferred via HTTP (discounting HTTP headers, of course )

+3
source share
1 answer

wc -c yourimg.png , , " cat" .

+8

Source: https://habr.com/ru/post/1773688/


All Articles