If you are a developer and looking for a solution to convert web page to image in your desktop program or web application, ACA WebThumb ActiveX may be one of the best choice for you. It help you covnert web page to image With a few function calls, It can be used with many programming languages and popular server side script languages like Visual C++, Visual Basic, Delphi, C#, Java, PHP, ASP, Perl etc..
Some developers may want to convert YouTube video page to image in there applications. However, the YouTube webpage includes the JavaScript and Flash elements. when the webpage document has been completed, the Flash is still loading. If you take screenshot at this time, the video area is black, like following:
* From: http://www.youtube.com/watch?v=4Ifma_3ZB24
How to solve this problem? There is a fuction: SetDelayTime.
void SetDelayTime( long pi_lDelayTime );
pi_lDelayTime
The default delay time value is zero.
Call SetDelayTime() to specify the delay time value for loading the Flash video, in milliseconds. You should call this function before calling StartSnap(). The correct converted image:
Free Trial ACA WebThumb ActiveX Now
JNIEXPORT void JNICALL Java_Snap_Start(JNIEnv *pEnv, jobject, jstring pi_strUrl, jstring pi_strFileName) { CoInitialize(NULL); _bstr_t t_strUrl = pEnv->GetStringUTFChars(pi_strUrl, 0); _bstr_t t_strFileName = pEnv->GetStringUTFChars(pi_strFileName, 0); IThumbMakerPtr HTML_Converter = NULL; HRESULT hr = HTML_Converter.CreateInstance(L"ACAWebThumb.ThumbMaker"); if (SUCCEEDED(hr)) { HTML_Converter->SetURL(t_strUrl); HTML_Converter->SetActiveXEnabled(TRUE); // Enablue ActiveX HTML_Converter->SetJavaEnabled(TRUE); // Enablue Javascript HTML_Converter->SetJScriptEnabled(TRUE); // Enablue Java // Set the delay time value for loading the Flash video, in milliseconds HTML_Converter->SetDelayTime(5000); if ( 0 == HTML_Converter->StartSnap() ) HTML_Converter->SaveImage(t_strFileName); } if (HTML_Converter) HTML_Converter.Release(); CoUninitialize(); }
Note: You can find this Java sample project in the folder {Install-folder}/sample/java/SnapYouTube.java. Launch build_youtube.bat to compile and run it.
<? // This script shows how to convert the YouTube video webpage to a PNG image file using PHP. $WebThumb_Maker = new COM('ACAWebThumb.ThumbMaker') or die("Start ACAWebThumb.ThumbMakerfailed"); $WebThumb_Maker->SetURL("http://www.youtube.com/watch?v=4Ifma_3ZB24"); // Set URL $WebThumb_Maker->SetActiveXEnabled(TRUE); // Enablue ActiveX $WebThumb_Maker->SetJavaEnabled(TRUE); // Enablue Java applet $WebThumb_Maker->SetJScriptEnabled(TRUE); // Enablue Java // Set the delay time value for loading the Flash video, in milliseconds $WebThumb_Maker->SetDelayTime(5000); // Take snapshot successful, save the image as a PNG file. if ( 0 == $WebThumb_Maker->StartSnap() ) $WebThumb_Maker->SaveImage("youtube.png"); ?>
<% ' This ASP script shows how to convert YouTube video page to image. ' Create instance ACAWebThumb.ThumbMaker set WebPage_Snapor = server.createobject("ACAWebThumb.ThumbMaker") WebPage_Snapor.SetURL("http://www.youtube.com/watch?v=4Ifma_3ZB24") ' Set URL WebPage_Snapor.SetActiveXEnabled(True) ' Enablue ActiveX WebPage_Snapor.SetJavaEnabled(True) ' Enablue Java applet WebPage_Snapor.SetJScriptEnabled(True) ' Enablue Java ' Set the delay time value for loading the Flash video, in milliseconds WebPage_Snapor.SetDelayTime(5000) WebPage_Snapor.StartSnap() WebPage_Snapor.SaveImage("youtube.png") ' Save the image with full size %>
// Convert YouTube video page to image in C#(C-Sharp) ThumbMakerClass Thumb_Maker = new ACAWebThumbLib.ThumbMakerClass(); // Create instance Thumb_Maker.SetURL("http://www.youtube.com/watch?v=4Ifma_3ZB24"); // Set URL Thumb_Maker.SetActiveXEnabled(True); // Enablue ActiveX Thumb_Maker.SetJavaEnabled(True); // Enablue Java applet Thumb_Maker.SetJScriptEnabled(True); // Enablue Java // Set the delay time value for loading the Flash video, in milliseconds Thumb_Maker.SetDelayTime(5000); Thumb_Maker.StartSnap(); Thumb_Maker.SaveImage("youtube.png"); // Save the image with full size in C#
# NOTE: # Note: To launch this sample, please install ActivePerl on your Windows: # http://www.activestate.com/Products/ActivePerl # Remark: This script shows how to make a web thumbnail from Youtube video webpage using Perl. use Win32::OLE; $WebPage_Converter = Win32::OLE->new('ACAWebThumb.ThumbMaker'); $WebPage_Converter->SetURL("http://www.youtube.com/watch?v=4Ifma_3ZB24"); # Set URL $WebPage_Converter->SetActiveXEnabled(1); # Enablue ActiveX $WebPage_Converter->SetJavaEnabled(1); # Enablue Java applet $WebPage_Converter->SetJScriptEnabled(1); # Enablue Java # Set the delay time value for loading the Flash video in milliseconds $WebPage_Converter->SetDelayTime(5000); $WebPage_Converter->StartSnap(); $WebPage_Converter->SaveImage("youtube.png");
// Initializes the COM library on the current thread CoInitialize(NULL); HRESULT hr; IThumbMaker * t_xpMaker = NULL; hr = CoCreateInstance( __uuidof(ThumbMaker), NULL, CLSCTX_INPROC_SERVER, __uuidof(IThumbMaker), (void**)&t_xpMaker ); if ( SUCCEEDED(hr) ) { t_xpMaker->SetURL("http://www.youtube.com/watch?v=4Ifma_3ZB24"); // Set URL t_xpMaker->SetActiveXEnabled(TRUE); // Enablue ActiveX t_xpMaker->SetJavaEnabled(TRUE); // Enablue Java applet t_xpMaker->SetJScriptEnabled(TRUE); // Enablue Java // Set the delay time value for loading the Flash video in milliseconds t_xpMaker->SetDelayTime(5000); t_xpMaker->StartSnap(); t_xpMaker->SaveImage( _T("youtube.png") ); t_xpMaker->Release(); } CoUninitialize();
Dim Thumb_Maker As New ACAWebThumbLib.ThumbMaker Thumb_Maker.SetURL ("http://www.youtube.com/watch?v=4Ifma_3ZB24") Thumb_Maker.SetActiveXEnabled(True) // Enablue ActiveX Thumb_Maker.SetJavaEnabled(True) // Enablue Java applet Thumb_Maker.SetJScriptEnabled(True) // Enablue Java // Set the delay time value for loading the Flash video in milliseconds Thumb_Maker.SetDelayTime(True) t_xThumbMaker.StartSnap() t_xThumbMaker.SaveImage("youtube-video.png")
Free Trial ACA WebThumb ActiveX Now