Windows thumbnails for folders?

Features wanted...
Norn
Posts: 416
Joined: 24 Oct 2021 16:10

Windows thumbnails for folders?

Post by Norn »

When the folder has 2 or more images,show more thumbnails?but a new option must be added...
Attachments
W2.png
W2.png (26.51 KiB) Viewed 1959 times
Win10, Win11 @100% 2560x1440 22H2

admin
Site Admin
Posts: 60357
Joined: 22 May 2004 16:48
Location: Win8.1 @100%, Win10 @100%
Contact:

Re: Windows thumbnails for folders?

Post by admin »

Not sure what you mean. But I guess you found the answer in the meantime anyway.

Norn
Posts: 416
Joined: 24 Oct 2021 16:10

Re: Windows thumbnails for folders?

Post by Norn »

:arrow:
Attachments
Folder thumbnails.png
Folder thumbnails.png (674.47 KiB) Viewed 1817 times
Win10, Win11 @100% 2560x1440 22H2

admin
Site Admin
Posts: 60357
Joined: 22 May 2004 16:48
Location: Win8.1 @100%, Win10 @100%
Contact:

Re: Windows thumbnails for folders?

Post by admin »

Would you mind using language to get your point across?

Norn
Posts: 416
Joined: 24 Oct 2021 16:10

Re: Windows thumbnails for folders?

Post by Norn »

This is a folder that shows four thumbnails of the images,I don't really need it,but it would be nice to have it. :whistle:
Win10, Win11 @100% 2560x1440 22H2

admin
Site Admin
Posts: 60357
Joined: 22 May 2004 16:48
Location: Win8.1 @100%, Win10 @100%
Contact:

Re: Windows thumbnails for folders?

Post by admin »

Tick Configuration | Preview | Thumbnails | Show folder thumbnails... :whistle:

Norn
Posts: 416
Joined: 24 Oct 2021 16:10

Re: Windows thumbnails for folders?

Post by Norn »

I've already ticked it,currently, only one thumbnail image is displayed per folder, I mean each folder shows four thumbnails...
Win10, Win11 @100% 2560x1440 22H2

klownboy
Posts: 4109
Joined: 28 Feb 2012 19:27

Re: Windows thumbnails for folders?

Post by klownboy »

Don, I'm guessing, but I believe Norn is referring to a montage or collage of the pictures in the folder which would be shown as the folder's thumbnail. There are scripts around that will take a number of random pictures within the folder and create a "folder.jpg" file which would then be shown as the folder's thumbnail. The ones I've seen use "montage.exe" that's part of the "ImageMagick" graphics program. It sounds like it would be far beyond what you'd expect from a file manager. I'll see if I can find the old script and see if it still works.
Windows 11, 22H2 Build 22621.1555 at 100% 2560x1440

admin
Site Admin
Posts: 60357
Joined: 22 May 2004 16:48
Location: Win8.1 @100%, Win10 @100%
Contact:

Re: Windows thumbnails for folders?

Post by admin »

Yes, I agree. 1) That this is the wish, 2) that it is beyond what I want to do.

Norn
Posts: 416
Joined: 24 Oct 2021 16:10

Re: Windows thumbnails for folders?

Post by Norn »

XY is also a powerful image browser for me. I also agree that is not what a file manager needs to do.
Win10, Win11 @100% 2560x1440 22H2

klownboy
Posts: 4109
Joined: 28 Feb 2012 19:27

Re: Windows thumbnails for folders?

Post by klownboy »

Hi Norn, I went back to the drawing board to look at some old scripts that generate folder thumbnails (folder.jpg), one of them mine here viewtopic.php?f=7&t=12843 and another by serendipity here https://www.xyplorer.com/xyfc/viewtopic.php?f=7&t=3532 . I did some modifications and updates and kept the images to 4 for the folder thumbnail as in your post. Personnally I think more than that is a bit confusing and hard to focus on.

The script uses XYporer to do the heavy lifting - generate the pictures, and depending on the menu option, IM and IrfanView are strickly used to build the montage. So to use it you will need "montage.exe" installed - part of IM. There's a portable - no installation version - no registry entries are made see comments in script. The last menu item uses Irfanview in lieu of ImageMagick. It's definitely faster than IM, but IM has countless options to explore. Irfanview is also free and popular and is easily obtained https://www.irfanview.com.

Once you have those execs, you'll have to point XY in the right direction and provide your paths in the begining of the script.

I used a little padding between the individual images but you can easily remove that.

Code: Select all

"_Initialize";
	global $cur_folder, $montage_exe, $irfanview_exe;
	$montage_exe = "D:\Graphics\ImageMagick\montage.exe";
	$irfanview_exe = "D:\Graphics\IrfanView64\i_view64.exe";
// Montage.exe is part of the ImageMagick package (free) which can be obtained at http://www.imagemagick.org/script/binary-releases.php#windows
// Look for "portable" Windows binary packages (zip) on left side. You can download the no install package where no registry entries are made
// IrfanView is also free to use https://www.irfanview.com
// Change the paths above to reflect your montage.exe and/or IrfanView location. 

	if(exists(<curitem>) == 2) {$cur_folder = <curitem>;} else {$cur_folder = <curpath>;}
	if(substr($cur_folder, -1) != "\") {$cur_folder = $cur_folder . "\";}

"  ●  Zoomed View Folder Montage [random images current folder]|:viewthumbs";
	global $cur_folder, $folder_name, $view, $cur_view, $geometry, $tile, $montage_exe;
	goto $cur_folder;
	sub "_ViewData";
	sub "_Montage";
	run """$montage_exe"" @filelist.txt -geometry $geometry-1-1 -auto-orient -tile $tile $folder_name folder.jpg", , 2,0;

	delete 0, 0, $cur_folder . "filelist.txt";
	delete 0, 0, $cur_folder . "p_i_c_*";
	#1001;
	sub "_ViewPic";
//		attrstamp("h", 1, $cur_folder . "folder.jpg");   //if you'd rather not hide the folder montage comment out this line
	sub "_Finish_it"; end 1;

"  ●  Polaroid View Folder Montage [random images current folder]|:viewthumbs";
	global $cur_folder, $folder_name, $view, $cur_view, $geometry, $tile, $montage_exe;
	goto $cur_folder;
	sub "_ViewData";
	sub "_Montage";
	run """$montage_exe"" @filelist.txt -geometry $geometry-1-1 -auto-orient +polaroid -background grey70 -tile $tile -font Tahoma -pointsize 26 -title $folder_name folder.jpg", , 2,0;
	delete 0, 0, $cur_folder . "filelist.txt";
	delete 0, 0, $cur_folder . "p_i_c_*";
	#1001;
	sub "_ViewPic";
//		attrstamp("h", 1, $cur_folder . "folder.jpg");   //if you'd rather not hide the folder montage comment out this line
	sub "_Finish_it"; end 1;

"  ●  Folder Montage [random images current folder and subs]|:refresh";
	global $cur_folder, $view, $cur_view, $geometry, $tile, $thumbsize_X, $thumbsize_Y, $montage_exe, $paths;
	if(strlen($cur_folder) < 4) {$root_warning = 1;}
	if($root_warning == "1") {end confirm("You are in the root directory.  Are you sure you want to create folder thumbnails for the entire drive?") == 0, "Good choice, bye!";}
	sub "_ViewData";

		$paths = $cur_folder . <crlf> . (folderreport("dirs", "r", $cur_folder, "r", , <crlf>));
		foreach ($ea_path, $paths, <crlf>, "e") {
			if (substr($ea_path, -1) != "\") {
				$ea_path = $ea_path . "\";
			}
			goto $ea_path;   // experienced issues using a path with filelist.txt within the montage cmd line, so moving into each folder
			if(exists($ea_path . "folder.jpg")) {
				attrstamp("h", 4, $ea_path . "folder.jpg");
				delete 0, 0, $ea_path . "folder.jpg";
			}
			$image_list = formatlist(folderreport("files", "r", "$ea_path", , , <crlf>), "f", <crlf>, "*.jpeg<crlf>*.jpg<crlf>*.bmp<crlf>*.png<crlf>*.mp4<crlf>*.mov<crlf>*.wmv<crlf>*.avi");
			$i = gettoken($image_list, "count", <crlf>);
			if ($i >= "4") {$count = 4; $geometry = "720x720"; $tile = "2x2";}
			elseif ($i < "4") {
				$continue = confirm("This folder [$ea_path] does not contain enough image files to make a proper folder montage.<crlf 2>" .   quote("Yes") . "  to contnue with script [since other sub folders may contain images], or<crlf 2>" .   quote("No") . " to exit script now.", <crlf>,1,4);
					if($continue=="1"){continue;}
					elseif($continue=="0"){end 1;}
			}

			$random_images = GetToken(formatlist($image_list, 'x', <crlf>), $count, <crlf>,, 1);     //randomize the no of images "$count" in $image_list
			$i = 1;
			$final_images = "";
			foreach($image, $random_images, <crlf>, "e") {
				savethumb($image, "p_i_c_$i.jpg", $thumbsize_X,, "jpg100", "5", 2);   //border of "5"
//				savethumb($image, "p_i_c_$i.jpg", $thumbsize_X,, "jpg100", , 2);   //no border
				$final_images .= "p_i_c_$i.jpg" . <crlf>;
				$i++;
			}

			$final_images = trim(regexreplace($final_images, "^(.*\\)(.*?$)", "'$2'"),<crlf>, "r");

			writefile("filelist.txt", $final_images);
			$folder_name = quote(getpathcomponent($ea_path, "component", -1));
			run """$montage_exe"" @filelist.txt -geometry $geometry-1-1 -auto-orient -tile $tile $folder_name folder.jpg", , 2,0;
			delete 0, 0, $ea_path . "filelist.txt";
			delete 0, 0, $ea_path . "p_i_c_*";
			sub "_ViewPic";
			attrstamp("h", 1, $ea_path . "folder.jpg");      //if you'd rather not hide the folder montage comment out this line
		}
	sub "_Finish_it";
"-"
"  ●  Zoomed View Montage IrfanView [random images current folder]|:viewthumbs";
	global $cur_folder, $irfanview_exe;
	goto $cur_folder;
	sub "_ViewData";
	sub "_Montage";

	$pic1 = $cur_folder . "p_i_c_1.jpg";
	$pic2 = $cur_folder . "p_i_c_2.jpg";
	$pic3 = $cur_folder . "p_i_c_3.jpg";
	$pic4 = $cur_folder . "p_i_c_4.jpg";
	$panorama1 = $cur_folder . "panorama1.jpg";
	$panorama2 = $cur_folder . "panorama2.jpg";
	$panorama_complete = $cur_folder . "folder.jpg";

	run """$irfanview_exe"" /jpgq=100 /panorama=(1,$pic1,$pic2) /convert $panorama1 /silent",,2,0;
	run """$irfanview_exe"" /jpgq=100 /panorama=(1,$pic3,$pic4) /convert $panorama2 /silent",,2,0;
	run """$irfanview_exe"" /jpgq=100 /panorama=(2,$panorama1,$panorama2) /convert $panorama_complete /silent",,2,0;

	delete 0, 0, "$pic1|$pic2|$pic3|$pic4|$panorama1|$panorama2";

	#1001;
	sub "_ViewPic";
//   attrstamp("h", 1, $cur_folder . "folder.jpg");   //if you'd rather not hide the folder montage comment out this line
	sub "_Finish_it"; end 1;

"_Montage";
	global $cur_folder, $folder_name, $cur_view, $view, $geometry, $tile, $thumbsize_X, $thumbsize_Y;
	if("|1|4|5|6|8|9|" UnLikeI "*|$view|*") {
		msg "Present view [$cur_view] is not a thumbnail or tile viewing mode."; end 1;   // You should have a FVS/tab setting in thumbnail mode
	}
	if(exists($cur_folder . "folder.jpg")) {
		attrstamp("h", 4, $cur_folder . "folder.jpg");
		delete 0, 0, $cur_folder . "folder*.jpg";
	}
		$image_list = formatlist(folderreport("files", "r", $cur_folder, , , <crlf>), "f", <crlf>, "*.jpeg<crlf>*.jpg<crlf>*.bmp<crlf>*.png<crlf>*.mp4<crlf>*.mov<crlf>*.wmv<crlf>*.avi");
		$i = gettoken($image_list, "count", <crlf>);

		if ($i >= "4") {
			$count = 4; $geometry = "720x720"; $tile = "2x2";}
		elseif ($i < "4") {
			msg "This Folder [$cur_folder] does not contain enough image files to make a proper folder montage.";end 1;}

		$random_images = GetToken(formatlist($image_list, 'x', <crlf>), $count, <crlf>,, 1);     //randomize the no of images "$count" in $image_list
		$i = 1;
		$final_images = "";
		foreach($image, $random_images, <crlf>, "e") {
			if (substr(gettoken(caller("caption"), 2, "●", "t"),2, 8) LikeI "Polaroid") {
				savethumb($image, "p_i_c_$i.jpg", $thumbsize_X,, "jpg100",, 2);}
			elseif (substr(gettoken(caller("caption"), 1, "[", "t"), -9,) LikeI "IrfanView") {
				savethumb($image, "p_i_c_$i.jpg", $thumbsize_X,, "jpg100","2" , 2);}   //for Irfanview adjust border value "2" in this case to suit 
			else {
				savethumb($image, "p_i_c_$i.jpg", $thumbsize_X,, "jpg100","4" , 2);}   //for IM adjust border value "4" in this case to suit
			$final_images .= "p_i_c_$i.jpg" . <crlf>;
			$i++;
		}
		$final_images = trim(regexreplace($final_images, "^(.*\\)(.*?$)", "'$2'"),<crlf>, "r");

		if !(substr(gettoken(caller("caption"), 1, "[", "t"), -9,) LikeI "IrfanView") {
			writefile($cur_folder . "filelist.txt", $final_images);
		}
		$folder_name = quote(getpathcomponent($cur_folder, "component", -1));

"_ViewData";
	global $view, $cur_view, $thumbsize_X, $thumbsize_Y, $thumbsize, $multiple;

		if !(substr(gettoken(caller("caption"), 1, "[", "t"), -9,) LikeI "IrfanView") {
			$multiple = "6";}   //multiplication factor of thumbnail size you can change this if you like even make it "2"
		else {
			$multiple = "3";}

	$T_sm = getkey("Width", "Thumbs") . "x" . getkey("Height", "Thumbs");
	$T_med = getkey("Width1", "Thumbs") . "x" . getkey("Height1", "Thumbs");
	$T_lg = getkey("Width2", "Thumbs") . "x" . getkey("Height2", "Thumbs");
	$Tile_sm = getkey("TilesSmallSize", "Thumbs") . "x" . getkey("TilesSmallSize", "Thumbs");
	$Tile_lg = getkey("TilesLargeSize", "Thumbs") . "x" . getkey("TilesLargeSize", "Thumbs");
	$T_Det = $T_sm; $T_Det_cap = "Details with Thumbnails #1" . " ($T_sm)";

   $views = <<<VIEWS
0|Details
1|Details with Thumbnails #1 ($T_sm)
2|List
3|Small Icons
4|Thumbnails #1 ($T_sm)
5|Thumbnails #2 ($T_med)
6|Thumbnails #3 ($T_lg)
7|Large Icons
8|Small Tiles ($Tile_sm)
9|Large Tiles ($Tile_lg)
VIEWS;

	$view = Get('View');
	$viewdata = FormatList($views, 'f', "<crlf>", $view . '|*');     // Get current view data line. 
	$cur_view = GetToken($viewdata, 2, '|', 't', 2);
	$thumbsize = gettoken(gettoken($cur_view, "1", ")", "t"), "2","(", "t");
	$thumbsize_X = gettoken($thumbsize, "1", "x", "t");$thumbsize_X = $thumbsize_X * $multiple;
	$thumbsize_Y = gettoken($thumbsize, "2", "x", "t");$thumbsize_Y = $thumbsize_Y * $multiple;

"_ViewPic";
	global $cur_folder, $ea_path;
	if (gettokenindex("subs]", caller("caption"), " ", "c") == "1") {$montage_folder = $ea_path; }
	else {$montage_folder = $cur_folder; }
	makecoffee $montage_folder . "folder.jpg",1,1, 1200, 1200;
	wait 2000; makecoffee "";

"_Finish_it";
	global $cur_folder, $paths;
	sel;
	$parent = getpathcomponent(,"component", -1,2);
  goto gpc(,"component", -2,1);
	selectitems $parent;
	#1001;
	#1049;
	status "Montage completed.";
Attachments
folder_polaroid_view.jpg
folder_polaroid_view.jpg (629.84 KiB) Viewed 1717 times
folder_zoom.jpg
folder_zoom.jpg (938.92 KiB) Viewed 1717 times
FolderMontageMenu.jpg
FolderMontageMenu.jpg (15.22 KiB) Viewed 1717 times
Last edited by klownboy on 13 Jan 2022 17:32, edited 1 time in total.
Windows 11, 22H2 Build 22621.1555 at 100% 2560x1440

Norn
Posts: 416
Joined: 24 Oct 2021 16:10

Re: Windows thumbnails for folders?

Post by Norn »

Thanks, but I don't know how to adjust this padding...
Attachments
padding.png
padding.png (7.54 KiB) Viewed 1698 times
Win10, Win11 @100% 2560x1440 22H2

klownboy
Posts: 4109
Joined: 28 Feb 2012 19:27

Re: Windows thumbnails for folders?

Post by klownboy »

I'm not sure what your picture is showing :?: If you're referring to the space between each image, look for the line with SC "savethumb" in the "_Montage" section savethumb($image, "p_i_c_$i.jpg", $thumbsize_X, $thumbsize_Y, "jpg100","5" , 2); the value "5" is the border width. You can leave it blank like this savethumb($image, "p_i_c_$i.jpg", $thumbsize_X, $thumbsize_Y, "jpg100", , 2); such that there is no border or change the value to whatever you want like "2" or "3".
Windows 11, 22H2 Build 22621.1555 at 100% 2560x1440

Norn
Posts: 416
Joined: 24 Oct 2021 16:10

Re: Windows thumbnails for folders?

Post by Norn »

I noticed IM generated thumbnails are rectangular, Irfanview generated thumbnails are square, but Irfanview doesn't support some paths, can IM generated thumbnails be set to square?
Win10, Win11 @100% 2560x1440 22H2

klownboy
Posts: 4109
Joined: 28 Feb 2012 19:27

Re: Windows thumbnails for folders?

Post by klownboy »

Yeah, I know what the problem is. I'm using a multiple of the actual thumbnail size in XYplorer.ini. So, if your thumbnails are not square the result will be rectangular and probably not look so good. In my case, I was testing the script in my photo folders which are set to thumbnail size #3 and they are square, 240x240. Maybe I'll just do away with that and set a desired square size

If you have a minute, try putting 6 or 7 images in a folder and set the thumbnail to a square size temporarily. Though the change would have to be saved since the script is obtaining the thumbnail sizes from XYplorer.ini. Doing that should give a result like my posted images show. In the meantime, I'll modifying to take into account non-rectangular thumbnail sizes. Hopefully tomorrow.
Windows 11, 22H2 Build 22621.1555 at 100% 2560x1440

Post Reply