I have several instruments and software packages that can create screen captures, and the capture files commonly need some mix of image processing including for example:
- cropping;
- scaling;
- brightness, contrast, gamma adjustment;
- transparency change;
- format conversion; and
- file copy / archive / cleanup.
Above is an example. Though WordPress presents a small image inline, if you click on it, there is a 640×480 image that was created from a QVGA (320×240) screen capture file scaled and gamma adjusted.
To ensure standardised processing of the images so they look consistent when presented, I have a series of scripts for processing the images.
The following is an example Powershell script for processing images from several DSOs that I use. The image processor is Imagemagick.
#powershell script for tweaks to instrument capture files #Owen Duffy param([switch] $delsrc) $imagemagick="magick.exe" $path=Convert-path . write-host path=$path function procimage($ft,$se,$de,$iprms){ #process image bitmaps $images=get-childitem $ft -recurse #Write-Host $images foreach($image in $images){ #get-itemproperty $image | format-list $lwt=$image.LastWriteTime $sf=$image.fullname Write-Host "" Write-Host "Source file: $sf" $df=$sf -replace '\.[^.\\/]+$',$de if(test-path $df){ if($image.lastwritetime -le (get-item $df).lastwritetime){write-host "...skipping"; continue} } Write-Host "...convert ""$sf"" to ""$df""" & $imagemagick convert ""$sf"" $iprms ""$df"" if($?){ $dest= Get-ChildItem -path $df Set-Itemproperty $dest -name CreationTime -value $lwt Set-Itemproperty $dest -name LastWriteTime -value $lwt Set-Itemproperty $dest -name LastAccessTime -value $lwt #get-itemproperty $dest |format-list $cf=$image.basename+$de if(-not (test-path $cf)){write-host "...copy to ""$cf"""; Copy-Item $df $cf} if($delsrc){remove-item "$sf"} } } } #add timestamp to files with missing timestamp (some Rigol) Get-ChildItem -Path $path -Recurse -Force | Where-Object { !$_.PSIsContainer -and $_.LastWriteTime -lt [datetime]"02/01/1980" } | Set-Itemproperty -name LastWriteTime -value (Get-Date) #Tek procimage ".\ALL*\*.bmp" ".bmp" ".png" "-gamma","0.7,0.7,0.7","-resize","200%" #Hantek procimage ".\pic_*\*.bmp" ".bmp" ".png" Write-Host "Press any key to continue ..." $x=$host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown") exit
The powershell script resides on the hard disk, and I have created a shortcut to run it.
The shortcut is copied to the USB sticks so it is conveniently accessible when viewing the contents of the stick, and double clicking the shortcut runs the conversion. You will note that the modified time of the shortcut is way into the future so that it always appears at the top of the time descending sorted list so it is easy to find and right with the recent files / directories.
Above, the Target on the shortcut is not the bare script, but powershell followed by the script name. Though Microsoft went to some trouble to prevent powershell scripts running on double-click, the above trick is an easy circumvention in this case.