View Single Post
Old January 8th, 2013, 04:49 PM   #225 (permalink)
argedion
Resident Frog
Thread Author (OP)
 
argedion's Avatar
 
Join Date: Jun 2011
Location: I Live in St'Marys Georgia
Posts: 4,392
 
Device(s): HTC EVO 4g(Retired), HTC EVO LTE(Retired), LG Lucid(Returned), Motorola Droid Razr M, Nexus 7
Carrier: GOD

Thanks: 3,757
Thanked 3,964 Times in 1,980 Posts
Default

Quote:
Originally Posted by MoodyBlues View Post
Hey, we're Linux users! Of course there's a better way! Or two. Or three. Or...


Do you do any bash scripting? How are you at a command line? Pretty comfortable? Are you at all familiar with ImageMagick?


What are you basing "duplicates" on? Name? Size? Size in pixels? Size in bytes? Date? Any/all of these can be ambiguous.


Which is why I'll *NEVER* be a full-blown GUI user! I can do in seconds or minutes at a CLI what takes hours or days in a GUI.


How about adding their dimensions to their names instead? In other words, instead of having:

Code:
fantasy1 (a directory)

. fantasy1_3000x3000 (subdirectory)
.. picture1.jpeg
.. picture2.jpeg
.. picture3.jpeg

. fantasy1_3500x3500 (subdirectory)
.. picture1.jpeg
.. picture2.jpeg
.. picture3.jpeg

. fantasy1_4000x4000 (subdirectory)
.. picture1.jpeg
.. picture2.jpeg
.. picture3.jpeg


fantasy2 (a directory)

. fantasy2_3000x3000 (subdirectory)
.. picture1.jpeg
.. picture2.jpeg
.. picture3.jpeg

. fantasy2_3500x3500 (subdirectory)
.. picture1.jpeg
.. picture2.jpeg
.. picture3.jpeg

. fantasy2_4000x4000 (subdirectory)
.. picture1.jpeg
.. picture2.jpeg
.. picture3.jpeg
you could have:

Code:
. fantasy1 (a directory)
.. picture1_3000x3000.jpeg
.. picture2_3000x3000.jpeg
.. picture3_3000x3000.jpeg
.. picture1_3500x3500.jpeg
.. picture2_3500x3500.jpeg
.. picture3_3500x3500.jpeg
.. picture1_4000x4000.jpeg
.. picture2_4000x4000.jpeg
.. picture3_4000x4000.jpeg

. fantasy2 (a directory)
.. picture1_3000x3000.jpeg
.. picture2_3000x3000.jpeg
.. picture3_3000x3000.jpeg
.. picture1_3500x3500.jpeg
.. picture2_3500x3500.jpeg
.. picture3_3500x3500.jpeg
.. picture1_4000x4000.jpeg
.. picture2_4000x4000.jpeg
.. picture3_4000x4000.jpeg
The files could be renamed however you like, for example, 3000x3000_picture1.jpeg or picture1_3000.jpeg, etc.

Combining bash commands with ImageMagick commands, all of the above could be accomplished quickly. IM has a zillion options, literally infinite when you're combining them, and there's definitely a learning curve, especially if you're not already pretty comfortable at a command line with basic *nix usage.

Using IM's identify command, here's an example of it determining an image's attributes--only the attributes I told it to identify, its width and height:

Code:
$ identify -format "%wx%h" pg7.png
638x877
Taking that output and using a little bash and a little IM, you could rename the files so they include the dimensions in their names.

Like I said, there's definitely a learning curve, but I can't stress strongly enough how useful IM is once you're used to it. I'd be lost without its power and versatility. I can literally process hundreds of image files, in any number of ways, in a VERY small fraction of the time it would take to do it manually. Take a look at ImageMagick, including some of its options to see how powerful it is.
awesome but i cheated some and had a friend help me with a bash script that uses exiftool

#!/bin/bash
#
#-----------------------------------------------
# organized pictures by resolution
# 9to5 - AndroidForums.com
#-----------------------------------------------
#
# Note, this script uses exiftool to find the picutre width/height
# and it will only work with one file type at a time (so far)... 
# if you want to change the file type (to say, png) then change the 
# *.jpg to *.png in line 17

# set dir to your picture directory
dir=./
typ=$1

# file type change here 
for line in $(ls *.$typ)
do
	psize=$(exiftool $line | grep "Image Size" | cut -d ":" -f 2 | cut -d " " -f 2)
	# That will give use the resolution of the file...  example : 900x600 as variable psize		
	ls $psize 1>/dev/null
	ls_check=$?
	if [[ $ls_check -eq 0 ]]
	then
		mv $line $psize 1>/dev/null
	else
		mkdir $psize
		mv $line $psize 1>/dev/null
	fi	
	
done

#unset variables
unset {line,psize,ls_check}
it has a few flaws but does work maybe we can come up with something. At moment filenames with spaces are a no no so i'll have to rename those that have spaces in them. Also as you can see can only do one type at a time still much faster than the manual way i did the first one.

on the fedora site my signature is Command Line Flunkie Gui Junkie

I wish to change this
__________________
All My Links In one Convenient Place
Asking simple questions can keep us from doing dumb things.
Help BabyBlues save the ta ta's
argedion is online now  
Reply With Quote