PNG picture - Console/Desktop - Same code, different result

Using this code

dim p as Picture
p = picture.Open(GetFolderItem("c:\\temp\\aaa.png",3))

Into desktop app, p has horizontal and vertical resolution as 96; type ImmutableBitmap = 3
Into console app, p has horizontal and vertical resolution as 72; type MutableBitmap = 2

When p is saved with

p.Save(f, Picture.SaveAsPNG, -1)

and than f is passed to zbarimg.exe for barcode recognition, into desktop app barcode is recognized, but not into console app.

So my question is: “Why the same code with the same source image file, produces different picture objects?”

I think Greg or someone addressed this issue else where on this forum… and if I recall it has something to do with the fact the a different graphics engine is used in each case. I don’t recall if a workaround was offered or not…

And based on the fact you mentioned 96dpi… I am assuming this is WIndows?


The problem is probably the horizontal and vertical resolutions. Most apps assume a resolution of 96ppi on Windows and 72ppi on macOS. On Windows the underlying OS calls have a hard time when the ppl isn’t what it expects to find.

You may be able to fix this in the console app by setting the HorizontalResilution and VerticalResolution to 96 before calling Save.