Sort by image resolution (dimensions)Image viewer that allows printing more than 100%Getting wrong resolution on old samsung monitorReduce the physical dimensions of a pdf using the command line

How dangerous are my worn rims?

What's the correct way to determine turn order in this situation?

What is this symbol?

Did Joe Biden "stop a prosecution" into his son in Ukraine? And did he brag about stopping the prosecution?

Sci-fi story about aliens with cells based on arsenic or nitrogen, poisoned by oxygen

Realistically, how much do you need to start investing?

How to catch creatures that can predict the next few minutes?

Sum of series with addition

Manager told a colleague of mine I was getting fired soon

Can 35 mm film which went through a washing machine still be developed?

Was there an autocomplete utility in MS-DOS?

Why do we not always use the closed testing principle for multiple comparisons?

Why is there such a singular place for bird watching?

What action is recommended if your accommodation refuses to let you leave without paying additional fees?

How to "Start as close to the end as possible", and why to do so?

As a girl, how can I voice male characters effectively?

As an interviewer, how to conduct interviews with candidates you already know will be rejected?

Can/should you swim in zero G?

Why do personal finance apps focus on outgoings rather than income

How can I find places to store/land a private airplane?

C - Learning Linked Lists, Pointer Manipulation - Store some ints, print and free memory

Booting Ubuntu from USB drive on MSI motherboard -- EVERYTHING fails

Are there types of animals that can't make the trip to space? (physiologically)

Mac no longer boots



Sort by image resolution (dimensions)


Image viewer that allows printing more than 100%Getting wrong resolution on old samsung monitorReduce the physical dimensions of a pdf using the command line






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty
margin-bottom:0;









7















Which program has a function to sort images by their pixel size / resolution / dimensions.



Very strange but even so powerful DigiKam doesn't have so simple function.



Any suggestions?










share|improve this question
































    7















    Which program has a function to sort images by their pixel size / resolution / dimensions.



    Very strange but even so powerful DigiKam doesn't have so simple function.



    Any suggestions?










    share|improve this question




























      7












      7








      7


      1






      Which program has a function to sort images by their pixel size / resolution / dimensions.



      Very strange but even so powerful DigiKam doesn't have so simple function.



      Any suggestions?










      share|improve this question
















      Which program has a function to sort images by their pixel size / resolution / dimensions.



      Very strange but even so powerful DigiKam doesn't have so simple function.



      Any suggestions?







      command-line software-recommendation display-resolution






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Jun 25 '18 at 9:18









      Jason Aller

      4216 silver badges9 bronze badges




      4216 silver badges9 bronze badges










      asked Jul 7 '14 at 9:50









      BartekBartek

      832 silver badges8 bronze badges




      832 silver badges8 bronze badges























          6 Answers
          6






          active

          oldest

          votes


















          7
















          I've no idea how this performs but ImageMagick has an identify application that I've got to learn over the last ten minutes. Better than anything, it has a -format argument where you can do maths!



          find -iname '*.jpg' -exec identify -format "%[fx:w*h] %in" + | sort -g


          Unfortunately, if you get above a certain size, you get scientific notation (eg 1.2*10^3) instead of an integer back from identify. Thankfully sort has a -g argument that will parse them out.



          On the same files here, this version (not forking out to Perl) only take 60% of the time the Perl version does. That's not to say Perl is slow, but going into perl and subshelling back out is an unnecessary complication that's slowing things down (I think).



          Mine still isn't ideal. Needing to parse numbers back to integers for sorting is fairly slow. Ideally you'd do this all internally in one language where the size remains as an integer throughout... But the above is the shortest, sharpest one-liner I can do.






          share|improve this answer

























          • Are you sure sort -g handles scientific notation correctly? I ask because (echo 1.45e+06; echo 1.15e+06; echo 1.44e+06; echo 5; echo 2) | sort -g returns a curious order (I tested using bash)

            – Sylvain Pineau
            Jul 10 '14 at 13:55











          • @SylvainPineau does it still return something strange? It sorts correctly (2,5,1.15e+06,1.44e+06,1.45e+06) for me.

            – terdon
            Jun 27 '15 at 17:28











          • @terdon it depends on the locale, tested with LC_ALL=C it works as expected.

            – Sylvain Pineau
            Jun 29 '15 at 7:48


















          5
















          If you're looking for a command-line tool, the following command will sort image files where the highest resolution comes first:



          find . -iname "*.png" -o -iname "*.jpg" | perl -e '$f=subeval(`identify -format %w*%h $quotemeta(shift) 2>/dev/null`);print sort$f->($b)<=>$f->($a)<>'


          I'm basically sorting the files using perl sort sub-subroutine where the key here is to call the identify command and eval its formatted output.



          identify is available with the imagemagick package:



          sudo apt-get install imagemagick


          UPDATE:



          The following command will also output the resolution:



          find . -iname "*.png" -o -iname "*.jpg" | perl -e '$f=sub`identify -format %w*%h $quotemeta(shift) 2>/dev/null`;chomp&&print "$_t".$f->($_) for sorteval($f->($b))<=>eval($f->($a))<>'


          Example:



          ./foo bar.png 1600*900
          ./baz.png 1600*900
          ./img_0004.jpg 1280*720
          ./img_0006.jpg 1280*720
          ./img_0001.jpg 1280*720
          ./img_0003.jpg 1280*720
          ./img_0002.jpg 1280*720
          ./img_0005.jpg 1280*720
          ./launcher.png 385*632
          ./textfield.png 402*329
          ./foo2.png 202*229





          share|improve this answer



























          • I have imagemagick already installed. I enter your command in the folder with jpg and png images, and there are also xmp files, and it shows me some errors which I don't understand: 'identify.im6: unable to open image ./estrada: No such file or directory @ error/blob.c/OpenBlob/2638. identify.im6: no decode delegate for this image format ./estrada @ error/constitute.c/ReadImage/544.' If thats important, filenames doesn't contain spaces.

            – Bartek
            Jul 7 '14 at 16:26












          • You have to use the first find command correctly to filter only images otherwise identify will fail with this error. I got it when I tried find . -iname "*"

            – Sylvain Pineau
            Jul 7 '14 at 18:59











          • I've added support for filenames containing spaces. Please try again the new command

            – Sylvain Pineau
            Jul 8 '14 at 12:09


















          2
















          Using find, file --mime-type, identify, awk and sort



          Using file --mime-type we find all images, even without an extension.



          The one-line at the end of this answer has a problem with newlines in the file name. Therefore here an other version:



          find . -type f -exec sh -c 'file --brief --mime-type "$0" |
          grep -q ^image/ && identify -format "%[fx:w*h] %in" "$0"' ; |
          sort -g


          Sample output



          26696 ./OWoHp.png
          37975 ./hUXnc.png
          47275 ./foo
          bar.png


          This is the file with the newline in the filename:



          47275 ./foo
          bar.png


          Many thanks @terdon, @don_crissti and @glennjackman for the answers here.




          Old version with a problem if the filename contains newlines



          find . -type f -print0 | 
          xargs -0 -I file --mime-type |
          awk -F$"" -F": " '/image/ print $1' |
          xargs -I identify -format "%[fx:w*h] %in" |
          sort -g



          Sample output



          9216 ./.face
          27918 ./Unbenannt.png
          1.0368e+06 ./Images/Wallpapers/14-13.jpg
          1.57292e+07 ./Images/Wallpapers/wallpaper_19.jpg
          1.57292e+07 ./Images/Wallpapers/wallpaper_22.jpg
          1.92e+06 ./Images/Wallpapers/black (10).jpg
          2.304e+06 ./Images/Wallpapers/1920x1200.jpg
          2.304e+06 ./Images/Wallpapers/1920x1200_Seria_Lunar-Melodies.png
          2.304e+06 ./Images/Wallpapers/Anime_girl_129177.jpg
          2.304e+06 ./Images/Wallpapers/wallpaper-1802661.jpg
          2.304e+06 ./Images/Wallpapers/wallpaper-264390.jpg
          3.14368e+06 ./Images/Wallpapers/14 - 2.jpg
          3.6864e+06 ./Images/Wallpapers/14-1.jpg
          4.096e+06 ./Images/Wallpapers/wallpaper-2850337.jpg
          4.096e+06 ./Images/Wallpapers/wt4NRqA.jpg
          7.0969e+06 ./Images/Wallpapers/14 - 1.png





          share|improve this answer


































            1
















            Late to the party but here's my version with find,exiftool,and sort:



            find . -exec exiftool -S -t -q -FileName -ImageSize + | sort -k2n,2



            It's a bit slow, but works. Sample output:



            $ find Downloads -exec exiftool -S -t -q -FileName -ImageSize + | sort -k2n,2 

            1433695350670.jpg 1600x1000
            1433695350670.jpg 1600x1000
            1434999385912.jpg 2212x3318
            1434999385912.jpg 2212x3318
            1433524966694.jpg 2688x1520
            1433524966694.jpg 2688x1520
            1433525301504.jpg 2688x1520
            1433525301504.jpg 2688x1520





            share|improve this answer
































              1
















              Geeqie can sort by image size.



              sudo apt install geeqie





              share|improve this answer
































                0
















                Oli's answer works. Here is a modification to list minimum of width and height



                find * -type f -exec identify -format "%[fx:w>h?h:w] %in" + | sort -g





                share|improve this answer


























                  Your Answer








                  StackExchange.ready(function()
                  var channelOptions =
                  tags: "".split(" "),
                  id: "89"
                  ;
                  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/4.0/"u003ecc by-sa 4.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
                  );



                  );














                  draft saved

                  draft discarded
















                  StackExchange.ready(
                  function ()
                  StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f492660%2fsort-by-image-resolution-dimensions%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









                  7
















                  I've no idea how this performs but ImageMagick has an identify application that I've got to learn over the last ten minutes. Better than anything, it has a -format argument where you can do maths!



                  find -iname '*.jpg' -exec identify -format "%[fx:w*h] %in" + | sort -g


                  Unfortunately, if you get above a certain size, you get scientific notation (eg 1.2*10^3) instead of an integer back from identify. Thankfully sort has a -g argument that will parse them out.



                  On the same files here, this version (not forking out to Perl) only take 60% of the time the Perl version does. That's not to say Perl is slow, but going into perl and subshelling back out is an unnecessary complication that's slowing things down (I think).



                  Mine still isn't ideal. Needing to parse numbers back to integers for sorting is fairly slow. Ideally you'd do this all internally in one language where the size remains as an integer throughout... But the above is the shortest, sharpest one-liner I can do.






                  share|improve this answer

























                  • Are you sure sort -g handles scientific notation correctly? I ask because (echo 1.45e+06; echo 1.15e+06; echo 1.44e+06; echo 5; echo 2) | sort -g returns a curious order (I tested using bash)

                    – Sylvain Pineau
                    Jul 10 '14 at 13:55











                  • @SylvainPineau does it still return something strange? It sorts correctly (2,5,1.15e+06,1.44e+06,1.45e+06) for me.

                    – terdon
                    Jun 27 '15 at 17:28











                  • @terdon it depends on the locale, tested with LC_ALL=C it works as expected.

                    – Sylvain Pineau
                    Jun 29 '15 at 7:48















                  7
















                  I've no idea how this performs but ImageMagick has an identify application that I've got to learn over the last ten minutes. Better than anything, it has a -format argument where you can do maths!



                  find -iname '*.jpg' -exec identify -format "%[fx:w*h] %in" + | sort -g


                  Unfortunately, if you get above a certain size, you get scientific notation (eg 1.2*10^3) instead of an integer back from identify. Thankfully sort has a -g argument that will parse them out.



                  On the same files here, this version (not forking out to Perl) only take 60% of the time the Perl version does. That's not to say Perl is slow, but going into perl and subshelling back out is an unnecessary complication that's slowing things down (I think).



                  Mine still isn't ideal. Needing to parse numbers back to integers for sorting is fairly slow. Ideally you'd do this all internally in one language where the size remains as an integer throughout... But the above is the shortest, sharpest one-liner I can do.






                  share|improve this answer

























                  • Are you sure sort -g handles scientific notation correctly? I ask because (echo 1.45e+06; echo 1.15e+06; echo 1.44e+06; echo 5; echo 2) | sort -g returns a curious order (I tested using bash)

                    – Sylvain Pineau
                    Jul 10 '14 at 13:55











                  • @SylvainPineau does it still return something strange? It sorts correctly (2,5,1.15e+06,1.44e+06,1.45e+06) for me.

                    – terdon
                    Jun 27 '15 at 17:28











                  • @terdon it depends on the locale, tested with LC_ALL=C it works as expected.

                    – Sylvain Pineau
                    Jun 29 '15 at 7:48













                  7














                  7










                  7









                  I've no idea how this performs but ImageMagick has an identify application that I've got to learn over the last ten minutes. Better than anything, it has a -format argument where you can do maths!



                  find -iname '*.jpg' -exec identify -format "%[fx:w*h] %in" + | sort -g


                  Unfortunately, if you get above a certain size, you get scientific notation (eg 1.2*10^3) instead of an integer back from identify. Thankfully sort has a -g argument that will parse them out.



                  On the same files here, this version (not forking out to Perl) only take 60% of the time the Perl version does. That's not to say Perl is slow, but going into perl and subshelling back out is an unnecessary complication that's slowing things down (I think).



                  Mine still isn't ideal. Needing to parse numbers back to integers for sorting is fairly slow. Ideally you'd do this all internally in one language where the size remains as an integer throughout... But the above is the shortest, sharpest one-liner I can do.






                  share|improve this answer













                  I've no idea how this performs but ImageMagick has an identify application that I've got to learn over the last ten minutes. Better than anything, it has a -format argument where you can do maths!



                  find -iname '*.jpg' -exec identify -format "%[fx:w*h] %in" + | sort -g


                  Unfortunately, if you get above a certain size, you get scientific notation (eg 1.2*10^3) instead of an integer back from identify. Thankfully sort has a -g argument that will parse them out.



                  On the same files here, this version (not forking out to Perl) only take 60% of the time the Perl version does. That's not to say Perl is slow, but going into perl and subshelling back out is an unnecessary complication that's slowing things down (I think).



                  Mine still isn't ideal. Needing to parse numbers back to integers for sorting is fairly slow. Ideally you'd do this all internally in one language where the size remains as an integer throughout... But the above is the shortest, sharpest one-liner I can do.







                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered Jul 8 '14 at 15:28









                  OliOli

                  231k94 gold badges588 silver badges780 bronze badges




                  231k94 gold badges588 silver badges780 bronze badges















                  • Are you sure sort -g handles scientific notation correctly? I ask because (echo 1.45e+06; echo 1.15e+06; echo 1.44e+06; echo 5; echo 2) | sort -g returns a curious order (I tested using bash)

                    – Sylvain Pineau
                    Jul 10 '14 at 13:55











                  • @SylvainPineau does it still return something strange? It sorts correctly (2,5,1.15e+06,1.44e+06,1.45e+06) for me.

                    – terdon
                    Jun 27 '15 at 17:28











                  • @terdon it depends on the locale, tested with LC_ALL=C it works as expected.

                    – Sylvain Pineau
                    Jun 29 '15 at 7:48

















                  • Are you sure sort -g handles scientific notation correctly? I ask because (echo 1.45e+06; echo 1.15e+06; echo 1.44e+06; echo 5; echo 2) | sort -g returns a curious order (I tested using bash)

                    – Sylvain Pineau
                    Jul 10 '14 at 13:55











                  • @SylvainPineau does it still return something strange? It sorts correctly (2,5,1.15e+06,1.44e+06,1.45e+06) for me.

                    – terdon
                    Jun 27 '15 at 17:28











                  • @terdon it depends on the locale, tested with LC_ALL=C it works as expected.

                    – Sylvain Pineau
                    Jun 29 '15 at 7:48
















                  Are you sure sort -g handles scientific notation correctly? I ask because (echo 1.45e+06; echo 1.15e+06; echo 1.44e+06; echo 5; echo 2) | sort -g returns a curious order (I tested using bash)

                  – Sylvain Pineau
                  Jul 10 '14 at 13:55





                  Are you sure sort -g handles scientific notation correctly? I ask because (echo 1.45e+06; echo 1.15e+06; echo 1.44e+06; echo 5; echo 2) | sort -g returns a curious order (I tested using bash)

                  – Sylvain Pineau
                  Jul 10 '14 at 13:55













                  @SylvainPineau does it still return something strange? It sorts correctly (2,5,1.15e+06,1.44e+06,1.45e+06) for me.

                  – terdon
                  Jun 27 '15 at 17:28





                  @SylvainPineau does it still return something strange? It sorts correctly (2,5,1.15e+06,1.44e+06,1.45e+06) for me.

                  – terdon
                  Jun 27 '15 at 17:28













                  @terdon it depends on the locale, tested with LC_ALL=C it works as expected.

                  – Sylvain Pineau
                  Jun 29 '15 at 7:48





                  @terdon it depends on the locale, tested with LC_ALL=C it works as expected.

                  – Sylvain Pineau
                  Jun 29 '15 at 7:48













                  5
















                  If you're looking for a command-line tool, the following command will sort image files where the highest resolution comes first:



                  find . -iname "*.png" -o -iname "*.jpg" | perl -e '$f=subeval(`identify -format %w*%h $quotemeta(shift) 2>/dev/null`);print sort$f->($b)<=>$f->($a)<>'


                  I'm basically sorting the files using perl sort sub-subroutine where the key here is to call the identify command and eval its formatted output.



                  identify is available with the imagemagick package:



                  sudo apt-get install imagemagick


                  UPDATE:



                  The following command will also output the resolution:



                  find . -iname "*.png" -o -iname "*.jpg" | perl -e '$f=sub`identify -format %w*%h $quotemeta(shift) 2>/dev/null`;chomp&&print "$_t".$f->($_) for sorteval($f->($b))<=>eval($f->($a))<>'


                  Example:



                  ./foo bar.png 1600*900
                  ./baz.png 1600*900
                  ./img_0004.jpg 1280*720
                  ./img_0006.jpg 1280*720
                  ./img_0001.jpg 1280*720
                  ./img_0003.jpg 1280*720
                  ./img_0002.jpg 1280*720
                  ./img_0005.jpg 1280*720
                  ./launcher.png 385*632
                  ./textfield.png 402*329
                  ./foo2.png 202*229





                  share|improve this answer



























                  • I have imagemagick already installed. I enter your command in the folder with jpg and png images, and there are also xmp files, and it shows me some errors which I don't understand: 'identify.im6: unable to open image ./estrada: No such file or directory @ error/blob.c/OpenBlob/2638. identify.im6: no decode delegate for this image format ./estrada @ error/constitute.c/ReadImage/544.' If thats important, filenames doesn't contain spaces.

                    – Bartek
                    Jul 7 '14 at 16:26












                  • You have to use the first find command correctly to filter only images otherwise identify will fail with this error. I got it when I tried find . -iname "*"

                    – Sylvain Pineau
                    Jul 7 '14 at 18:59











                  • I've added support for filenames containing spaces. Please try again the new command

                    – Sylvain Pineau
                    Jul 8 '14 at 12:09















                  5
















                  If you're looking for a command-line tool, the following command will sort image files where the highest resolution comes first:



                  find . -iname "*.png" -o -iname "*.jpg" | perl -e '$f=subeval(`identify -format %w*%h $quotemeta(shift) 2>/dev/null`);print sort$f->($b)<=>$f->($a)<>'


                  I'm basically sorting the files using perl sort sub-subroutine where the key here is to call the identify command and eval its formatted output.



                  identify is available with the imagemagick package:



                  sudo apt-get install imagemagick


                  UPDATE:



                  The following command will also output the resolution:



                  find . -iname "*.png" -o -iname "*.jpg" | perl -e '$f=sub`identify -format %w*%h $quotemeta(shift) 2>/dev/null`;chomp&&print "$_t".$f->($_) for sorteval($f->($b))<=>eval($f->($a))<>'


                  Example:



                  ./foo bar.png 1600*900
                  ./baz.png 1600*900
                  ./img_0004.jpg 1280*720
                  ./img_0006.jpg 1280*720
                  ./img_0001.jpg 1280*720
                  ./img_0003.jpg 1280*720
                  ./img_0002.jpg 1280*720
                  ./img_0005.jpg 1280*720
                  ./launcher.png 385*632
                  ./textfield.png 402*329
                  ./foo2.png 202*229





                  share|improve this answer



























                  • I have imagemagick already installed. I enter your command in the folder with jpg and png images, and there are also xmp files, and it shows me some errors which I don't understand: 'identify.im6: unable to open image ./estrada: No such file or directory @ error/blob.c/OpenBlob/2638. identify.im6: no decode delegate for this image format ./estrada @ error/constitute.c/ReadImage/544.' If thats important, filenames doesn't contain spaces.

                    – Bartek
                    Jul 7 '14 at 16:26












                  • You have to use the first find command correctly to filter only images otherwise identify will fail with this error. I got it when I tried find . -iname "*"

                    – Sylvain Pineau
                    Jul 7 '14 at 18:59











                  • I've added support for filenames containing spaces. Please try again the new command

                    – Sylvain Pineau
                    Jul 8 '14 at 12:09













                  5














                  5










                  5









                  If you're looking for a command-line tool, the following command will sort image files where the highest resolution comes first:



                  find . -iname "*.png" -o -iname "*.jpg" | perl -e '$f=subeval(`identify -format %w*%h $quotemeta(shift) 2>/dev/null`);print sort$f->($b)<=>$f->($a)<>'


                  I'm basically sorting the files using perl sort sub-subroutine where the key here is to call the identify command and eval its formatted output.



                  identify is available with the imagemagick package:



                  sudo apt-get install imagemagick


                  UPDATE:



                  The following command will also output the resolution:



                  find . -iname "*.png" -o -iname "*.jpg" | perl -e '$f=sub`identify -format %w*%h $quotemeta(shift) 2>/dev/null`;chomp&&print "$_t".$f->($_) for sorteval($f->($b))<=>eval($f->($a))<>'


                  Example:



                  ./foo bar.png 1600*900
                  ./baz.png 1600*900
                  ./img_0004.jpg 1280*720
                  ./img_0006.jpg 1280*720
                  ./img_0001.jpg 1280*720
                  ./img_0003.jpg 1280*720
                  ./img_0002.jpg 1280*720
                  ./img_0005.jpg 1280*720
                  ./launcher.png 385*632
                  ./textfield.png 402*329
                  ./foo2.png 202*229





                  share|improve this answer















                  If you're looking for a command-line tool, the following command will sort image files where the highest resolution comes first:



                  find . -iname "*.png" -o -iname "*.jpg" | perl -e '$f=subeval(`identify -format %w*%h $quotemeta(shift) 2>/dev/null`);print sort$f->($b)<=>$f->($a)<>'


                  I'm basically sorting the files using perl sort sub-subroutine where the key here is to call the identify command and eval its formatted output.



                  identify is available with the imagemagick package:



                  sudo apt-get install imagemagick


                  UPDATE:



                  The following command will also output the resolution:



                  find . -iname "*.png" -o -iname "*.jpg" | perl -e '$f=sub`identify -format %w*%h $quotemeta(shift) 2>/dev/null`;chomp&&print "$_t".$f->($_) for sorteval($f->($b))<=>eval($f->($a))<>'


                  Example:



                  ./foo bar.png 1600*900
                  ./baz.png 1600*900
                  ./img_0004.jpg 1280*720
                  ./img_0006.jpg 1280*720
                  ./img_0001.jpg 1280*720
                  ./img_0003.jpg 1280*720
                  ./img_0002.jpg 1280*720
                  ./img_0005.jpg 1280*720
                  ./launcher.png 385*632
                  ./textfield.png 402*329
                  ./foo2.png 202*229






                  share|improve this answer














                  share|improve this answer



                  share|improve this answer








                  edited Jul 8 '14 at 12:18

























                  answered Jul 7 '14 at 11:13









                  Sylvain PineauSylvain Pineau

                  51.3k16 gold badges114 silver badges158 bronze badges




                  51.3k16 gold badges114 silver badges158 bronze badges















                  • I have imagemagick already installed. I enter your command in the folder with jpg and png images, and there are also xmp files, and it shows me some errors which I don't understand: 'identify.im6: unable to open image ./estrada: No such file or directory @ error/blob.c/OpenBlob/2638. identify.im6: no decode delegate for this image format ./estrada @ error/constitute.c/ReadImage/544.' If thats important, filenames doesn't contain spaces.

                    – Bartek
                    Jul 7 '14 at 16:26












                  • You have to use the first find command correctly to filter only images otherwise identify will fail with this error. I got it when I tried find . -iname "*"

                    – Sylvain Pineau
                    Jul 7 '14 at 18:59











                  • I've added support for filenames containing spaces. Please try again the new command

                    – Sylvain Pineau
                    Jul 8 '14 at 12:09

















                  • I have imagemagick already installed. I enter your command in the folder with jpg and png images, and there are also xmp files, and it shows me some errors which I don't understand: 'identify.im6: unable to open image ./estrada: No such file or directory @ error/blob.c/OpenBlob/2638. identify.im6: no decode delegate for this image format ./estrada @ error/constitute.c/ReadImage/544.' If thats important, filenames doesn't contain spaces.

                    – Bartek
                    Jul 7 '14 at 16:26












                  • You have to use the first find command correctly to filter only images otherwise identify will fail with this error. I got it when I tried find . -iname "*"

                    – Sylvain Pineau
                    Jul 7 '14 at 18:59











                  • I've added support for filenames containing spaces. Please try again the new command

                    – Sylvain Pineau
                    Jul 8 '14 at 12:09
















                  I have imagemagick already installed. I enter your command in the folder with jpg and png images, and there are also xmp files, and it shows me some errors which I don't understand: 'identify.im6: unable to open image ./estrada: No such file or directory @ error/blob.c/OpenBlob/2638. identify.im6: no decode delegate for this image format ./estrada @ error/constitute.c/ReadImage/544.' If thats important, filenames doesn't contain spaces.

                  – Bartek
                  Jul 7 '14 at 16:26






                  I have imagemagick already installed. I enter your command in the folder with jpg and png images, and there are also xmp files, and it shows me some errors which I don't understand: 'identify.im6: unable to open image ./estrada: No such file or directory @ error/blob.c/OpenBlob/2638. identify.im6: no decode delegate for this image format ./estrada @ error/constitute.c/ReadImage/544.' If thats important, filenames doesn't contain spaces.

                  – Bartek
                  Jul 7 '14 at 16:26














                  You have to use the first find command correctly to filter only images otherwise identify will fail with this error. I got it when I tried find . -iname "*"

                  – Sylvain Pineau
                  Jul 7 '14 at 18:59





                  You have to use the first find command correctly to filter only images otherwise identify will fail with this error. I got it when I tried find . -iname "*"

                  – Sylvain Pineau
                  Jul 7 '14 at 18:59













                  I've added support for filenames containing spaces. Please try again the new command

                  – Sylvain Pineau
                  Jul 8 '14 at 12:09





                  I've added support for filenames containing spaces. Please try again the new command

                  – Sylvain Pineau
                  Jul 8 '14 at 12:09











                  2
















                  Using find, file --mime-type, identify, awk and sort



                  Using file --mime-type we find all images, even without an extension.



                  The one-line at the end of this answer has a problem with newlines in the file name. Therefore here an other version:



                  find . -type f -exec sh -c 'file --brief --mime-type "$0" |
                  grep -q ^image/ && identify -format "%[fx:w*h] %in" "$0"' ; |
                  sort -g


                  Sample output



                  26696 ./OWoHp.png
                  37975 ./hUXnc.png
                  47275 ./foo
                  bar.png


                  This is the file with the newline in the filename:



                  47275 ./foo
                  bar.png


                  Many thanks @terdon, @don_crissti and @glennjackman for the answers here.




                  Old version with a problem if the filename contains newlines



                  find . -type f -print0 | 
                  xargs -0 -I file --mime-type |
                  awk -F$"" -F": " '/image/ print $1' |
                  xargs -I identify -format "%[fx:w*h] %in" |
                  sort -g



                  Sample output



                  9216 ./.face
                  27918 ./Unbenannt.png
                  1.0368e+06 ./Images/Wallpapers/14-13.jpg
                  1.57292e+07 ./Images/Wallpapers/wallpaper_19.jpg
                  1.57292e+07 ./Images/Wallpapers/wallpaper_22.jpg
                  1.92e+06 ./Images/Wallpapers/black (10).jpg
                  2.304e+06 ./Images/Wallpapers/1920x1200.jpg
                  2.304e+06 ./Images/Wallpapers/1920x1200_Seria_Lunar-Melodies.png
                  2.304e+06 ./Images/Wallpapers/Anime_girl_129177.jpg
                  2.304e+06 ./Images/Wallpapers/wallpaper-1802661.jpg
                  2.304e+06 ./Images/Wallpapers/wallpaper-264390.jpg
                  3.14368e+06 ./Images/Wallpapers/14 - 2.jpg
                  3.6864e+06 ./Images/Wallpapers/14-1.jpg
                  4.096e+06 ./Images/Wallpapers/wallpaper-2850337.jpg
                  4.096e+06 ./Images/Wallpapers/wt4NRqA.jpg
                  7.0969e+06 ./Images/Wallpapers/14 - 1.png





                  share|improve this answer































                    2
















                    Using find, file --mime-type, identify, awk and sort



                    Using file --mime-type we find all images, even without an extension.



                    The one-line at the end of this answer has a problem with newlines in the file name. Therefore here an other version:



                    find . -type f -exec sh -c 'file --brief --mime-type "$0" |
                    grep -q ^image/ && identify -format "%[fx:w*h] %in" "$0"' ; |
                    sort -g


                    Sample output



                    26696 ./OWoHp.png
                    37975 ./hUXnc.png
                    47275 ./foo
                    bar.png


                    This is the file with the newline in the filename:



                    47275 ./foo
                    bar.png


                    Many thanks @terdon, @don_crissti and @glennjackman for the answers here.




                    Old version with a problem if the filename contains newlines



                    find . -type f -print0 | 
                    xargs -0 -I file --mime-type |
                    awk -F$"" -F": " '/image/ print $1' |
                    xargs -I identify -format "%[fx:w*h] %in" |
                    sort -g



                    Sample output



                    9216 ./.face
                    27918 ./Unbenannt.png
                    1.0368e+06 ./Images/Wallpapers/14-13.jpg
                    1.57292e+07 ./Images/Wallpapers/wallpaper_19.jpg
                    1.57292e+07 ./Images/Wallpapers/wallpaper_22.jpg
                    1.92e+06 ./Images/Wallpapers/black (10).jpg
                    2.304e+06 ./Images/Wallpapers/1920x1200.jpg
                    2.304e+06 ./Images/Wallpapers/1920x1200_Seria_Lunar-Melodies.png
                    2.304e+06 ./Images/Wallpapers/Anime_girl_129177.jpg
                    2.304e+06 ./Images/Wallpapers/wallpaper-1802661.jpg
                    2.304e+06 ./Images/Wallpapers/wallpaper-264390.jpg
                    3.14368e+06 ./Images/Wallpapers/14 - 2.jpg
                    3.6864e+06 ./Images/Wallpapers/14-1.jpg
                    4.096e+06 ./Images/Wallpapers/wallpaper-2850337.jpg
                    4.096e+06 ./Images/Wallpapers/wt4NRqA.jpg
                    7.0969e+06 ./Images/Wallpapers/14 - 1.png





                    share|improve this answer





























                      2














                      2










                      2









                      Using find, file --mime-type, identify, awk and sort



                      Using file --mime-type we find all images, even without an extension.



                      The one-line at the end of this answer has a problem with newlines in the file name. Therefore here an other version:



                      find . -type f -exec sh -c 'file --brief --mime-type "$0" |
                      grep -q ^image/ && identify -format "%[fx:w*h] %in" "$0"' ; |
                      sort -g


                      Sample output



                      26696 ./OWoHp.png
                      37975 ./hUXnc.png
                      47275 ./foo
                      bar.png


                      This is the file with the newline in the filename:



                      47275 ./foo
                      bar.png


                      Many thanks @terdon, @don_crissti and @glennjackman for the answers here.




                      Old version with a problem if the filename contains newlines



                      find . -type f -print0 | 
                      xargs -0 -I file --mime-type |
                      awk -F$"" -F": " '/image/ print $1' |
                      xargs -I identify -format "%[fx:w*h] %in" |
                      sort -g



                      Sample output



                      9216 ./.face
                      27918 ./Unbenannt.png
                      1.0368e+06 ./Images/Wallpapers/14-13.jpg
                      1.57292e+07 ./Images/Wallpapers/wallpaper_19.jpg
                      1.57292e+07 ./Images/Wallpapers/wallpaper_22.jpg
                      1.92e+06 ./Images/Wallpapers/black (10).jpg
                      2.304e+06 ./Images/Wallpapers/1920x1200.jpg
                      2.304e+06 ./Images/Wallpapers/1920x1200_Seria_Lunar-Melodies.png
                      2.304e+06 ./Images/Wallpapers/Anime_girl_129177.jpg
                      2.304e+06 ./Images/Wallpapers/wallpaper-1802661.jpg
                      2.304e+06 ./Images/Wallpapers/wallpaper-264390.jpg
                      3.14368e+06 ./Images/Wallpapers/14 - 2.jpg
                      3.6864e+06 ./Images/Wallpapers/14-1.jpg
                      4.096e+06 ./Images/Wallpapers/wallpaper-2850337.jpg
                      4.096e+06 ./Images/Wallpapers/wt4NRqA.jpg
                      7.0969e+06 ./Images/Wallpapers/14 - 1.png





                      share|improve this answer















                      Using find, file --mime-type, identify, awk and sort



                      Using file --mime-type we find all images, even without an extension.



                      The one-line at the end of this answer has a problem with newlines in the file name. Therefore here an other version:



                      find . -type f -exec sh -c 'file --brief --mime-type "$0" |
                      grep -q ^image/ && identify -format "%[fx:w*h] %in" "$0"' ; |
                      sort -g


                      Sample output



                      26696 ./OWoHp.png
                      37975 ./hUXnc.png
                      47275 ./foo
                      bar.png


                      This is the file with the newline in the filename:



                      47275 ./foo
                      bar.png


                      Many thanks @terdon, @don_crissti and @glennjackman for the answers here.




                      Old version with a problem if the filename contains newlines



                      find . -type f -print0 | 
                      xargs -0 -I file --mime-type |
                      awk -F$"" -F": " '/image/ print $1' |
                      xargs -I identify -format "%[fx:w*h] %in" |
                      sort -g



                      Sample output



                      9216 ./.face
                      27918 ./Unbenannt.png
                      1.0368e+06 ./Images/Wallpapers/14-13.jpg
                      1.57292e+07 ./Images/Wallpapers/wallpaper_19.jpg
                      1.57292e+07 ./Images/Wallpapers/wallpaper_22.jpg
                      1.92e+06 ./Images/Wallpapers/black (10).jpg
                      2.304e+06 ./Images/Wallpapers/1920x1200.jpg
                      2.304e+06 ./Images/Wallpapers/1920x1200_Seria_Lunar-Melodies.png
                      2.304e+06 ./Images/Wallpapers/Anime_girl_129177.jpg
                      2.304e+06 ./Images/Wallpapers/wallpaper-1802661.jpg
                      2.304e+06 ./Images/Wallpapers/wallpaper-264390.jpg
                      3.14368e+06 ./Images/Wallpapers/14 - 2.jpg
                      3.6864e+06 ./Images/Wallpapers/14-1.jpg
                      4.096e+06 ./Images/Wallpapers/wallpaper-2850337.jpg
                      4.096e+06 ./Images/Wallpapers/wt4NRqA.jpg
                      7.0969e+06 ./Images/Wallpapers/14 - 1.png






                      share|improve this answer














                      share|improve this answer



                      share|improve this answer








                      edited Apr 13 '17 at 12:37









                      Community

                      1




                      1










                      answered Jun 27 '15 at 15:33









                      A.B.A.B.

                      72.7k12 gold badges188 silver badges277 bronze badges




                      72.7k12 gold badges188 silver badges277 bronze badges
























                          1
















                          Late to the party but here's my version with find,exiftool,and sort:



                          find . -exec exiftool -S -t -q -FileName -ImageSize + | sort -k2n,2



                          It's a bit slow, but works. Sample output:



                          $ find Downloads -exec exiftool -S -t -q -FileName -ImageSize + | sort -k2n,2 

                          1433695350670.jpg 1600x1000
                          1433695350670.jpg 1600x1000
                          1434999385912.jpg 2212x3318
                          1434999385912.jpg 2212x3318
                          1433524966694.jpg 2688x1520
                          1433524966694.jpg 2688x1520
                          1433525301504.jpg 2688x1520
                          1433525301504.jpg 2688x1520





                          share|improve this answer





























                            1
















                            Late to the party but here's my version with find,exiftool,and sort:



                            find . -exec exiftool -S -t -q -FileName -ImageSize + | sort -k2n,2



                            It's a bit slow, but works. Sample output:



                            $ find Downloads -exec exiftool -S -t -q -FileName -ImageSize + | sort -k2n,2 

                            1433695350670.jpg 1600x1000
                            1433695350670.jpg 1600x1000
                            1434999385912.jpg 2212x3318
                            1434999385912.jpg 2212x3318
                            1433524966694.jpg 2688x1520
                            1433524966694.jpg 2688x1520
                            1433525301504.jpg 2688x1520
                            1433525301504.jpg 2688x1520





                            share|improve this answer



























                              1














                              1










                              1









                              Late to the party but here's my version with find,exiftool,and sort:



                              find . -exec exiftool -S -t -q -FileName -ImageSize + | sort -k2n,2



                              It's a bit slow, but works. Sample output:



                              $ find Downloads -exec exiftool -S -t -q -FileName -ImageSize + | sort -k2n,2 

                              1433695350670.jpg 1600x1000
                              1433695350670.jpg 1600x1000
                              1434999385912.jpg 2212x3318
                              1434999385912.jpg 2212x3318
                              1433524966694.jpg 2688x1520
                              1433524966694.jpg 2688x1520
                              1433525301504.jpg 2688x1520
                              1433525301504.jpg 2688x1520





                              share|improve this answer













                              Late to the party but here's my version with find,exiftool,and sort:



                              find . -exec exiftool -S -t -q -FileName -ImageSize + | sort -k2n,2



                              It's a bit slow, but works. Sample output:



                              $ find Downloads -exec exiftool -S -t -q -FileName -ImageSize + | sort -k2n,2 

                              1433695350670.jpg 1600x1000
                              1433695350670.jpg 1600x1000
                              1434999385912.jpg 2212x3318
                              1434999385912.jpg 2212x3318
                              1433524966694.jpg 2688x1520
                              1433524966694.jpg 2688x1520
                              1433525301504.jpg 2688x1520
                              1433525301504.jpg 2688x1520






                              share|improve this answer












                              share|improve this answer



                              share|improve this answer










                              answered Jun 28 '15 at 16:38









                              Sergiy KolodyazhnyySergiy Kolodyazhnyy

                              79.4k11 gold badges171 silver badges354 bronze badges




                              79.4k11 gold badges171 silver badges354 bronze badges
























                                  1
















                                  Geeqie can sort by image size.



                                  sudo apt install geeqie





                                  share|improve this answer





























                                    1
















                                    Geeqie can sort by image size.



                                    sudo apt install geeqie





                                    share|improve this answer



























                                      1














                                      1










                                      1









                                      Geeqie can sort by image size.



                                      sudo apt install geeqie





                                      share|improve this answer













                                      Geeqie can sort by image size.



                                      sudo apt install geeqie






                                      share|improve this answer












                                      share|improve this answer



                                      share|improve this answer










                                      answered Jun 25 '18 at 10:04









                                      pLumopLumo

                                      11.1k1 gold badge24 silver badges51 bronze badges




                                      11.1k1 gold badge24 silver badges51 bronze badges
























                                          0
















                                          Oli's answer works. Here is a modification to list minimum of width and height



                                          find * -type f -exec identify -format "%[fx:w>h?h:w] %in" + | sort -g





                                          share|improve this answer





























                                            0
















                                            Oli's answer works. Here is a modification to list minimum of width and height



                                            find * -type f -exec identify -format "%[fx:w>h?h:w] %in" + | sort -g





                                            share|improve this answer



























                                              0














                                              0










                                              0









                                              Oli's answer works. Here is a modification to list minimum of width and height



                                              find * -type f -exec identify -format "%[fx:w>h?h:w] %in" + | sort -g





                                              share|improve this answer













                                              Oli's answer works. Here is a modification to list minimum of width and height



                                              find * -type f -exec identify -format "%[fx:w>h?h:w] %in" + | sort -g






                                              share|improve this answer












                                              share|improve this answer



                                              share|improve this answer










                                              answered Apr 16 at 13:30









                                              bilabilabilabila

                                              1313 bronze badges




                                              1313 bronze badges































                                                  draft saved

                                                  draft discarded















































                                                  Thanks for contributing an answer to Ask Ubuntu!


                                                  • 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.




                                                  draft saved


                                                  draft discarded














                                                  StackExchange.ready(
                                                  function ()
                                                  StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f492660%2fsort-by-image-resolution-dimensions%23new-answer', 'question_page');

                                                  );

                                                  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







                                                  Popular posts from this blog

                                                  Tamil (spriik) Luke uk diar | Nawigatjuun

                                                  Align equal signs while including text over equalitiesAMS align: left aligned text/math plus multicolumn alignmentMultiple alignmentsAligning equations in multiple placesNumbering and aligning an equation with multiple columnsHow to align one equation with another multline equationUsing \ in environments inside the begintabularxNumber equations and preserving alignment of equal signsHow can I align equations to the left and to the right?Double equation alignment problem within align enviromentAligned within align: Why are they right-aligned?

                                                  Where does the image of a data connector as a sharp metal spike originate from?Where does the concept of infected people turning into zombies only after death originate from?Where does the motif of a reanimated human head originate?Where did the notion that Dragons could speak originate?Where does the archetypal image of the 'Grey' alien come from?Where did the suffix '-Man' originate?Where does the notion of being injured or killed by an illusion originate?Where did the term “sophont” originate?Where does the trope of magic spells being driven by advanced technology originate from?Where did the term “the living impaired” originate?