The issue caused by changing the DPI when using rasterize() to convert a DXF to a BMP.

Hello!
When I rasterize a DXF graphic, if the DPI is 0.378, each point of the graphic is aligned to multiples of 0.378 microns (this operation is handled outside the script), and the layout is rasterized according to this standard. If the length of a region is a multiple of 0.378, the number of pixels it occupies will be that multiple. For example, if the length of a region is 3 times 0.378, it will occupy 3 pixels.

However, when the DPI is 0.1512, each coordinate of the graphic is aligned to multiples of 0.1512 microns for rasterization. In this case, the rasterized graphic may occupy one extra pixel and fail to match perfectly. The BMP size is always 1080 pixels by 1080 pixels. Why does this happen?

bmp.zip 41.5K

Comments

  • Hi @Flyingmyd,

    if your DPI is 0.1512, you need to use a database unit that is able to represent this dimension perfectly. I'd suggest 0.2nm in your case. The default DXF importer setting is to use 1nm DBU, which will round the edges of your design to 1nm multiples.

    Matthias

Sign In or Register to comment.