How to sort images into folders, based on resolution?
Background: I've got a folder full of saved desktop pictures. I'd like to put them into folders, based on their resolution - 1024x768, etc. Creating the folders on the fly is a bonus. Currently, the images are all in a folder, but some of them are in sub-folders. I can merge them by hand, if that makes things easier.
I'd prefer the terminal, though I'm still kind of a bash newbie. I'm not much of a programmer at all, really.
I'm using Mac OS X, but I'm not opposed to installing extra apps to accomplish this (MacPorts?), or even using another OS (I've got Windows XP, Windows Vista, and Ubuntu 9 setup right now within VMWare).
Any help would be appreciated! Thank you!
images resolution sorting
add a comment |
Background: I've got a folder full of saved desktop pictures. I'd like to put them into folders, based on their resolution - 1024x768, etc. Creating the folders on the fly is a bonus. Currently, the images are all in a folder, but some of them are in sub-folders. I can merge them by hand, if that makes things easier.
I'd prefer the terminal, though I'm still kind of a bash newbie. I'm not much of a programmer at all, really.
I'm using Mac OS X, but I'm not opposed to installing extra apps to accomplish this (MacPorts?), or even using another OS (I've got Windows XP, Windows Vista, and Ubuntu 9 setup right now within VMWare).
Any help would be appreciated! Thank you!
images resolution sorting
add a comment |
Background: I've got a folder full of saved desktop pictures. I'd like to put them into folders, based on their resolution - 1024x768, etc. Creating the folders on the fly is a bonus. Currently, the images are all in a folder, but some of them are in sub-folders. I can merge them by hand, if that makes things easier.
I'd prefer the terminal, though I'm still kind of a bash newbie. I'm not much of a programmer at all, really.
I'm using Mac OS X, but I'm not opposed to installing extra apps to accomplish this (MacPorts?), or even using another OS (I've got Windows XP, Windows Vista, and Ubuntu 9 setup right now within VMWare).
Any help would be appreciated! Thank you!
images resolution sorting
Background: I've got a folder full of saved desktop pictures. I'd like to put them into folders, based on their resolution - 1024x768, etc. Creating the folders on the fly is a bonus. Currently, the images are all in a folder, but some of them are in sub-folders. I can merge them by hand, if that makes things easier.
I'd prefer the terminal, though I'm still kind of a bash newbie. I'm not much of a programmer at all, really.
I'm using Mac OS X, but I'm not opposed to installing extra apps to accomplish this (MacPorts?), or even using another OS (I've got Windows XP, Windows Vista, and Ubuntu 9 setup right now within VMWare).
Any help would be appreciated! Thank you!
images resolution sorting
images resolution sorting
edited Aug 3 '09 at 12:14
nik
48.3k886132
48.3k886132
asked Aug 3 '09 at 11:55
flammable
8117
8117
add a comment |
add a comment |
6 Answers
6
active
oldest
votes
I know it's an over a year topic (sorry about that) but i think someone may need the full working script, so here it is. Taking the ideas here and compiling into a script we get.
#!/bin/bash
for image in *.jpg;
do res=$(identify -format %wx%h\n $image);
mkdir -p $res;
mv $image $res;
done
add a comment |
Seriously, thanks for replying, everyone! I've come back to this, more experienced, and most of the comments here make more sense now.
I tweaked @zatatlan's script slightly to accommodate spaces in filenames and to add more file extensions.
#!/bin/bash
shopt -s nullglob # The script spits errors if this is not set and there are, say, no *.png files.
for image in *.jpg *.JPG *.jpeg *.JPEG *.gif *.GIF *.bmp *.BMP *.png *.PNG;
do res=$(identify -format %wx%h\n "$image");
mkdir -p $res;
mv "$image" $res;
done
add a comment |
It is possible to use imagemagick to detect image resolution. Wrap it in a bash loop and there you go. I won't wait until I get home to a bash shell, so here is something off top of my head. The syntax is probably wrong, but it might give you some clues.
for image in $(`*.jpg`) do
res=`identify $image | grep -o 'Resolution:'`
if [ ! -d $res ]; then
mkdir $res
fi
mv $image $res
done
The script creates directories on the fly. Both bash and imagemagick are available for mac.
You can make the script a bit shorter and simpler by replacing theif
block with a simplemkdir -p $res
.
– Ryan Thompson
Nov 7 '09 at 21:58
add a comment |
There is Amok EXIF Sorter
AmoK Exif Sorter can rename pictures, and move or copy them to arbitrary folders.
The folders can be named according to the exif data.
Offers a live preview of the file names, an integrated picture and exif data viewer, drag & drop, thumbnail view, automatic update check, and profiles for different cameras and users.
Also supports Video files by creation date, IPTC formatted files.
Written in JAVA, works on all platforms supporting JRE5
.
Checkout the feature list on the link.
Don't get discouraged by the German language.
Pull down Sprache
and select Englisch
, restart the application.
add a comment |
The ImageMagick identify command can give you the width and height in pixels, e.g.
~$ identify -format %w_%h\n *jpg
2868_3429
1056_960
You can put that into a bash script as part of a for loop and, for safety, copy the files into a directory that is named the same as the resolution (check if it exists and create if not).
add a comment |
A basic way that will give a rough order of resolution is to organize by file size. This is something that should be built into any OS, so you don't need anything special. The BIG catch with this is that the format for your photos would need to be the same for this to work. This isn't a perfect solution, but it may be an easy stop-gap until you find something that actually fits the bill.
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "3"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f17562%2fhow-to-sort-images-into-folders-based-on-resolution%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
6 Answers
6
active
oldest
votes
6 Answers
6
active
oldest
votes
active
oldest
votes
active
oldest
votes
I know it's an over a year topic (sorry about that) but i think someone may need the full working script, so here it is. Taking the ideas here and compiling into a script we get.
#!/bin/bash
for image in *.jpg;
do res=$(identify -format %wx%h\n $image);
mkdir -p $res;
mv $image $res;
done
add a comment |
I know it's an over a year topic (sorry about that) but i think someone may need the full working script, so here it is. Taking the ideas here and compiling into a script we get.
#!/bin/bash
for image in *.jpg;
do res=$(identify -format %wx%h\n $image);
mkdir -p $res;
mv $image $res;
done
add a comment |
I know it's an over a year topic (sorry about that) but i think someone may need the full working script, so here it is. Taking the ideas here and compiling into a script we get.
#!/bin/bash
for image in *.jpg;
do res=$(identify -format %wx%h\n $image);
mkdir -p $res;
mv $image $res;
done
I know it's an over a year topic (sorry about that) but i think someone may need the full working script, so here it is. Taking the ideas here and compiling into a script we get.
#!/bin/bash
for image in *.jpg;
do res=$(identify -format %wx%h\n $image);
mkdir -p $res;
mv $image $res;
done
answered Nov 13 '10 at 19:34
zatatlan
10112
10112
add a comment |
add a comment |
Seriously, thanks for replying, everyone! I've come back to this, more experienced, and most of the comments here make more sense now.
I tweaked @zatatlan's script slightly to accommodate spaces in filenames and to add more file extensions.
#!/bin/bash
shopt -s nullglob # The script spits errors if this is not set and there are, say, no *.png files.
for image in *.jpg *.JPG *.jpeg *.JPEG *.gif *.GIF *.bmp *.BMP *.png *.PNG;
do res=$(identify -format %wx%h\n "$image");
mkdir -p $res;
mv "$image" $res;
done
add a comment |
Seriously, thanks for replying, everyone! I've come back to this, more experienced, and most of the comments here make more sense now.
I tweaked @zatatlan's script slightly to accommodate spaces in filenames and to add more file extensions.
#!/bin/bash
shopt -s nullglob # The script spits errors if this is not set and there are, say, no *.png files.
for image in *.jpg *.JPG *.jpeg *.JPEG *.gif *.GIF *.bmp *.BMP *.png *.PNG;
do res=$(identify -format %wx%h\n "$image");
mkdir -p $res;
mv "$image" $res;
done
add a comment |
Seriously, thanks for replying, everyone! I've come back to this, more experienced, and most of the comments here make more sense now.
I tweaked @zatatlan's script slightly to accommodate spaces in filenames and to add more file extensions.
#!/bin/bash
shopt -s nullglob # The script spits errors if this is not set and there are, say, no *.png files.
for image in *.jpg *.JPG *.jpeg *.JPEG *.gif *.GIF *.bmp *.BMP *.png *.PNG;
do res=$(identify -format %wx%h\n "$image");
mkdir -p $res;
mv "$image" $res;
done
Seriously, thanks for replying, everyone! I've come back to this, more experienced, and most of the comments here make more sense now.
I tweaked @zatatlan's script slightly to accommodate spaces in filenames and to add more file extensions.
#!/bin/bash
shopt -s nullglob # The script spits errors if this is not set and there are, say, no *.png files.
for image in *.jpg *.JPG *.jpeg *.JPEG *.gif *.GIF *.bmp *.BMP *.png *.PNG;
do res=$(identify -format %wx%h\n "$image");
mkdir -p $res;
mv "$image" $res;
done
edited Dec 7 at 16:10
HappyFace
1289
1289
answered May 4 '13 at 17:27
flammable
8117
8117
add a comment |
add a comment |
It is possible to use imagemagick to detect image resolution. Wrap it in a bash loop and there you go. I won't wait until I get home to a bash shell, so here is something off top of my head. The syntax is probably wrong, but it might give you some clues.
for image in $(`*.jpg`) do
res=`identify $image | grep -o 'Resolution:'`
if [ ! -d $res ]; then
mkdir $res
fi
mv $image $res
done
The script creates directories on the fly. Both bash and imagemagick are available for mac.
You can make the script a bit shorter and simpler by replacing theif
block with a simplemkdir -p $res
.
– Ryan Thompson
Nov 7 '09 at 21:58
add a comment |
It is possible to use imagemagick to detect image resolution. Wrap it in a bash loop and there you go. I won't wait until I get home to a bash shell, so here is something off top of my head. The syntax is probably wrong, but it might give you some clues.
for image in $(`*.jpg`) do
res=`identify $image | grep -o 'Resolution:'`
if [ ! -d $res ]; then
mkdir $res
fi
mv $image $res
done
The script creates directories on the fly. Both bash and imagemagick are available for mac.
You can make the script a bit shorter and simpler by replacing theif
block with a simplemkdir -p $res
.
– Ryan Thompson
Nov 7 '09 at 21:58
add a comment |
It is possible to use imagemagick to detect image resolution. Wrap it in a bash loop and there you go. I won't wait until I get home to a bash shell, so here is something off top of my head. The syntax is probably wrong, but it might give you some clues.
for image in $(`*.jpg`) do
res=`identify $image | grep -o 'Resolution:'`
if [ ! -d $res ]; then
mkdir $res
fi
mv $image $res
done
The script creates directories on the fly. Both bash and imagemagick are available for mac.
It is possible to use imagemagick to detect image resolution. Wrap it in a bash loop and there you go. I won't wait until I get home to a bash shell, so here is something off top of my head. The syntax is probably wrong, but it might give you some clues.
for image in $(`*.jpg`) do
res=`identify $image | grep -o 'Resolution:'`
if [ ! -d $res ]; then
mkdir $res
fi
mv $image $res
done
The script creates directories on the fly. Both bash and imagemagick are available for mac.
answered Aug 3 '09 at 12:08
user4126
54636
54636
You can make the script a bit shorter and simpler by replacing theif
block with a simplemkdir -p $res
.
– Ryan Thompson
Nov 7 '09 at 21:58
add a comment |
You can make the script a bit shorter and simpler by replacing theif
block with a simplemkdir -p $res
.
– Ryan Thompson
Nov 7 '09 at 21:58
You can make the script a bit shorter and simpler by replacing the
if
block with a simple mkdir -p $res
.– Ryan Thompson
Nov 7 '09 at 21:58
You can make the script a bit shorter and simpler by replacing the
if
block with a simple mkdir -p $res
.– Ryan Thompson
Nov 7 '09 at 21:58
add a comment |
There is Amok EXIF Sorter
AmoK Exif Sorter can rename pictures, and move or copy them to arbitrary folders.
The folders can be named according to the exif data.
Offers a live preview of the file names, an integrated picture and exif data viewer, drag & drop, thumbnail view, automatic update check, and profiles for different cameras and users.
Also supports Video files by creation date, IPTC formatted files.
Written in JAVA, works on all platforms supporting JRE5
.
Checkout the feature list on the link.
Don't get discouraged by the German language.
Pull down Sprache
and select Englisch
, restart the application.
add a comment |
There is Amok EXIF Sorter
AmoK Exif Sorter can rename pictures, and move or copy them to arbitrary folders.
The folders can be named according to the exif data.
Offers a live preview of the file names, an integrated picture and exif data viewer, drag & drop, thumbnail view, automatic update check, and profiles for different cameras and users.
Also supports Video files by creation date, IPTC formatted files.
Written in JAVA, works on all platforms supporting JRE5
.
Checkout the feature list on the link.
Don't get discouraged by the German language.
Pull down Sprache
and select Englisch
, restart the application.
add a comment |
There is Amok EXIF Sorter
AmoK Exif Sorter can rename pictures, and move or copy them to arbitrary folders.
The folders can be named according to the exif data.
Offers a live preview of the file names, an integrated picture and exif data viewer, drag & drop, thumbnail view, automatic update check, and profiles for different cameras and users.
Also supports Video files by creation date, IPTC formatted files.
Written in JAVA, works on all platforms supporting JRE5
.
Checkout the feature list on the link.
Don't get discouraged by the German language.
Pull down Sprache
and select Englisch
, restart the application.
There is Amok EXIF Sorter
AmoK Exif Sorter can rename pictures, and move or copy them to arbitrary folders.
The folders can be named according to the exif data.
Offers a live preview of the file names, an integrated picture and exif data viewer, drag & drop, thumbnail view, automatic update check, and profiles for different cameras and users.
Also supports Video files by creation date, IPTC formatted files.
Written in JAVA, works on all platforms supporting JRE5
.
Checkout the feature list on the link.
Don't get discouraged by the German language.
Pull down Sprache
and select Englisch
, restart the application.
edited Aug 8 '09 at 8:47
answered Aug 3 '09 at 12:16
nik
48.3k886132
48.3k886132
add a comment |
add a comment |
The ImageMagick identify command can give you the width and height in pixels, e.g.
~$ identify -format %w_%h\n *jpg
2868_3429
1056_960
You can put that into a bash script as part of a for loop and, for safety, copy the files into a directory that is named the same as the resolution (check if it exists and create if not).
add a comment |
The ImageMagick identify command can give you the width and height in pixels, e.g.
~$ identify -format %w_%h\n *jpg
2868_3429
1056_960
You can put that into a bash script as part of a for loop and, for safety, copy the files into a directory that is named the same as the resolution (check if it exists and create if not).
add a comment |
The ImageMagick identify command can give you the width and height in pixels, e.g.
~$ identify -format %w_%h\n *jpg
2868_3429
1056_960
You can put that into a bash script as part of a for loop and, for safety, copy the files into a directory that is named the same as the resolution (check if it exists and create if not).
The ImageMagick identify command can give you the width and height in pixels, e.g.
~$ identify -format %w_%h\n *jpg
2868_3429
1056_960
You can put that into a bash script as part of a for loop and, for safety, copy the files into a directory that is named the same as the resolution (check if it exists and create if not).
answered Aug 3 '09 at 12:13
mas
2,4111727
2,4111727
add a comment |
add a comment |
A basic way that will give a rough order of resolution is to organize by file size. This is something that should be built into any OS, so you don't need anything special. The BIG catch with this is that the format for your photos would need to be the same for this to work. This isn't a perfect solution, but it may be an easy stop-gap until you find something that actually fits the bill.
add a comment |
A basic way that will give a rough order of resolution is to organize by file size. This is something that should be built into any OS, so you don't need anything special. The BIG catch with this is that the format for your photos would need to be the same for this to work. This isn't a perfect solution, but it may be an easy stop-gap until you find something that actually fits the bill.
add a comment |
A basic way that will give a rough order of resolution is to organize by file size. This is something that should be built into any OS, so you don't need anything special. The BIG catch with this is that the format for your photos would need to be the same for this to work. This isn't a perfect solution, but it may be an easy stop-gap until you find something that actually fits the bill.
A basic way that will give a rough order of resolution is to organize by file size. This is something that should be built into any OS, so you don't need anything special. The BIG catch with this is that the format for your photos would need to be the same for this to work. This isn't a perfect solution, but it may be an easy stop-gap until you find something that actually fits the bill.
answered Aug 3 '09 at 12:25
DHayes
2,0631016
2,0631016
add a comment |
add a comment |
Thanks for contributing an answer to Super User!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f17562%2fhow-to-sort-images-into-folders-based-on-resolution%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown