mirror of
				https://github.com/flynx/ImageGrid.git
				synced 2025-10-31 11:20:09 +00:00 
			
		
		
		
	now vips preview generator uses a faster (vips-based) approach to getting preview size + minor bugfix in index.html...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
		
							parent
							
								
									0503a72993
								
							
						
					
					
						commit
						3415f57140
					
				| @ -107,6 +107,13 @@ Roadmap | ||||
| 				[_] index and group ALL files in an archive | ||||
| 				[_] import metadata | ||||
| 				[_] real GIDs | ||||
| 		[_] % Thumbnail generation strategies | ||||
| 			[_] extract existing raw thumbnails | ||||
| 			[_] make a preview just bigger than the screen first | ||||
| 			| ...to prevent loading the high-res | ||||
| 			| | ||||
| 			| this should be done BEFORE loading the image -- pre-load phase... | ||||
| 			[_] prioritize making thumbs for the ribbon (~350px)  | ||||
| 		[_] BUG: shifting last image out of a ribbon misaligns the current ribbon | ||||
| 		| i.e. the prev ribbon was deleted and the new focused ribbon | ||||
| 		| is aligned as if it was not current... | ||||
|  | ||||
| @ -129,6 +129,14 @@ if(window.CEF_dumpJSON != null){ | ||||
| 	//
 | ||||
| 	// NOTE: this will add already existing previews to IMAGES[gid]...
 | ||||
| 	//
 | ||||
| 	// XXX possible modes:
 | ||||
| 	// 		- fast 
 | ||||
| 	// 			make previews using nearest rscale (factor=1)
 | ||||
| 	// 		- optimized
 | ||||
| 	// 			use closest rscale and minimal factor
 | ||||
| 	// 		- best
 | ||||
| 	// 			only use scale factor (rscale=1)
 | ||||
| 	// XXX get image size without loading the image...
 | ||||
| 	// XXX make this not just vips-specific...
 | ||||
| 	// XXX path handling is a mess...
 | ||||
| 	window.makeImagePreviews = function(gid, sizes){ | ||||
| @ -153,11 +161,35 @@ if(window.CEF_dumpJSON != null){ | ||||
| 
 | ||||
| 		// get cur image size...
 | ||||
| 		var size_getter = $.Deferred() | ||||
| 
 | ||||
| 		var width_getter = $.Deferred() | ||||
| 		var cmd = 'vips im_header_int width "$IN"' | ||||
| 			.replace(/\$IN/g, source.replace(fp, '')) | ||||
| 		proc.exec(cmd, function(error, stdout, stderr){ | ||||
| 			width_getter.resolve(parseInt(stdout)) | ||||
| 		}) | ||||
| 
 | ||||
| 		var height_getter = $.Deferred() | ||||
| 		var cmd = 'vips im_header_int height "$IN"' | ||||
| 			.replace(/\$IN/g, source.replace(fp, '')) | ||||
| 		proc.exec(cmd, function(error, stdout, stderr){ | ||||
| 			height_getter.resolve(parseInt(stdout)) | ||||
| 		}) | ||||
| 
 | ||||
| 		$.when(width_getter, height_getter) | ||||
| 			.done(function(w, h){ | ||||
| 				size_getter.resolve(Math.max(w, h)) | ||||
| 			}) | ||||
| 
 | ||||
| 		/* | ||||
| 		// XXX this may get REALLY SLOW for BIG images...
 | ||||
| 		var size_getter = $.Deferred() | ||||
| 		var _i = new Image() | ||||
| 		_i.onload = function(){ | ||||
| 			size_getter.resolve(Math.max(parseInt(this.width), parseInt(this.height))) | ||||
| 		}  | ||||
| 		_i.src = source | ||||
| 		*/ | ||||
| 		 | ||||
| 		for(var i=0; i < sizes.length; i++){ | ||||
| 			var size = sizes[i] | ||||
| @ -200,9 +232,12 @@ if(window.CEF_dumpJSON != null){ | ||||
| 
 | ||||
| 						var preview_path = [target_path, name].join('/') | ||||
| 						var factor = source_size / size | ||||
| 						// this can be 1, 2, 4 or 8...
 | ||||
| 						var rscale = 1 | ||||
| 
 | ||||
| 						// XXX make this compatible with other image processors...
 | ||||
| 						var cmd = 'vips im_shrink "$IN" "$OUT:$COMPRESSION" $FACTOR $FACTOR' | ||||
| 						var cmd = 'vips im_shrink "$IN:$RSCALE" "$OUT:$COMPRESSION" $FACTOR $FACTOR' | ||||
| 							.replace(/\$RSCALE/g, rscale) | ||||
| 							.replace(/\$IN/g, source.replace(fp, '')) | ||||
| 							.replace(/\$OUT/g, preview_path) | ||||
| 							.replace(/\$COMPRESSION/g, compression) | ||||
|  | ||||
| @ -465,6 +465,7 @@ function loadRawDir(path, prefix){ | ||||
| 
 | ||||
| 	var res = $.Deferred() | ||||
| 
 | ||||
| 	// filter images...
 | ||||
| 	var image_paths = $.map(files, function(e){ | ||||
| 		return IMAGE_PATTERN.test(e) ? e : null | ||||
| 	}) | ||||
| @ -481,6 +482,9 @@ function loadRawDir(path, prefix){ | ||||
| 	res.notify(prefix, 'Loaded', 'Images.') | ||||
| 	IMAGES_CREATED = true | ||||
| 
 | ||||
| 	// XXX need to make basic previews (screen-size-ish and ribbon-size-ish)...
 | ||||
| 	// XXX
 | ||||
| 
 | ||||
| 	DATA = dataFromImages(IMAGES) | ||||
| 	res.notify(prefix, 'Loaded', 'Data.') | ||||
| 
 | ||||
|  | ||||
| @ -172,9 +172,9 @@ $(function(){ | ||||
| 			DATA_ATTR + '_SETTINGS' in localStorage && loadLocalStorageSettings() | ||||
| 
 | ||||
| 			// XXX this will reload everything... | ||||
| 			(MARKED.length == 0  | ||||
| 			MARKED.length == 0  | ||||
| 				&& DATA_ATTR + '_MARKED' in localStorage  | ||||
| 				&& loadLocalStorageMarks()) | ||||
| 				&& loadLocalStorageMarks() | ||||
| 
 | ||||
| 			updateImages() | ||||
| 
 | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user