Page 1 of 1

Problem with CatchImage and EncodeImage

Posted: Thu May 29, 2014 1:48 pm
by Ausprobieren
Hello together,

I have a problem, to catch an image. I build a loop to see, if it is a time problem.
The Problem is, it hangs on the first loop.
Now my question: Is it a hardware-defect, or other ...
I have the same problem by using
*Puffer = EncodeImage(#Image [, ImagePlugin [, Flags [, Tiefe]]])
My system is win 7 prof.

I thank you for any idea ... :-)

Greetings

Hier is the Code:
----------------------------------------------------------------------------------------------------
#Image=0
Debug #PB_Any
UseJPEGImageEncoder()
Debug FileSize(Datei)
RetCode=0
While RetCode = 0
RetCode=CatchImage(#Image, ?Logo, ?endLogo-?Logo): Debug RetCode
Wend
Debug "Geladen ..."
If IsImage(#Image) = 0
Debug "Image ist nicht geladen ...!"
EndIf
UseJPEGImageEncoder()
While *Puffer = 0
*Puffer=EncodeImage(ImageID(#Image) ,#PB_ImagePlugin_JPEG)
Wend

DataSection
Logo:
IncludeBinary "T:\Temp\Temp.jpg"
endLogo:
EndDataSection
---------------------------------------------------------------------------------------------------

Re: Problem with CatchImage and EncodeImage

Posted: Thu May 29, 2014 2:25 pm
by HeX0R
UseJPEGImageEncoder() <> UseJPEGImageDecoder()

And please use the code-tags of the forum when posting code.
Makes it much more readable.

Re: Problem with CatchImage and EncodeImage

Posted: Thu May 29, 2014 5:28 pm
by netmaestro
*Puffer=EncodeImage(ImageID(#Image) ,#PB_ImagePlugin_JPEG)
Your CatchImage() command will either work or not work. There is nothing to be gained by putting it in a loop in the hope that if it didn't work the first time it might work on the third or fourth try - it won't. All it accomplishes is a hung computer with cpu usage at 100%.