LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Desktop
User Name
Password
Linux - Desktop This forum is for the discussion of all Linux Software used in a desktop context.

Notices


Reply
  Search this Thread
Old 06-20-2010, 07:12 PM   #1
1veedo
Member
 
Registered: Dec 2004
Location: WV, USA
Distribution: Gentoo, Debian
Posts: 186

Rep: Reputation: 34
Script to find wallpaper images


So I have thousands of wallpapers scattered around my harddrive. Is there any way to scan for images with certain dimensions, ie your screen resolution?
 
Old 06-21-2010, 12:31 AM   #2
frandalla
Member
 
Registered: Oct 2003
Location: Tokyo - Japan
Distribution: Slackware
Posts: 348
Blog Entries: 1

Rep: Reputation: 37
try the script below.
See the comments in the script for usage and dependencies.
tested on slackware 13.1

#!/bin/bash
#Script By Francisco Dalla Rosa Soares - 2010/06/21
#
#USAGE: teste.sh <directory to search> <what to search>
#
#EXAMPLE: teste.sh /home/myuser *.jpg
#
#The script will return the path to the files that meet the image dimensions specified.
#
#Image dimensions are in the array WALLPAPERSIZE.
#You can add or remove sizes as you want.
#This script DEPENDS on exiv2 for checking image dimensions

WALLPAPERSIZE=( 800x600 1024x768 1200x600 1680x1050 1920x1200 1280x800 1600x1200 1280x1024 )
for i in $(find $1 -iname $2); do
FILENAME=`exiv2 $i 2>/dev/null | grep "name" | awk -F: '{print $2}'`;
IMAGESIZE=`exiv2 $i 2>/dev/null | grep "Image size" | awk -F: '{print $2}'| sed 's/ //g'`;
for j in ${WALLPAPERSIZE[@]}; do
if [ $j == $IMAGESIZE ]
then
echo $FILENAME;
fi
done
done

Last edited by frandalla; 06-21-2010 at 07:30 PM. Reason: typo correction
 
1 members found this post helpful.
Old 06-21-2010, 10:10 AM   #3
1veedo
Member
 
Registered: Dec 2004
Location: WV, USA
Distribution: Gentoo, Debian
Posts: 186

Original Poster
Rep: Reputation: 34
Awesome, that's exactly what I was looking for!
 
  


Reply

Tags
bash, wallpaper



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Help me find this wallpaper. Hitboxx General 4 01-24-2009 08:22 AM
LXer: Howto Set Flickr images as Ubuntu desktop wallpaper LXer Syndicated Linux News 0 09-23-2007 06:00 AM
LXer: Howto Set Flickr images as Ubuntu desktop wallpaper LXer Syndicated Linux News 0 08-08-2007 05:31 PM
Gnome 2: Multiple desktop wallpaper images per workspace animehair Linux - Software 4 07-26-2005 07:58 PM
Were Do I Find The Best Desktop Wallpaper? micxz General 14 09-30-2003 04:45 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Desktop

All times are GMT -5. The time now is 10:21 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration