Problem with CatchImage and EncodeImage

Just starting out? Need help? Post your questions and find answers here.
Ausprobieren
New User
New User
Posts: 6
Joined: Thu May 29, 2014 1:42 pm

Problem with CatchImage and EncodeImage

Post 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
---------------------------------------------------------------------------------------------------
User avatar
HeX0R
Addict
Addict
Posts: 1198
Joined: Mon Sep 20, 2004 7:12 am
Location: Hell

Re: Problem with CatchImage and EncodeImage

Post by HeX0R »

UseJPEGImageEncoder() <> UseJPEGImageDecoder()

And please use the code-tags of the forum when posting code.
Makes it much more readable.
User avatar
netmaestro
PureBasic Bullfrog
PureBasic Bullfrog
Posts: 8451
Joined: Wed Jul 06, 2005 5:42 am
Location: Fort Nelson, BC, Canada

Re: Problem with CatchImage and EncodeImage

Post 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%.
BERESHEIT
Post Reply