1. Juan Jose Marquez Martin
  2. PowerBuilder
  3. Wednesday, 13 May 2020 15:57 PM UTC

Hi all,

 

I'm developing a couple of user objects that can view with them images / pdf, one of the features that I want to incorporate is rotate the images.

 

No problem with the rotation, I call to the Gdi32.dll and kernel32.dll  API functions actuating directly with blob variables containing the images.

 

But, I need always convert the source image (a TIFF for example) to BMP and this is made throughout the inkPictureObject.save( blob_variable, 0, false ) call and the inverse process with a call inkPictureObject.save( blob_variable, type_of_format, false ), obviously befor I've reset the control and loadPicture with a ok control for each action, as you can see

ip_rotate.visible = true

lb_loaded = ( ip_rotate.resetPicture() = 1 )

IF lb_loaded THEN


ip_rotate.picturesizemode = inkPicAutoSize!
lb_loaded = ( ip_rotate.loadPicture( ablb_image ) = 1 )
width = ip_rotate.width
height = ip_rotate.height
ip_rotate.picturesizemode = inkPicStretched!


END IF

 

IF lb_loaded THEN

// After this statement, lb_loaded takes FALSE value and lblb_result

// hasn't any value

lb_loaded = ( ip_rotate.Save( lblb_result, IMAGE_BMP, false ) = 1 )

END IF

ip_rotate.visible = false

 

Randomly, the save fails, and sometimes a "Not Enough Memory" from the system error notify  occurs, after this, no way to make more save properly.

 

Even, I tried to set the PB_POOL_THRESHOLD from 20K until over 20M in steps, but no positive results, PB_HEAP_DEBUG = true capturating the memory unload (fails on PBSHR170.dll)... but nothing works

 

The object where I do this actions it's created, called and destroyed each time -in the last version of the tests, but on the beginning was on the same object where now the call is made-

 

Some idea how to resolve this?

 

No option to use any OCX or external product, the cause of this problem it's this spec for my project.

 

Thanks a ton in advance for any help.

Juan Jose Marquez Martin Accepted Answer Pending Moderation
  1. Thursday, 28 May 2020 06:56 AM UTC
  2. PowerBuilder
  3. # 1

Finally, I resolve the question traslating the rotation process to an external .exe, I invoke it asynchronously with an exported file from blob and the process replies with an .new file that serve as signal of the correctly ended process for the caller, in this way, the invoked .exe don't produce any problem, a little bit of time it's required, but works firmly, robust and without errors after many calls.

 

Additionally, the .exe generated it's capable to rotate an image file from the command line (with the 8 dll from the RunTime set) as requested

So, no third party OCX or any product, the target was achieved!!!

Comment
There are no comments made yet.
Miguel Leeuwe Accepted Answer Pending Moderation
  1. Saturday, 16 May 2020 14:55 PM UTC
  2. PowerBuilder
  3. # 2

Hi JJ,

To answer your question in one of the comments: "how can I monitorize the memory fine for determinate this? Some function, some product for memory monitor?"

Download Chris Pollach's STD OrderEntry application (2017 R3 version, since I think you are on that version): 

https://sourceforge.net/projects/stdfndclass/files/Applications/PowerBuilder/OrderEntry/Archive/STD_FC_OrderEntry_v2019R2_PB2017R3_B1880_2019-09-30.zip/download

Then search on "isr_memory_status".

Basically it uses an API "GlobalStatusMemoryEx" which needs a structure. I'm sure you can figure out how to get the functionality you need from that code.

regards

Comment
  1. Miguel Leeuwe
  2. Monday, 18 May 2020 14:19 PM UTC
Hi Chris,

I think your framework is great, but when I tried it out, it cost me a lot to get used to the different naming of objects and having to parametrize a lot of things by setting strings in different places.

What would be really helpful is some real documentation on how to setup your application using them. I'm used to pfc's so maybe I'm biased. Maybe it's just a matter of getting used to them.

regards
  1. Helpful
  1. Chris Pollach @Appeon
  2. Tuesday, 19 May 2020 18:47 PM UTC
  1. Helpful
  1. Miguel Leeuwe
  2. Wednesday, 20 May 2020 07:56 AM UTC
Thanks Chris, I remember having watched these and did a small application. I'll watch them again when I have some time.
  1. Helpful
There are no comments made yet.
Olan Knight Accepted Answer Pending Moderation
  1. Saturday, 16 May 2020 14:49 PM UTC
  2. PowerBuilder
  3. # 3

If the issue is that the images are too large, try running them through a compression tool.
I just looked it up, and there are a lot of image compression tools listed online. Mayne one of them would do the job.

Olan

Comment
There are no comments made yet.
Olan Knight Accepted Answer Pending Moderation
  1. Thursday, 14 May 2020 16:43 PM UTC
  2. PowerBuilder
  3. # 4

Juan -

   Have you tried a GarbageCollect() after you delete the objects?

 

Olan

Comment
  1. Juan Jose Marquez Martin
  2. Friday, 15 May 2020 17:01 PM UTC
Hi Olan, as you can see GarabajeCollect and test for object destroy correctly, but doesn't works correctly
  1. Helpful
  1. Miguel Leeuwe
  2. Saturday, 16 May 2020 14:15 PM UTC
I don't think you should do a "DESTROY luo_blob" after having done "CloseUserObject(luo_blob)". It should be destroyed already.
  1. Helpful
  1. Juan Jose Marquez Martin
  2. Monday, 18 May 2020 06:36 AM UTC
Me too, It's one of the desperate method for try making work this...
  1. Helpful
There are no comments made yet.
Chris Pollach @Appeon Accepted Answer Pending Moderation
  1. Wednesday, 13 May 2020 16:37 PM UTC
  2. PowerBuilder
  3. # 5

Hi Juan;

  I have done all of this type of imaging work using ImageMagick. Its free and open source. Are you sure that you're not open to using a 3rd party product?

Regards ... Chris

Comment
  1. Juan Jose Marquez Martin
  2. Thursday, 14 May 2020 06:40 AM UTC
Thanks for your answer, Chris,



Yes, I'm very sure, I'm work for a great multinational corporation that have many policies and restrictions with the catalog of products and they instalation on the company systems, now we have an OCX for this question, but we have a lot of issues with the installation method and the individual restrictions user role based.



Better solution for avoid this it's to program the graphic view actions inside power without any extrernal product.



Thanks a ton anyway for your indications



Juanjo
  1. Helpful
There are no comments made yet.
Armeen Mazda @Appeon Accepted Answer Pending Moderation
  1. Wednesday, 13 May 2020 16:22 PM UTC
  2. PowerBuilder
  3. # 6

It sounds like the image you are trying to convert is too large and you are running out of memory.  32-bit apps are limited to something like 1.6GB of memory.  Try testing with smaller image and see if problem goes away or try compiling your app as 64-bit.

Comment
  1. Juan Jose Marquez Martin
  2. Thursday, 14 May 2020 15:28 PM UTC
So, this is clear, but when many calls with it had made... can be, I don't know, how can I monitorize the memory fine for determinate this? Some function, some product for memory monitor?

  1. Helpful
  1. Armeen Mazda @Appeon
  2. Thursday, 14 May 2020 15:30 PM UTC
One simply thing you could do is just open up the task manager and watch the memory consumption as your app is running up until the point you say that it is failing. https://www.howtogeek.com/405806/windows-task-manager-the-complete-guide/
  1. Helpful
  1. Juan Jose Marquez Martin
  2. Thursday, 14 May 2020 15:32 PM UTC
Oooops, sorry, System Options - Profiling I hope...
  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.