1. Brett Weaver
  2. PowerBuilder
  3. Wednesday, 25 January 2023 19:36 PM UTC

Hi There

Apologies if I have missed this information but I am trying to incorporate photos and other images in a report which details building inspections. I can store the images in the database and create files from them with appropriate names in the temp directory so that a gallery of pictures can be displayed as part of a report. 

I have a couple of issues:

How do I determine the aspect ratio for a picture or use it to make sure the pictures are not distorted. If I place a picture in the background of a datawindow I can use picture.mode = 3 to do this but picture objects or "Display as Picture" in datawindows do not seem to have the same capability.

The other one is a nice to have:

It would be great if powerbuilder could handle jfif and heic image formats.

Thanks in advance

 

Brett Weaver

 

Brett Weaver Accepted Answer Pending Moderation
  1. Friday, 9 February 2024 08:27 AM UTC
  2. PowerBuilder
  3. # 1

Imagemagick is now my go-to fall all image issues. It provides info, converts, sizes and generally is a wonderful, free tool.

Fantastic!

Comment
  1. Chris Pollach @Appeon
  2. Friday, 9 February 2024 16:45 PM UTC
It's my GoTo as well Brett - LOL!

Also, have a look at it's "kissing cousin" GraphicsMagick ... http://www.graphicsmagick.org

FWIW: I use both! ;-)

HTH

  1. Helpful
There are no comments made yet.
mike S Accepted Answer Pending Moderation
  1. Wednesday, 25 January 2023 21:20 PM UTC
  2. PowerBuilder
  3. # 2

you can use a picture control on a window to load the picture with its' original size. 

Then get the height/width values for your aspect ratio.

 

 

 

Comment
  1. Brett Weaver
  2. Wednesday, 25 January 2023 21:31 PM UTC
Hi Mike,

Thanks for your input.

In a situation where I have control over the size of the element I am displaying the picture in this technique is useful.

Unfortunately I would have to use a function to scale down the actual image to the size of the element (preserving aspect ratio ) I want to display. The picture.mode=3 for background images has this capability for background images but unfortunately not for datawindow elements or datawindow picture objects.

Chris has suggested a potentially viable option with freeware so I am going down that route.
  1. Helpful
There are no comments made yet.
Chris Pollach @Appeon Accepted Answer Pending Moderation
  1. Wednesday, 25 January 2023 20:13 PM UTC
  2. PowerBuilder
  3. # 3

Hi Brett;

  I have done all of this before for Passport Canada applications. ;-)

Q1: jfif and heic image formats (or another weird format too - LOL)

A1: I stored the originally captured images "as is" in a DB BLOB column (VarBinary, Image, Raw, etc based on the DBMS type).

Then I used ImageMagicK to convert the images after doing a SelectBlob command from the DB for the raw image to be reformatted for display (Picture, Ink, InkEdit or DWO) on a format that the PB runtime supports.

Q2: How do I determine the aspect ratio for a picture

A2: I used ImageMagicK to read the image's meta data.

Q3: make sure the pictures are not distorted

A3: I used ImageMagicK to re-scale the images for for proper display based on A2.

You might find these presentations helpful: https://sourceforge.net/projects/stdfndclass/files/Presentations/Imaging

HTH

Regards ... Chris

Comment
  1. Brett Weaver
  2. Wednesday, 25 January 2023 21:04 PM UTC
Looks good Chris! I'll let you know how I get on.
  1. Helpful
  1. Chris Pollach @Appeon
  2. Wednesday, 25 January 2023 21:13 PM UTC
Excellent .. Cheers mate!
  1. Helpful
There are no comments made yet.
  • Page :
  • 1


There are no replies made for this question yet.
However, you are not allowed to reply to this question.