[Gambas-user] Problem: Size of printed image

Benoit Minisini gambas at ...1...
Wed Feb 23 13:50:12 CET 2005


On Wednesday 23 February 2005 13:27, Eilert wrote:
> Now, everything runs perfect in my program even with printing, i. e. all
> things I see in the preview appear on the paper at correct positions and
> in correct sizes.
>
> Only images don't print correct. In the original VB program, my firm's
> logo appears "real big", because it was scanned in a rather high
> resolution. So I introduced a percentage to scale the image to a size
> which looks good in the document.
>
> Now in Gambas, when I do not scale the image it will appear only about
> 10 % larger than wanted, not "real big". When I scale it down with the
> formula from the VB pendant, it becomes tiny or even disappears.
>
> In VB the code reads about like this:
>
> 	pWidth = Form1.Image1.Width
> 	pHeight = Form1.Image1.Height
> 	pWidth = pWidth / 100 * percent
> 	pHeight = pHeight / 100 * percent
>
> where percent is the percentage from the form (user-given).
>
> Well, I tried to do it like this in Gambas, but it doesn't work, as
> described above. In the preview, it works well - same algorithm, but
> Draw.Begin(Preview) instead of Draw.Begin(Printer).
>
> In Gambas (here it is myImage) it reads
>
>
> 	Draw.Image(myImage.Stretch(pHeight, pWidth), x, y)
>
> What I think is that in VB the scale is somewhat different than in
> Gambas. If you ask Gambas about the size of the image, it gives 520 for
> Width and 640 for Height. But what 520??? Pixels? It should be much
> more, as it was scanned with 600 dpi as far as I remember. That's why
> it's printed so large in VB if not scaled down.
>
> Any ideas?
>
> Rolf
>

All Width and Height properties are in pixels. Check the size of your picture 
with GIMP.

Form.Image1.Width is the width of the Image1 control. It has nothing to do 
with the width of the picture in it. Use Form.Image1.Picture.Width instead.

Regards,

-- 
Benoit Minisini
mailto:gambas at ...1...




More information about the User mailing list