Re: Remove EXIF metadata from photos stored in BLOB in Oracle table

  • From: Kim Berg Hansen <kibeha@xxxxxxxxx>
  • To: Sallie.Cottingham@xxxxxxxxxx
  • Date: Wed, 24 Jul 2019 08:59:48 +0200

Sorry, a slight mismatch in the links I gave...

The first two show how to do it on images in BLOBs using new 12.2 PL/SQL
API.
The third link with other examples are using the "Intermedia" method using
ORDImage object type.

Sorry for the confusion ;-)

Cheerio
/Kim


On Wed, Jul 24, 2019 at 8:51 AM Kim Berg Hansen <kibeha@xxxxxxxxx> wrote:

Hi, Sallie

I haven't tried specifically stripping EXIF metadata, but I have worked
successfully with images in the database using the Intermedia packages.
In 12.2 that's now Multimedia and changed somewhat, but it should still be
possible.
(Just had a thought - if the vendor package for removing EXIF is using
Intermedia, perhaps the upgrade to 12.2 might be the cause of it not
working, as there's been some changes in that area?)


I'm thinking something along the lines of using package function
ORD_IMAGE.GET_METADATA first to extract all of the metadata from the image:

https://docs.oracle.com/en/database/oracle/oracle-database/12.2/aivug/oracle-multimedia-ORD_IMAGE-plsql-package.html#GUID-1C40F7F6-8912-4D97-A767-795C62E28A89

That'll give you XML with all the metadata. Then I'd remove the EXIF part
from the XML, leaving you with a metadata XML without EXIF but with the
rest of the metadata.

And then use ORD_IMAGE.PUT_METADATA to create a new image BLOB where the
metadata is overwritten with your new EXIF-free metadata XML:

https://docs.oracle.com/en/database/oracle/oracle-database/12.2/aivug/oracle-multimedia-ORD_IMAGE-plsql-package.html#GUID-AF2CAD67-D19E-4562-A55E-E8D028E1FAD0

You can also find some more examples of this type of working with metadata
in this doc chapter:

https://docs.oracle.com/en/database/oracle/oracle-database/12.2/imurg/working-with-metadata-in-oracle-multimedia-images.html#GUID-44CDCBB1-6180-4B21-92BD-AE84ECCF44D9


As I said, I haven't tried it - but it ought to be doable ;-)
(It might even be something like the above that the vendor is doing, just
using old Intermedia code?)


Cheerio
/Kim



Regards


Kim Berg Hansen
Senior Consultant at Trivadis
Oracle ACE Director

http://www.kibeha.dk
kibeha@xxxxxxxxx
@kibeha <http://twitter.com/kibeha>



On Tue, Jul 23, 2019 at 5:04 PM Sallie Cottingham <
Sallie.Cottingham@xxxxxxxxxx> wrote:

Hi Everyone –

We are using a vendor application that stores photos uploaded by users in
a BLOB column in an Oracle table.  Some but not all of the images have EXIF
metadata.   This is a property assessments application and the reports are
using Oracle Forms and Reports 10g.   Yes I know all of this is just wrong,
but I’m working with the hand I’ve been dealt….



We recently upgraded our RAC database to Oracle 12.2.  Everything is
going fine, except one of the reports which may include photos.  It is
basically a report for a specific property that has address, location, etc
and sometimes photos.  We have been working with the vendor for many days
right now trying to get this resolved.


The one thing that we have found is that the reports having the issue
have photos that include EXIF metadata.  Knowing that Oracle FRS 10g can’t
handle EXIF, the vendor has a package written that is supposed to convert
the image so that it is readable.  This doesn’t seem to be working but no
one knows why.  We have found that the user can download the offending
image, rename it and then upload it back into the application and it works
just fine.



We have almost 40,000 photos that have EXIF metadata and can’t possibly
go thru one-by-one.  So while we know this isn’t the long term solution we
are thinking that if we can write a script or find a third party tool to
help with this, then we could make our customers happy.



So, have any of you ever had a need to strip EXIF metadata from an image
that is stored as a BLOB in an Oracle table?  Any suggestions would be
helpful!



Thanks!



*Sallie Cottingham, OCP*

Database Administrator

Comptroller of the Treasury

Technology Solutions

425 Fifth Avenue North

Nashville, TN 37243-34001

*sallie.Cottingham@xxxxxxxxxx <sallie.Cottingham@xxxxxxxxxx>*
615-401-7962














Other related posts: