• Welcome to TechPowerUp Forums, Guest! Please check out our forum guidelines for info related to our community.

CMD Resolution Sorter

beesagtig

New Member
Joined
Dec 2, 2008
Messages
237 (0.04/day)
Processor E8400
Motherboard eVGA 780i
Cooling Xigmatec S1283
Memory 4gb OCZ Platinum
Video Card(s) XFX 9800GTX
Storage Seagate 500gb 32mb cache x 2
Display(s) Benq T22IW 1680X1050/Acer AL1716 1280X1024 x 2
Case Antec 1200
Audio Device(s) Intergrated
Power Supply CoolerMaster 650W Extreme SLI Ready
Software Vista Home Premium 64bit
Hey

I'm trying to make a simple batch program to sort background's into folders depending on their resolution and want to know how do you get the batch to check the resolution?

Thanks
 

FordGT90Concept

"I go fast!1!11!1!"
Joined
Oct 13, 2008
Messages
26,259 (4.63/day)
Location
IA, USA
System Name BY-2021
Processor AMD Ryzen 7 5800X (65w eco profile)
Motherboard MSI B550 Gaming Plus
Cooling Scythe Mugen (rev 5)
Memory 2 x Kingston HyperX DDR4-3200 32 GiB
Video Card(s) AMD Radeon RX 7900 XT
Storage Samsung 980 Pro, Seagate Exos X20 TB 7200 RPM
Display(s) Nixeus NX-EDG274K (3840x2160@144 DP) + Samsung SyncMaster 906BW (1440x900@60 HDMI-DVI)
Case Coolermaster HAF 932 w/ USB 3.0 5.25" bay + USB 3.2 (A+C) 3.5" bay
Audio Device(s) Realtek ALC1150, Micca OriGen+
Power Supply Enermax Platimax 850w
Mouse Nixeus REVEL-X
Keyboard Tesoro Excalibur
Software Windows 10 Home 64-bit
Benchmark Scores Faster than the tortoise; slower than the hare.
A batch can't check resolutions. I think the only way you could achieve that with a batch is to have a program rename all the files placing the resolution in the name (e.g. file.jpg -> 01200x00768-file.jpg).

It wouldn't be too hard to create a small app that does this for you.
 

beesagtig

New Member
Joined
Dec 2, 2008
Messages
237 (0.04/day)
Processor E8400
Motherboard eVGA 780i
Cooling Xigmatec S1283
Memory 4gb OCZ Platinum
Video Card(s) XFX 9800GTX
Storage Seagate 500gb 32mb cache x 2
Display(s) Benq T22IW 1680X1050/Acer AL1716 1280X1024 x 2
Case Antec 1200
Audio Device(s) Intergrated
Power Supply CoolerMaster 650W Extreme SLI Ready
Software Vista Home Premium 64bit
ok thanks:)

what should I use to change the names?
 
Last edited:
Joined
Aug 24, 2007
Messages
443 (0.07/day)
Location
BY-S36
System Name Bitch / Dogma
Processor 955 BE @ 3.8Gig / 9850 @stock
Video Card(s) 8800 GTX 512 / 4890
Storage 8 x Samsung F2 1.5TB, 8 x Seagate 500s
Display(s) Acer 24 / Dell 24
Case Lian li / Akasa
Software Win server 2008 / Win 7
It's possible that IrfanView could do what you are looking for, I certainly know it can batch process images for resizing etc so maybe copy/move is an option also.
 

FordGT90Concept

"I go fast!1!11!1!"
Joined
Oct 13, 2008
Messages
26,259 (4.63/day)
Location
IA, USA
System Name BY-2021
Processor AMD Ryzen 7 5800X (65w eco profile)
Motherboard MSI B550 Gaming Plus
Cooling Scythe Mugen (rev 5)
Memory 2 x Kingston HyperX DDR4-3200 32 GiB
Video Card(s) AMD Radeon RX 7900 XT
Storage Samsung 980 Pro, Seagate Exos X20 TB 7200 RPM
Display(s) Nixeus NX-EDG274K (3840x2160@144 DP) + Samsung SyncMaster 906BW (1440x900@60 HDMI-DVI)
Case Coolermaster HAF 932 w/ USB 3.0 5.25" bay + USB 3.2 (A+C) 3.5" bay
Audio Device(s) Realtek ALC1150, Micca OriGen+
Power Supply Enermax Platimax 850w
Mouse Nixeus REVEL-X
Keyboard Tesoro Excalibur
Software Windows 10 Home 64-bit
Benchmark Scores Faster than the tortoise; slower than the hare.
What kind of files are these (JPG, PNG, etc.)? I could make something to do what you are asking but it probably wouldn't be available until Monday at the earliest.
 

beesagtig

New Member
Joined
Dec 2, 2008
Messages
237 (0.04/day)
Processor E8400
Motherboard eVGA 780i
Cooling Xigmatec S1283
Memory 4gb OCZ Platinum
Video Card(s) XFX 9800GTX
Storage Seagate 500gb 32mb cache x 2
Display(s) Benq T22IW 1680X1050/Acer AL1716 1280X1024 x 2
Case Antec 1200
Audio Device(s) Intergrated
Power Supply CoolerMaster 650W Extreme SLI Ready
Software Vista Home Premium 64bit
really? that would be awesome. They are mostly jpegs.
 

FordGT90Concept

"I go fast!1!11!1!"
Joined
Oct 13, 2008
Messages
26,259 (4.63/day)
Location
IA, USA
System Name BY-2021
Processor AMD Ryzen 7 5800X (65w eco profile)
Motherboard MSI B550 Gaming Plus
Cooling Scythe Mugen (rev 5)
Memory 2 x Kingston HyperX DDR4-3200 32 GiB
Video Card(s) AMD Radeon RX 7900 XT
Storage Samsung 980 Pro, Seagate Exos X20 TB 7200 RPM
Display(s) Nixeus NX-EDG274K (3840x2160@144 DP) + Samsung SyncMaster 906BW (1440x900@60 HDMI-DVI)
Case Coolermaster HAF 932 w/ USB 3.0 5.25" bay + USB 3.2 (A+C) 3.5" bay
Audio Device(s) Realtek ALC1150, Micca OriGen+
Power Supply Enermax Platimax 850w
Mouse Nixeus REVEL-X
Keyboard Tesoro Excalibur
Software Windows 10 Home 64-bit
Benchmark Scores Faster than the tortoise; slower than the hare.
What specific criteria do you want me to implement? Like...

if height < 100 and width < 200 move to "small" folder
if height > 4000 and width > 6000 move to "large" folder

...or, I could just make one folder per resolution.
 

beesagtig

New Member
Joined
Dec 2, 2008
Messages
237 (0.04/day)
Processor E8400
Motherboard eVGA 780i
Cooling Xigmatec S1283
Memory 4gb OCZ Platinum
Video Card(s) XFX 9800GTX
Storage Seagate 500gb 32mb cache x 2
Display(s) Benq T22IW 1680X1050/Acer AL1716 1280X1024 x 2
Case Antec 1200
Audio Device(s) Intergrated
Power Supply CoolerMaster 650W Extreme SLI Ready
Software Vista Home Premium 64bit
one folder per resolution would be great thanks:)
 

FordGT90Concept

"I go fast!1!11!1!"
Joined
Oct 13, 2008
Messages
26,259 (4.63/day)
Location
IA, USA
System Name BY-2021
Processor AMD Ryzen 7 5800X (65w eco profile)
Motherboard MSI B550 Gaming Plus
Cooling Scythe Mugen (rev 5)
Memory 2 x Kingston HyperX DDR4-3200 32 GiB
Video Card(s) AMD Radeon RX 7900 XT
Storage Samsung 980 Pro, Seagate Exos X20 TB 7200 RPM
Display(s) Nixeus NX-EDG274K (3840x2160@144 DP) + Samsung SyncMaster 906BW (1440x900@60 HDMI-DVI)
Case Coolermaster HAF 932 w/ USB 3.0 5.25" bay + USB 3.2 (A+C) 3.5" bay
Audio Device(s) Realtek ALC1150, Micca OriGen+
Power Supply Enermax Platimax 850w
Mouse Nixeus REVEL-X
Keyboard Tesoro Excalibur
Software Windows 10 Home 64-bit
Benchmark Scores Faster than the tortoise; slower than the hare.
Just extract it to the directory you want to sort and run it. It will create one directory per resolution and copy files to them (read: not move so the originals will still be there). The folders will be named 00000x00000 (width x height). Requires .NET 3.5 to run.
 

Attachments

  • PicSort.zip
    2.5 KB · Views: 188

beesagtig

New Member
Joined
Dec 2, 2008
Messages
237 (0.04/day)
Processor E8400
Motherboard eVGA 780i
Cooling Xigmatec S1283
Memory 4gb OCZ Platinum
Video Card(s) XFX 9800GTX
Storage Seagate 500gb 32mb cache x 2
Display(s) Benq T22IW 1680X1050/Acer AL1716 1280X1024 x 2
Case Antec 1200
Audio Device(s) Intergrated
Power Supply CoolerMaster 650W Extreme SLI Ready
Software Vista Home Premium 64bit
Thankyou very much. works great:)
 

FordGT90Concept

"I go fast!1!11!1!"
Joined
Oct 13, 2008
Messages
26,259 (4.63/day)
Location
IA, USA
System Name BY-2021
Processor AMD Ryzen 7 5800X (65w eco profile)
Motherboard MSI B550 Gaming Plus
Cooling Scythe Mugen (rev 5)
Memory 2 x Kingston HyperX DDR4-3200 32 GiB
Video Card(s) AMD Radeon RX 7900 XT
Storage Samsung 980 Pro, Seagate Exos X20 TB 7200 RPM
Display(s) Nixeus NX-EDG274K (3840x2160@144 DP) + Samsung SyncMaster 906BW (1440x900@60 HDMI-DVI)
Case Coolermaster HAF 932 w/ USB 3.0 5.25" bay + USB 3.2 (A+C) 3.5" bay
Audio Device(s) Realtek ALC1150, Micca OriGen+
Power Supply Enermax Platimax 850w
Mouse Nixeus REVEL-X
Keyboard Tesoro Excalibur
Software Windows 10 Home 64-bit
Benchmark Scores Faster than the tortoise; slower than the hare.
The source, if anyone cares for it...
Code:
using System;
using System.Drawing;
using System.IO;
using System.Reflection;

namespace PicSort
{
    class Program
    {
        static void Main(string[] args)
        {
            string dir = "";
            if (args.Length == 0)
                dir = Path.GetDirectoryName(Assembly.GetExecutingAssembly().GetName().CodeBase).Substring(6);
            if (args.Length == 1)
                dir = args[0];

            if (Directory.Exists(dir))
            {
                string[] types = new string[] { "*.jpg", "*.png", "*.bmp" };
                for (int i = 0; i < types.Length; i++)
                {
                    string[] files = Directory.GetFiles(dir, types[i]);
                    foreach (string file in files)
                    {
                        FileInfo fi = new FileInfo(file);
                        Image img = Image.FromFile(fi.FullName);
                        string newdir = dir + "\\" + img.Width.ToString().PadLeft(5, '0') + "x" + img.Height.ToString().PadLeft(5, '0');
                        Directory.CreateDirectory(newdir);
                        File.Copy(fi.FullName, newdir + "\\" + fi.Name, true);
                    }
                }
            }
            else
                Console.WriteLine("PicSort [directory to sort]");
        }
    }
}
 
Top