easy way to acquire height / width from images (PNG, JPEG) stored as bytea?

From: Achilleas Mantzios <achill(at)matrix(dot)gatewaynet(dot)com>
To: pgsql-general(at)lists(dot)postgresql(dot)org, itdev(at)gatewaynet(dot)com
Subject: easy way to acquire height / width from images (PNG, JPEG) stored as bytea?
Date: 2020-04-17 12:37:22
Message-ID: 03a79221-6e00-4d8e-c6bc-c01cadb352d9@matrix.gatewaynet.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

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.

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Adam Brusselback 2020-04-17 13:09:09 Re: easy way to acquire height / width from images (PNG, JPEG) stored as bytea?
Previous Message David Rowley 2020-04-17 08:43:55 Re: Is there a script and sample data to test the performance of postgresql?