This makes use of our image processing capabilities in order to turn arbitrary image files into normalized thumbnails, upload them to a temporary host, and pass the resulting URI to a search provider. In future, fiv should ideally run the upload itself, so that its status and any errors are obvious to the user, as well as to get rid of the script's dependency on jq.
		
			
				
	
	
		
			10 lines
		
	
	
		
			283 B
		
	
	
	
		
			Bash
		
	
	
		
			Executable File
		
	
	
	
	
			
		
		
	
	
			10 lines
		
	
	
		
			283 B
		
	
	
	
		
			Bash
		
	
	
		
			Executable File
		
	
	
	
	
| #!/bin/sh -e
 | |
| if [ "$#" -ne 2 ]; then
 | |
| 	echo "Usage: $0 SEARCH-ENGINE-URI-PREFIX {PATH | URI}" >&2
 | |
| 	exit 1
 | |
| fi
 | |
| 
 | |
| xdg-open "$1$(fiv --thumbnail-for-search large "$2" \
 | |
| 	| curl --silent --show-error --upload-file - https://transfer.sh/image \
 | |
| 	| jq --slurp --raw-input --raw-output @uri)"
 |