Sadly i've no code to share, but it's an easy question. I'm looking for piece of code that will create some png file ( can be blank, colored, what ever ) with a specific name ( QR_[ID].png ).
In my case it's to store a QR code gotten with Print DownloadHTTP( URL, DestinationPath )
The url is : "https://qrickit.com/qrickit_apps/qrickit_api.php" which will generate the qr code
DownloadHTTP will just access that url with the specific ID and download the image to then change the existing file in DestinationPath to the QR code image downloaded
The code works on a already created PNG, so the creation of a png file is the only missing part. But i can't find a way to create some png file and google is not being friendly with me today :(.
Worst part is i'm not an administrator on windows so can't do almost anything.
Thanks if people try to help !
To convert, resize, flip, rotate, merge and even create Images use the WIA-Libary
Some Examples can be found at devhut.net
Public Sub CreateBlankPngImage()
Dim PathToCreatedImage As String
PathToCreatedImage = "" ' insert path and filename here
Dim sFormatID As String
sFormatID = "{B96B3CAF-0728-11D3-9D7B-0000F81EF32E}" 'https://learn.microsoft.com/en-us/previous-versions/windows/desktop/wiaaut/-wiaaut-consts-formatid
Dim sExt As String
sExt = "PNG"
Dim oWIA As Object 'WIA.ImageFile
Set oWIA = CreateObject("WIA.ImageFile")
Dim v As Object ' Wia.Vector
Set v = CreateObject("WIA.Vector")
v.Add &HFFFFFFFF 'White (A=255,R=255,G=255,B=255)
Set oWIA = v.ImageFile(1, 1) ' create image with size 1x1
With CreateObject("WIA.ImageProcess")
.Filters.Add .FilterInfos("Scale").FilterID
.Filters(1).Properties("MaximumWidth") = 200 'Width
.Filters(1).Properties("MaximumHeight") = 200 'Height
.Filters.Add .FilterInfos("Convert").FilterID
.Filters(2).Properties("FormatID") = sFormatID 'convert to PNG
.Filters(2).Properties("Quality") = 100
Set oWIA = .Apply(oWIA) 'process image
End With
oWIA.SaveFile PathToCreatedImage
Set v = Nothing
Set oWIA = Nothing
End Sub
Of course for your purpose, copying a default PNG-File would be sufficent-