Skip to content

Custom image: Exception calling ".ctor" with "1" argument(s): "Parameter is not valid." #105

Closed
@tripplehelix

Description

When I try to use a custom png I get this error, are there requirements or something I'm missing?

New-Object: C:\Users\Tom\scoop\apps\winfetch\current\winfetch.ps1:390
Line |
 390 |  … $OldImage = New-Object -TypeName System.Drawing.Bitmap -ArgumentList  …
     |                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     | Exception calling ".ctor" with "1" argument(s): "Parameter is not valid."

RuntimeException: C:\Users\Tom\scoop\apps\winfetch\current\winfetch.ps1:391
Line |
 391 |          $ROWS = $OldImage.Height / $OldImage.Width * $COLUMNS
     |          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     | Attempted to divide by zero.

New-Object: C:\Users\Tom\scoop\apps\winfetch\current\winfetch.ps1:394
Line |
 394 |  …   $Bitmap = New-Object -TypeName System.Drawing.Bitmap -ArgumentList  …
     |                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     | Exception calling ".ctor" with "2" argument(s): "Parameter is not valid."

MethodInvocationException: C:\Users\Tom\scoop\apps\winfetch\current\winfetch.ps1:395
Line |
 395 |          $NewImage = [System.Drawing.Graphics]::FromImage($Bitmap)
     |          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     | Exception calling "FromImage" with "1" argument(s): "Value cannot be
     | null. (Parameter 'image')"

InvalidOperation: C:\Users\Tom\scoop\apps\winfetch\current\winfetch.ps1:396
Line |
 396 |  … OldImage, $(New-Object -TypeName System.Drawing.Rectangle -ArgumentLi …
     |                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     | You cannot call a method on a null-valued expression.

InvalidOperation: C:\Users\Tom\scoop\apps\winfetch\current\winfetch.ps1:415
Line |
 415 |          $Bitmap.Dispose()
     |          ~~~~~~~~~~~~~~~~~
     | You cannot call a method on a null-valued expression.

InvalidOperation: C:\Users\Tom\scoop\apps\winfetch\current\winfetch.ps1:416
Line |
 416 |          $NewImage.Dispose()
     |          ~~~~~~~~~~~~~~~~~~~
     | You cannot call a method on a null-valued expression.

InvalidOperation: C:\Users\Tom\scoop\apps\winfetch\current\winfetch.ps1:417
Line |
 417 |          $OldImage.Dispose()
     |          ~~~~~~~~~~~~~~~~~~~
     | You cannot call a method on a null-valued expression.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions