Find JPEG resolution with PHP

后端 未结 5 899
隐瞒了意图╮
隐瞒了意图╮ 2020-12-28 11:09

Calling all PHP gurus!

I understand that you can use getimagesize() to get the actual pixel height and width of an image in PHP. However, if you open an image in pho

5条回答
  •  鱼传尺愫
    2020-12-28 11:59

    You could just read the JPEG file directly, bytes 14-18 specify:

    • byte 14: 01, X and Y density unit specifier (00: none, pixel ratios, 01: DPI,02: DPC)
    • bytes 15-16: horizontal pixel density,
    • byte 16-18: vertical pixel densit

    Also see: http://www.obrador.com/essentialjpeg/headerinfo.htm

提交回复
热议问题