Question
· Jan 25, 2018

Cache - How to change Image File Size when saving to Cache Database Table

Hello to all my fellow Cache Developers/Experts: 

My question has to do with how I would go about changing the image file size when loading (saving) an image file (i.e. JPG, BMP, GIF, PNG, etc...) to a Cache Database Table. 

Here is my business scenario: 

  • The user will save various image files (could be different types, such as JPG, PNG, BMP, GIF) to an operating system directory. 
  • Then our application has a background job that monitors the image directory and will load (save) the image into a Cache Database Table into a property of data type %Stream.GlobalBinary. 
  • Then when a client report is created, the image is added to the report. 
    • The image that displays on the report is confined to 2.xxinch by 1.xx inch size on the report. 
    • The actual size of the image files that are saved to the image directory can be very large, such as 44 by 44 inches and can be upwards of 1MB. 

Does anyone know if it is possible to somehow reduce the size of the image when saving to the Cache Database Table?  Or a better solution might be - does anyone know of a way to reduce the size of the image to the required report size (i.e. 2.x in by 1.x in) after the image is retrieved from the database table and before actually adding it to the report?

Much thanks in advance for everyone's time and feedback.

Happy Coding!

Discussion (7)1
Log in or sign up to continue

Hi Dmitry,  Thank you for the quick response/suggestion.  I checked out the imagemagick web site and it appears that the software is primarily used on Windows and has some Linux distributions.  The challenge for me is that my company is using Cache with the VMS 8.4 operating system, so when the user (running Win7/Win10 PC) saves the image files to the image directory, the file is actually being saved to an underlying VMS operating system directory.  And our web application is running on Cache which is installed on VMS (the users interact with the web application via a web browser).   So I am not sure if that software would work.  Do you know if there are any image resize capabilities built into Cache?

Hi Jorge,  Thank you for the response/suggestion.  While the ZEN Report would be an option, our lab application interfaces with a reporting system that generates the report.  Our lab application provides all the report data (including images) to the reporting system.  Since the report has limited real estate for where/how the images are displayed, I was looking for a way to resize the raw images from our lab application image repository when sending the report data and images to the reporting system.   Thanks again for the feedback. 

(sitting here amazed that someone was kind enough to build in VMS support for the open source product - I have found that is VERY rare)

Thank you very much Dmitry for this additional information.  I will discuss options with our internal infrastructure teams to see what the process is for installing the VMS libraries for ImageMagick.  It would be really cool to have those types of image handling libraries for VMS.

Thanks again - You Rock!