Hi, will it be possible to configure a button to search for the selected image in Google Lens?
Not https://www.google.com/search?q={file|urlencode}
that it would search for the selected file name in Google. Thanks.
Hi, will it be possible to configure a button to search for the selected image in Google Lens?
Not https://www.google.com/search?q={file|urlencode}
that it would search for the selected file name in Google. Thanks.
Thank you very much @WKen, I had seen this script before, but it depends on the EXE "imgops-windows-amd64.exe", I thought there would be a simpler way to get this result.
Also, the process is a bit slow, even having disabled 2 search engines, I only left Google. The script converts the image before sending it to Web Browser, will that process be required?
You need to generate a link to the image file, or see if Google Chrome has such a command line.
Yes, larger images are not supported, you could look at IrfanView or ImageMagick, I don't know which one will process faster.
"D:\Tools\IrfanView\i_view64.exe" "D:\25330.png" /resize_long=1280 /aspectratio /convert="D:\OutputPic.png" /silent
"D:\Montage\convert.exe" "D:\Montage\Test.png" -resize 500x500 "D:\Output_500x500.png"
So when I upload images directly to Google Lens, the site itself converts the image because I upload large images and it never told me anything regarding the size or type of extension, it's very important to know that, I didn't know. Now I am going to experiment with those proposals of yours to see if the process happens faster, thank you very much.
I installed IrfanView and tried to adapt the code to it as you showed me but I didn't succeed. Could you help me to integrate the code to my image viewer (Imagine), which is also very nice?
The installation path of it would be:
var appPath = "C:\\Program Files (x86)\\Imagine\\Imagine64.exe";
Too slow. . .
var appPath = "C:\\Program Files (x86)\\Imagine\\Imagine64.exe";
var WshShell = new ActiveXObject("WScript.Shell");
var result = WshShell.Run('"' + appPath + '" /resize:(1280,) /save:"D:\\OutputPic.png" "D:\\25330.png"',0,true); // true == wait for process to finish
IrfanView is much faster and can specify the longer side.
var appPath = "D:\\Tools\\IrfanView\\i_view64.exe";
var WshShell = new ActiveXObject("WScript.Shell");
var result = WshShell.Run('"' + appPath + '" "D:\\25330.png" /resize_long=1280 /aspectratio /convert="D:\\OutputPic.png" /silent',0,true); // true == wait for process to finish
Ok, I'll experiment, thanks!
Sorry for asking so much but starting from the following code..., to insert your lines, I have to delete part of the original code, right?
I think the original code is somewhat fragmented and yours is integrated, simpler, easier to understand.
function OnClick(clickData)
{
var appPath = "C:\\Users\\USER\\Downloads\\imgops-windows-amd64\\imgops-windows-amd64.exe"; //Original path
//var appPath = "C:\\Program Files\\IrfanView\\i_view64.exe"; //IrfanView path
var cmd = clickData.func.command;
var source = clickData.func.sourcetab;
var item = "";
if (source.stats.selitems > 1) {
message("Más de una imagen fue seleccionada");
return;
}
item = source.selected(0); //Si una imagen es seleccionada, continuar...
//Funciones
function CallSearch(fullPathtoImage) {
var command = "";
command += '"' + appPath + '" search ';
command += '"' + fullPathtoImage + '"';
command += ' -t ';
command += 'google'; //Motor de búsqueda
cmd.AddLine("@runmode:hide");
cmd.AddLine("@nodeselect");
cmd.AddLine("@sync:" + command);
cmd.Run();
}
function is720(file) {
return file.metadata.image.picheight <= 720
}
//Convertir imagen en PNG
var command = "";
if (is720(item)) { //No redimensionar
command += 'Image CONVERT=png AS=imagen_temporal.png TO "%TEMP%"';
}
else { //Redimensionar
command += 'Image CONVERT=png HEIGHT=720 PRESERVEASPECTRATIO AS=imagen_temporal.png TO "%TEMP%"';
}
cmd.SetModifier("noprogress");
cmd.RunCommand(command);
//Buscar
var newItem = "%TEMP%" + "\\imagen_temporal.png";
CallSearch(newItem);
//Eliminar imagen temporal
if (DOpus.FSUtil.Exists(newItem)) {
var command = "";
command += 'Delete ';
command += '"' + newItem + '"';
command += " QUIET";
cmd.SetModifier("noprogress");
cmd.RunCommand(command);
}
}
It took a long time to generate the link. imgops-windows-amd64.exe
function OnClick(clickData)
{
var appPath = "C:\\Users\\USER\\Downloads\\imgops-windows-amd64\\imgops-windows-amd64.exe"; //Original path
var irfanView = "D:\\Tools\\IrfanView\\i_view64.exe";
var cmd = clickData.func.command;
var source = clickData.func.sourcetab;
var item = "";
if (source.stats.selitems > 1) {
message("Too many files selected");
return;
}
// one image file is selected (due to modifer in button), continue...
item = source.selected(0);
// *************************************** FUNCTIONS ***************************************
function CallSearch(fullPathtoImage) {
var command = "";
command += '"' + appPath + '" search ';
command += '"' + fullPathtoImage + '"';
command += ' -t ';
// command += 'yandex,google,bing,tineye';
command += 'yandex,google,bing';
cmd.AddLine("@runmode:hide");
cmd.AddLine("@nodeselect");
cmd.AddLine("@sync:" + command);
cmd.Run();
}
function is720(file) {
return file.metadata.image.picheight <= 720
}
// *************************************** CONVERT TO PNG ***************************************
var command = "";
var WshShell = new ActiveXObject("WScript.Shell");
if (is720(item)) { // no resize
var result = WshShell.Run('"' + irfanView + '" "' + item + '" /convert="' + '%TEMP%' + '\\_temp_Directory_Opus_Image_Search.png" /silent',0,true); // true == wait for process to finish
//command += 'Image CONVERT=png AS=_temp_Directory_Opus_Image_Search.png TO "%TEMP%"';
}
else { // resize
var result = WshShell.Run('"' + irfanView + '" "' + item + '" /resize_long=1280 /aspectratio /convert="' + '%TEMP%' + '\\_temp_Directory_Opus_Image_Search.png" /silent',0,true); // true == wait for process to finish
//command += 'Image CONVERT=png HEIGHT=720 PRESERVEASPECTRATIO AS=_temp_Directory_Opus_Image_Search.png TO "%TEMP%"';
}
//cmd.SetModifier("noprogress");
//cmd.RunCommand(command);
// ************************* NEW ITEM _temp_Directory_Opus_Image_Search.png *********************
var newItem = "%TEMP%" + "\\_temp_Directory_Opus_Image_Search.png";
// *************************************** SEARCH ***********************************************
CallSearch(newItem);
// *************************************** DELETE TEMP IMAGE ************************************
if (DOpus.FSUtil.Exists(newItem)) {
var command = "";
command += 'Delete ';
command += '"' + newItem + '"';
command += " QUIET";
cmd.SetModifier("noprogress");
cmd.RunCommand(command);
}
// *************************************** HOISTED FUNCTIONS ***************************************
function message(txt) {
var lister = DOpus.Listers;
var dlg = clickData.func.Dlg;
dlg.window = lister.lastactive;
dlg.message = txt;
dlg.title = "";
dlg.buttons = "OK";
dlg.Show;
}
} // *************************************** END OnClick() ***************************************
Right, imgops-windows-amd64.exe
takes a long time, so I'm wanting to replace it completely with IrfanView
but I don't know. Your new code is giving an error on line 41
var result = WshShell.Run('"' + irfanView + '" "' + item + '" /resize_long=1280 /aspectratio /convert="' + '%TEMP%' + '\\_temp_Directory_Opus_Image_Search.png" /silent',0,true); // true == wait for process to finish
I wanted to ask you what " HOISTED FUNCTIONS" is for? I had removed it in the code I was adapting.
If you google the term, there are countless pages explaining it in detail.
Thanks Leo, I'm going to search Google, I thought they were Opus terms and since I didn't find anything related in the manual, I asked
Since different configurations of the original code were giving problems, I decided to keep it as simple as possible. The code that I will show below works well, but with the same delay as the previous attempts. I would like to help me with two questions:
Why in this code do I need the application "imgops-windows-amd64.exe" if I am not already converting the image, and if I need to convert it, why is it not possible to do it with Opus's own internal viewer?
Thinking that an external application is always necessary, why does the code work with "imgops-windows-amd64.exe" and not with "IrfanView\i_view64.exe"?
Thank you so much.
function OnClick(clickData) {
var appPath = "C:\\Users\\USER\\Downloads\\imgops-windows-amd64.exe";
var cmd = clickData.func.command;
var source = clickData.func.sourcetab;
var item = "";
item = source.selected(0);
function CallSearch(fullPathtoImage) {
var command = "";
command += '"' + appPath + '" search ';
command += '"' + fullPathtoImage + '"';
command += ' -t ';
command += 'google';
cmd.AddLine("@runmode:hide");
cmd.AddLine("@nodeselect");
cmd.AddLine("@sync:" + command);
cmd.Run();
}
CallSearch(item);
}
imgops-windows-amd64.exe
is only responsible for generating links. If the picture is too large, it will not be supported. You can use any program to convert larger pictures. The default code uses internal command to convert.
Good, now I am understanding things, it is impossible to solve any problem without first understanding it. I thought that "imgops-windows-amd64.exe" was responsible for the image conversion, although I found it very strange, because the commands used in the conversion were those of Opus (Image CONVERT=png).
And regarding the resolution of the images, with the last code I posted, which does not check the size of the images, I am managing to upload images up to 4032 x 2268 pixels. Could it be that Google Lens is now accepting all image sizes?
Some search engines limit the image size, such as Imgops is limited to 5MB.
Then in my case I can keep the unflifified code because I will always use Google. Let me ask you one last question, and sorry to bother you so much, can these lines be concatenated into one or do they have to stay separate to work?
command += '"' + appPath + '" search ';
command += '"' + fullPathtoImage + '"';
command += ' -t ';
command += 'google';