Trouble with Bitmap Export Add Extra Margin

Drop in here to discuss whatever you want.

Moderator: andrew

Forum rules

Always indicate your operating system and QCAD version.

Attach drawing files and screenshots.

Post one question per topic.

Post Reply
jsolerBtis
Newbie Member
Posts: 5
Joined: Mon Jan 28, 2019 2:22 pm

Trouble with Bitmap Export Add Extra Margin

Post by jsolerBtis » Mon Jan 28, 2019 3:05 pm

Hi!

I'm trying to export my .DXF file to a .TIFF files using QCAD in command line mode, but i don't know how to disable this check: "Add extra margin to compensate for line weight" with command line parameter.

I want to create tiles of this file and i need to create TIFF file with exact precision but this margin is moving my photo.

As example, I'm trying to export this square:
Image

But when I export my TIFF file, we only saw the lower-left corner:
Image

It's possible to call command line QCAD with this check disabled?
Thanks!

User avatar
andrew
Site Admin
Posts: 9037
Joined: Fri Mar 30, 2007 6:07 am

Re: Trouble with Bitmap Export Add Extra Margin

Post by andrew » Mon Jan 28, 2019 3:11 pm

Please post the exact parameters you are using for dwg2bmp along with the DXF/DWG file, thanks.

jsolerBtis
Newbie Member
Posts: 5
Joined: Mon Jan 28, 2019 2:22 pm

Re: Trouble with Bitmap Export Add Extra Margin

Post by jsolerBtis » Tue Jan 29, 2019 9:17 am

Hi Andrew,

I'm calling Qcad with:

-allow-multiple-instances
-no-gui
-autostart
ExportBitmapWorldFile.js (format file that exports TIFF and generates TIFFW too)
-f
-o My output path
-p 0.02
-t "tiff"

In ExportBitmapWorldFile.js i'm just changing properties of:
"width", "height", "resolution" and "margin" (= 0 trying to solve this problem).

Thanks
Attachments
ExportBitmapWorldFile.js
(8.85 KiB) Downloaded 457 times
C_M1_P1_0_ARQ.dwg
(496.41 KiB) Downloaded 483 times

User avatar
andrew
Site Admin
Posts: 9037
Joined: Fri Mar 30, 2007 6:07 am

Re: Trouble with Bitmap Export Add Extra Margin

Post by andrew » Tue Jan 29, 2019 10:01 am

OK.. perhaps a rounding error? If your lines are 1 pixel wide and you use a margin of 0 the line might just be inside or outside the pixel depending on the values being rounded up or down.

jsolerBtis
Newbie Member
Posts: 5
Joined: Mon Jan 28, 2019 2:22 pm

Re: Trouble with Bitmap Export Add Extra Margin

Post by jsolerBtis » Tue Jan 29, 2019 11:07 am

I tried doing it manually with "Bitmap Export" in QCAD using the same parameters and when i uncheck this: "add extra margin to compensate for line weight", the TIFF files fits well.

(And obviously, with this check i have the same problem).

User avatar
andrew
Site Admin
Posts: 9037
Joined: Fri Mar 30, 2007 6:07 am

Re: Trouble with Bitmap Export Add Extra Margin

Post by andrew » Tue Jan 29, 2019 1:49 pm

Strange.. QCAD uses the same routines and parameters.

Perhaps you could create a bitmap with double or four times the required resolution and then scale it down accordingly (e.g. using imagemagick command line tools). Switching on antialiasing in QCAD might also have a similar effect (properties["antialiasing"] = true).

jsolerBtis
Newbie Member
Posts: 5
Joined: Mon Jan 28, 2019 2:22 pm

Re: Trouble with Bitmap Export Add Extra Margin

Post by jsolerBtis » Tue Jan 29, 2019 2:58 pm

And which is the propertie to change this "extra margin"? I mean, something like: "properties["ExtraMargin"] = false "

i can't create bitmaps with high resolution cause we're doing an automatic procedure that generates tiles like every hour.

User avatar
andrew
Site Admin
Posts: 9037
Joined: Fri Mar 30, 2007 6:07 am

Re: Trouble with Bitmap Export Add Extra Margin

Post by andrew » Tue Jan 29, 2019 9:11 pm

That switch for adding line weight margin is reflected in the bitmap exporter through parameter "noweightmargin":

Code: Select all

properties["noweightmargin"] = true;

jsolerBtis
Newbie Member
Posts: 5
Joined: Mon Jan 28, 2019 2:22 pm

Re: Trouble with Bitmap Export Add Extra Margin

Post by jsolerBtis » Wed Jan 30, 2019 9:28 am

This solves my problem.

Thanks Andrew!

Post Reply

Return to “Chat”