Converting milimeters to pixels

S

saxso

Is there a way in Visio to create drawings based on pixels as a unit
of measurement?

Any comments or suggestions are much appreciated.
 
C

Chris Roth [MVP]

Hi saXso,

Visio has lots of units, but not pixels, since it is vector-based, and the
image is always "smooth" no matter what you zoom you are at.

However, perhaps your problem has to do with exporting the image, at which
point you can control the export-resolution. The defualt is usually
something like 96 dpi, but you could work in points, and then export your
diagram at 72 dpi, so the export would correspond exactly to what you have
drawn.

What exactly are you trying to do?

--
Hope this helps,

Chris Roth
Visio MVP

Free Visio shapes:
http://www.visguy.com/category/shapes
Visio programming info:
http://www.visguy.com/category/programming/
Other Visio resources:
http://www.visguy.com/visio-links/
 
J

Jacco

Hi saXso,

First thing: it's a pain. I have been struggling with this for quite a
while, but have it running. However, my solution only works for the
default setting of windows, working with a resolution of 96 dpi (as
Chris mentiones above). If you want to work in a different resolution,
you'll have to change a multiplication factor.

There are two things you need to worry about:
* Visio works in inches. This means that, to get a pixel value, you
will need to convert the internal values to millimeters and/or to
pixels. I have used the conversion to mms to be able to debug my code
(my drawings always use mms as a drawing scale). So: mmX = PinX * 25.4
gives you the mm value, and then pxX = mmX * (96/25.4) gives you the
pixel value. You can of course skip the first step and do pxX = PinX *
96

* The origin of a page is in the lower left corner, instead of the
upper left corner as with 'normal' images. This means quite some
calculations to first determine the top left corner of the image (that
depends on what objects will be exported when creating the image), and
then finding the relative location of the other objects in reference
to the top left corner of your exported image.

Anyway, this is how I have implemented it. I use it to create an
imagemap on the fly after saving a page as an image. If you want to
see the whole code, feel free to download the swipr toolset.
(swipr.blogspot.com) It'll give you all the code (in VBA), as well as
some nice utilities.

Hope this helps,

Jacco


What I have done is
 
C

Chris Roth [MVP]

Hi Guys,

If it's image-maps and customized export-to-web that you're looking for,
check out my article/download:

Customized Visio HTML Export
http://www.visguy.com/2007/08/24/customized-visio-html-export/

There's VBA code in the Visio document that creates customized image-maps in
an exported HTML page. This might help you out...

--
Hope this helps,

Chris Roth
Visio MVP

Free Visio shapes:
http://www.visguy.com/category/shapes
Visio programming info:
http://www.visguy.com/category/programming/
Other Visio resources:
http://www.visguy.com/visio-links/
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top