Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jPQFT-0006cV-M8 for pgsql-general@arkaria.postgresql.org; Fri, 17 Apr 2020 12:37:35 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1jPQFS-0006JL-K9 for pgsql-general@arkaria.postgresql.org; Fri, 17 Apr 2020 12:37:34 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jPQFS-0006JE-CA for pgsql-general@lists.postgresql.org; Fri, 17 Apr 2020 12:37:34 +0000 Received: from hermes.gatewaynet.com ([193.92.121.98]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jPQFL-0001gB-L6 for pgsql-general@lists.postgresql.org; Fri, 17 Apr 2020 12:37:34 +0000 Received: from hercules.internal.net (hercules.internal.net [10.9.200.8]) by hermes.gatewaynet.com (8.15.2/8.15.2/Debian-8) with ESMTP id 03HCbPE5031518; Fri, 17 Apr 2020 15:37:25 +0300 Received: from [10.9.251.249] (dcmchgw.internal.net [10.9.0.1]) by hercules.internal.net (Postfix) with ESMTPS id 409B81350B69; Fri, 17 Apr 2020 15:37:23 +0300 (EEST) To: pgsql-general@lists.postgresql.org, itdev@gatewaynet.com From: Achilleas Mantzios Subject: easy way to acquire height / width from images (PNG, JPEG) stored as bytea? Message-ID: <03a79221-6e00-4d8e-c6bc-c01cadb352d9@matrix.gatewaynet.com> Date: Fri, 17 Apr 2020 15:37:22 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.7.0 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US X-Virus-Scanned: clamav-milter 0.101.4 at hermes X-Virus-Status: Clean X-Spam-Status: No, score=1.0 required=5.0 tests=ALL_TRUSTED,DYN_SPAM_SUBJ autolearn=no autolearn_force=no version=3.4.2 X-Spam-Level: * X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on hermes.gatewaynet.com X-Synonym: Copied by Synonym dcm to: itdev@zimbra.gatewaynet, itdev@zimbra.gatewaynet List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Hello Dear List, we have a table holding email attachments as bytea, and we would like to filter out images of small dimensions, which are not of any value to our logic. I took a look at pg_image extension, tested it, and it proved problematic, it killed my 200+ days uptime FreeBSD box :( . I dropped the extension and uninstalled this as soon as fsck finally finished. So I would like to ask you, basically we have PNGs and JPEGs, is there an easy way of parsing their headers and getting info about their dimensions? I could write a C function for that. For PNG it is quite easy but for JPEG it gets a little bit complicated, albeit doable, just asking for something out of the box. Currently we load images (in our java enterprise system) and filter them in Java, but this brings wildfly down to its knees pretty easy and quickly. Thank you and happy Easter.