PowerShell dot net example
PowerShell dot net example
Hi I'm learning dot net and I was trying to test a simple PowerShell Script to draw something on a TIF. I don't get any error messages but the image is only copied and not modified.
Here's my code:
add-type -Path "C:\users\allan\desktop\GdPicture.NET.10.dll"
$GB = [GdPicture10.GdPictureImaging]::new()
$GB.SetLicenseNumber("000000000000000000000000")
$TIF = "C:\users\Allann\Desktop\x.tif"
$OUTFILE = "C:\users\Allan\Desktop\xxxxxxxxxxxxxxxxxxx.tif"
[int]$IMG
$IMG = $GB.CreateGdPictureImageFromFile($TIF)
$smting = $GB.ARGB(0,0,0,0)
$GB.DrawFilledRectangle($IMG,30,30,30,50,$SMTING,$True)
$GB.DrawText($IMG,"IT WORKED",10,100,22,0,$smting,"ARIAL",$true)
$GB.SaveAsTIFF($IMG,$OUTFILE,4)
-------------------------------------------------------------------------------------------------
I'm want to purchase the license. Could you also tell me which solution I need buy to use just the GD.....dll for writing on JPG and Tif images.
Thanks
Here's my code:
add-type -Path "C:\users\allan\desktop\GdPicture.NET.10.dll"
$GB = [GdPicture10.GdPictureImaging]::new()
$GB.SetLicenseNumber("000000000000000000000000")
$TIF = "C:\users\Allann\Desktop\x.tif"
$OUTFILE = "C:\users\Allan\Desktop\xxxxxxxxxxxxxxxxxxx.tif"
[int]$IMG
$IMG = $GB.CreateGdPictureImageFromFile($TIF)
$smting = $GB.ARGB(0,0,0,0)
$GB.DrawFilledRectangle($IMG,30,30,30,50,$SMTING,$True)
$GB.DrawText($IMG,"IT WORKED",10,100,22,0,$smting,"ARIAL",$true)
$GB.SaveAsTIFF($IMG,$OUTFILE,4)
-------------------------------------------------------------------------------------------------
I'm want to purchase the license. Could you also tell me which solution I need buy to use just the GD.....dll for writing on JPG and Tif images.
Thanks
Re: PowerShell dot net example
Hello,
I would suggest trying the current version of the toolkit for the evaluation period for free:
https://www.gdpicture.com/download-gdpicture/
Here is the comparison matrix for features you may find useful:
https://www.gdpicture.com/products/dotn ... on-matrix/
If you encounter any issue with the current release, please let us know. I can say you nothing about why your code does not work on version 10, as we do not support older versions. If your issue persists with the current release, please send us a code snippet and a related document, so we can investigate further. Fo purchasing the license, please contact the sales department for more details.
I would suggest trying the current version of the toolkit for the evaluation period for free:
https://www.gdpicture.com/download-gdpicture/
Here is the comparison matrix for features you may find useful:
https://www.gdpicture.com/products/dotn ... on-matrix/
If you encounter any issue with the current release, please let us know. I can say you nothing about why your code does not work on version 10, as we do not support older versions. If your issue persists with the current release, please send us a code snippet and a related document, so we can investigate further. Fo purchasing the license, please contact the sales department for more details.
Re: PowerShell dot net example
Thanks for the quick response Gabriela,
I downloaded and applied GdPicture.net.14.dll with the temporary license key and the image is still not modified. Maybe I'm not saving it correctly or specifying the correct functions (even though I am not getting any errors). All it does is create a new image file with no changes
I'm trying:
----------------------------------------------------------
[int]$IMG
$IMG = $GB.CreateGdPictureImageFromFile($TIF)
$smting = $GB.ARGB(0,0,0,0)
$GB.DrawFilledRectangle($IMG,30,30,30,50,$SMTING,$True)
$GB.DrawText($IMG,"IT WORKED",10,100,22,0,$smting,"ARIAL",$true)
$GB.SaveAsTIFF($IMG,$OUTFILE,4)
----------------------------------------------------------
Windows 10 pro
standard JPG and TIF images
Thanks,
Allan
I downloaded and applied GdPicture.net.14.dll with the temporary license key and the image is still not modified. Maybe I'm not saving it correctly or specifying the correct functions (even though I am not getting any errors). All it does is create a new image file with no changes
I'm trying:
----------------------------------------------------------
[int]$IMG
$IMG = $GB.CreateGdPictureImageFromFile($TIF)
$smting = $GB.ARGB(0,0,0,0)
$GB.DrawFilledRectangle($IMG,30,30,30,50,$SMTING,$True)
$GB.DrawText($IMG,"IT WORKED",10,100,22,0,$smting,"ARIAL",$true)
$GB.SaveAsTIFF($IMG,$OUTFILE,4)
----------------------------------------------------------
Windows 10 pro
standard JPG and TIF images
Thanks,
Allan
Re: PowerShell dot net example
Hello, Allan,
Here is the code snippet I have used on empty jpeg file with the current release.
Please see the attached resulting TIFF file. So I can confirm there is no issue in the toolkit with this code snippet.
Here is the code snippet I have used on empty jpeg file with the current release.
Code: Select all
using (GdPictureImaging image = new GdPictureImaging())
{
int imageID = image.CreateGdPictureImageFromFile("");
if (image.GetStat() == GdPictureStatus.OK)
{
if ((image.DrawFilledRectangle(imageID, 30, 30, 30, 50, Color.Blue, true) == GdPictureStatus.OK) &&
(image.DrawText(imageID, "IT WORKED", 10, 100, 22, 0, Color.Red, "ARIAL", true) == GdPictureStatus.OK))
{
if (image.SaveAsTIFF(imageID, "drawed_rect.tiff", TiffCompression.TiffCompressionAUTO) == GdPictureStatus.OK)
MessageBox.Show("Done!");
else
MessageBox.Show("Error!");
}
}
image.ReleaseGdPictureImage(imageID);
}
- Attachments
-
- drawed_rect.tiff (7.5 KiB) Viewed 15015 times
Re: PowerShell dot net example
Thanks Gabriela, it worked! .
Here is the code for powershell to change a Tiff image:
-------------------------------------------------------------------------------------------------------------------------------
add-type -Path "C:\users\allan martin\desktop\GdPicture.NET.14.dll"
$GB = [GdPicture14.GdPictureImaging]::new()
$L = [GdPicture14.LicenseManager]::new()
$L.RegisterKEY("*REDACTED*")
$TIF = "C:\users\Allan Martin\Desktop\Infile.tif"
$OUTFILE = "C:\users\Allan Martin\Desktop\Outfile.tif"
[int]$IMG
$IMG = $GB.CreateGdPictureImageFromFile($TIF)
$smting = $GB.ARGB(255,255,255,255) #Chang to white
$GB.DrawFilledRectangle($IMG,30,30,30,50,$SMTING,$True)
$GB.DrawText($IMG,"Tell Gabriela it worked",10,100,22,0,$smting,"ARIAL",$true)
$GB.SaveAsTIFF($IMG, $Outfile,4)
-----------------------------------------------------------------------------------------------------------------------------
Here is the code for powershell to change a Tiff image:
-------------------------------------------------------------------------------------------------------------------------------
add-type -Path "C:\users\allan martin\desktop\GdPicture.NET.14.dll"
$GB = [GdPicture14.GdPictureImaging]::new()
$L = [GdPicture14.LicenseManager]::new()
$L.RegisterKEY("*REDACTED*")
$TIF = "C:\users\Allan Martin\Desktop\Infile.tif"
$OUTFILE = "C:\users\Allan Martin\Desktop\Outfile.tif"
[int]$IMG
$IMG = $GB.CreateGdPictureImageFromFile($TIF)
$smting = $GB.ARGB(255,255,255,255) #Chang to white
$GB.DrawFilledRectangle($IMG,30,30,30,50,$SMTING,$True)
$GB.DrawText($IMG,"Tell Gabriela it worked",10,100,22,0,$smting,"ARIAL",$true)
$GB.SaveAsTIFF($IMG, $Outfile,4)
-----------------------------------------------------------------------------------------------------------------------------
Re: PowerShell dot net example
Hello,
I'm happy to hear that. Enjoy!
I'm happy to hear that. Enjoy!
Who is online
Users browsing this forum: No registered users and 1 guest