-
Notifications
You must be signed in to change notification settings - Fork 25
Description
I assume that the NewWidth and NewHeight arguments to QRCodegenResizePicture are intended to be in points. If so, I am seeing results that suggest they are off by a factor of 2.
TestImage100 is an ActiveX image control in MS Word (on Win 10) that is sized to 100x100 points (roughly 1/2 inch on each side) in MS Word.
Running this code:
TestImage100.PictureAlignment = 2 'fmPictureAlignmentCenter
TestImage100.PictureSizeMode = 0 'fmPictureSizeModeClip
TestImage100.PictureTiling = False
Debug.Print "Form's width=" & CStr(TestImage100.width)
Set testImage = QRCodegenBarcode(TestText2.Text, SquareModules:=(TestCheckBox1.Value = True), ModuleSize:=10)
Debug.Print "QRCode image's width=" & CStr(testImage.width)
Debug.Print "...Inserting QRCode image into form"
Set TestImage100.Picture = testImage
Debug.Print "Form's width=" & CStr(TestImage100.width)
Debug.Print "Form's picture's width=" & CStr(TestImage100.Picture.width)
Debug.Print "Resizing QRCode to 100x100"
Set resizedTestImage = QRCodegenResizePicture(testImage, 100, 100)
Debug.Print "Resized QRCode's width=" & CStr(resizedTestImage.width)
Debug.Print "...Inserting resized QRCode image into form"
Set TestImage100.Picture = resizedTestImage
Debug.Print "Form's width=" & CStr(TestImage100.width)
Debug.Print "Form's picture's width=" & CStr(TestImage100.Picture.width)
produces this output:
Form's width=100.8
QRCode image's width=3122
...Inserting QRCode image into form
Form's width=100.8
Form's picture's width=3122
Resizing QRCode to 100x100
Resized QRCode's width=1764
...Inserting resized QRCode image into form
Form's width=100.8
Form's picture's width=1764
Apparently, the StdPicture object's width and height are in some different unit than points. (The screen is 14" 1920x1080, ie 16x9 12.3"x6.9" so 156 pixels/inch)
After resizing the image to 100x100 (NewHeightxNewWidth), the QR image fills approximately 50x50 points as shown here. The yellow is the background of the image control object (whose height & width is approximately 100 points)
If I resize to 200x200, it fills the 100x100 pixel image.