Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 830599
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T04:04:13+00:00 2026-05-15T04:04:13+00:00

I am interested in file searching by custom properties. For example, I want to

  • 0

I am interested in file searching by custom properties. For example, I want to find all JPEG-images with certain dimensions. Something looks like

Get-ChildItem -Path C:\ -Filter *.jpg -Recursive | where-object { $_.Dimension -eq '1024x768' }

I suspect it’s about using of System.Drawing. How it can be done?
Thanks in advance

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T04:04:14+00:00Added an answer on May 15, 2026 at 4:04 am

    That’s actually pretty easy to do and your gut feeling about System.Drawing was in fact correct:

    Add-Type -Assembly System.Drawing
    
    $input | ForEach-Object { [Drawing.Image]::FromFile($_) }
    

    Save that as Get-Image.ps1 somewhere in your path and then you can use it.

    Another option would be to add the following to your $profile:

    Add-Type -Assembly System.Drawing
    
    function Get-Image {
        $input | ForEach-Object { [Drawing.Image]::FromFile($_) }
    }
    

    which works pretty much the same. Of course, add fancy things like documentation or so as you see fit.

    You can then use it like so:

    gci -inc *.jpg -rec | Get-Image | ? { $_.Width -eq 1024 -and $_.Height -eq 768 }
    

    Note that you should dispose the objects created this way after using them.

    Of course, you can add a custom Dimension property so you could filter for that:

    function Get-Image {
        $input |
            ForEach-Object { [Drawing.Image]::FromFile($_) } |
            ForEach-Object {
                $_ | Add-Member -PassThru NoteProperty Dimension ('{0}x{1}' -f $_.Width,$_.Height)
            }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to read a text file line by line, but I'm not interested
I tried searching for this, but couldn't find much. It seems like something that's
Interested in building my own drag'n'drop file uploader using JQuery/AJAX/PHP. Basically I want a
I am interested in using a class file (CameraPreview.java) from this package com.example.android.apis.graphics. I
I'm interested in precisely extracting portions of a PCM WAV file, down to the
I am interested in detecting the MIME-type for a file in the documents directory
I'm interested in knowing how revision-control systems do merging. Suppose you have a file
I am interested in one topic, suppose that we have eight file, each containing
I have a massive XML file. However, I'm only interested in a single small
How can non-blocking disk I/O be implemented? I'm interested in file and raw.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.