0
\$\begingroup\$

I'd like to be able to determine the size of a an image with a particular resolution/ppi for JPEG & PNG formats.

Are there any online tools to do this?

\$\endgroup\$
2
  • \$\begingroup\$ To clarify, do you mean file size or dimensions? \$\endgroup\$ Commented Jul 1, 2011 at 9:18
  • 1
    \$\begingroup\$ Sorry, just to make this completely clear, but: file size in megabytes on disk, from just the parameters you've listed? Because the program suggested in the answer you've marked as accepted doesn't actually do what you're asking — it's just showing the actual size of a given file, which of course you can get from any file manager. \$\endgroup\$
    – mattdm
    Commented Jul 1, 2011 at 13:12

2 Answers 2

3
\$\begingroup\$

If I get you right, you want to predict an images (JPEG and PNG) file size before your take the picture.

In short: I do not think that this is doable, without actually taking the picture. Here's why:

PPI: First DPI / PPI does not apply to a digitally stored image. Take an arbitrary image change the dpi without recalculation of the image so the pixels in length and width are equal and produce a 7, 72, 96, 960 dpi jpeg version. All will have the same file size (and also be displayed the same size at 100%). PPI information is only used when printed, for example.

Resolution: Yes, the resolution (y-pixel - x-pixel) of the sensor can be taken into calculation precisely.

JPEG / PNG - Type: Both of these formats (types) will compress the data the sensor provides by using compression algorithms. Hence the compression rate, that finally will define the file size, depends on the data which you only know if you take the picture.

If you would take the color depth (bits per pixel) into account and shoot in uncompressed RAW, a forecast of the files size could be calculated I guess. However, since the RAW file will contain all meta data (camera settings and so on) too, you'll end up with an estimation again.

\$\endgroup\$
6
  • 2
    \$\begingroup\$ Good answer, el_migu_el. I'll just add that of all the compression tricks (and there are a few in jpeg), the one that prohibits the prediction of the size is the lossless compression. The compression ratio of the lossy compression phase is determined by the quality parameter. \$\endgroup\$
    – ysap
    Commented Jul 1, 2011 at 13:13
  • \$\begingroup\$ @ysap: did you mean lossy when you say lossless there? (Both will result in hard-to-predict final sizes, but I'm unclear on how to read what you're saying. Hmmmm. That's going on a lot this morning — maybe it's me, and I just haven't had enough coffee.....) \$\endgroup\$
    – mattdm
    Commented Jul 1, 2011 at 14:36
  • \$\begingroup\$ @mattdm - as of lossless, I think that it is clear why it is hard to predict (if not, let me know). As of the lossy part - the reduction in size is predetermined by the decimation and quantization of the DCT coefficients in the macroblocks. The amount is determined by the quality parameter and it is up to the implementation to decide how much to lose. \$\endgroup\$
    – ysap
    Commented Jul 1, 2011 at 14:39
  • \$\begingroup\$ For those unfamiliar with the details of JPEG: this compression consists of two phases. The first one includes conversion of macroblocks (8x8 pixels) to freq. domain via DCT. Then, the high frequency components are being discarded or quantized to lower bit width. This is the lossy part and is pre-determined. The second phase includes reordering of the DCT coefficients, RLE compression and Enthropy coding (Huffman) compression. This is lossless compression, but the ratio is unknown until the end of the process. \$\endgroup\$
    – ysap
    Commented Jul 1, 2011 at 14:53
  • \$\begingroup\$ Oh, okay, I got it now. It was the coffee. :) \$\endgroup\$
    – mattdm
    Commented Jul 1, 2011 at 15:06
-2
\$\begingroup\$

if you want to get the printed image size based on the resolution, then it is possible to do it simply in free IrfanView image browser, where you can calculate the printed size based on the DPI.

Irfanview picture size-dpi

\$\endgroup\$
4
  • 1
    \$\begingroup\$ But you don't really need a special tool to do division.... \$\endgroup\$
    – mattdm
    Commented Jul 1, 2011 at 13:02
  • \$\begingroup\$ @mattdm - that's below the belt... :O \$\endgroup\$
    – ysap
    Commented Jul 1, 2011 at 13:14
  • \$\begingroup\$ mattdm, OK, but it very useful to have such feature directly in browser, as math never was my favorite subject. \$\endgroup\$
    – Juhele
    Commented Jul 1, 2011 at 13:18
  • \$\begingroup\$ Well, beyond that, the value given is computed from the meaningless DPI value, which really is not very useful. \$\endgroup\$
    – mattdm
    Commented Jul 1, 2011 at 13:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.