bitmap/svg image import size

If you are having problems with QCAD, post here. Please report bugs through our Bug Tracker instead.

Always attach your original DXF or DWG file and mentions your QCAD version and the platform you are on.

Moderator: andrew

Forum rules

Always indicate your operating system and QCAD version.

Attach drawing files and screenshots.

Post one question per topic.

Post Reply
User avatar
ryancousins
Premier Member
Posts: 367
Joined: Thu Mar 19, 2020 3:47 am
Location: Michigan, USA

bitmap/svg image import size

Post by ryancousins » Wed Mar 31, 2021 2:23 am

I've noticed when importing PNG or SVG images into my DXF, they always seem much larger than I anticipate they should be. As a test, I created a 6" by 4" PNG and SVG in Inkscape and imported both into a DXF. It shows the SVG as 45' by 30' and the PNG as 48' by 32'. After messing around I realized if I set the width in the options toolbar while placing the images to 72 (which matches the 72 DPI of the png as I created it in Inkscape. I'm not sure what the native DPI is for the SVG?) they show up as 6" by 4" inside of the QCAD model space. But if I look at the properties of those images, they then have width and height factors of .167 and .133.

I have attached the DXF and the two images. I imported each image type twice. Once at the default size (432 by 288 for the png and 540 by 360 for the svg ) as shown in the options toolbar during import, and a second time with a width of 72 entered in the options toolbar at time of import, with the height scaling down proportionally.

I'm assuming I'm overlooking something obvious as usual but I'm wondering how all of this works in QCAD as far as how it handles the image sizes. What is the relationship between size of the image as Inkscape sees it and how QCAD sees it, and why are the PNG and SVG different from one another?
Attachments
import.dxf
(104.91 KiB) Downloaded 335 times
image_svg.svg
(2.32 KiB) Downloaded 364 times
image_png.png
image_png.png (6.54 KiB) Viewed 4700 times

User avatar
Husky
Moderator/Drawing Help/Testing
Posts: 4935
Joined: Wed May 11, 2011 9:25 am
Location: USA

Re: bitmap/svg image import size

Post by Husky » Wed Mar 31, 2021 7:07 am

ryancousins wrote:
Wed Mar 31, 2021 2:23 am
I've noticed when importing PNG or SVG images into my DXF, they always seem much larger than I anticipate they should be. As a test, I created a 6" by 4" PNG and SVG in Inkscape and imported both into a DXF. It shows the SVG as 45' by 30' and the PNG as 48' by 32'.
Let's concentrate on the png first, ok?

The size of a bit map is defined in pixel. If you import (or better link) a png etc.in QCAD it will use the actual Drawing Unit for the size. Your png is 576 px by 384 px. Your Drawing unit is inch. Without any adjustment in the Option Bar your png will be placed with the size of 576 inch by 384 inch. That is equal to 48' by 32'.
If you need to scale it down to 6" by 4" just put the numbers in the Option Bar and QCAD will scale it accordingly.

The svg ...
ryancousins wrote:
Wed Mar 31, 2021 2:23 am
After messing around I realized if I set the width in the options toolbar while placing the images to 72 (which matches the 72 DPI of the png as I created it in Inkscape. I'm not sure what the native DPI is for the SVG?) they show up as 6" by 4" inside of the QCAD model space. But if I look at the properties of those images, they then have width and height factors of .167 and .133.
I can't reproduce this example with the provided files.
I don't see a 6" x 4" svg in the drawing. What I see is a 6' by 4'. Howsoever 1 inch should be 96 pixel. What Inkscape is doing or what you did in Inkscape eludes my knowledge.
Work smart, not hard: QCad Pro
Win10/64, QcadPro, QcadCam version: Current.
If a thread is considered as "solved" please change the title of the first post to "[solved] Title..."

User avatar
ryancousins
Premier Member
Posts: 367
Joined: Thu Mar 19, 2020 3:47 am
Location: Michigan, USA

Re: bitmap/svg image import size

Post by ryancousins » Wed Mar 31, 2021 10:33 pm

Husky wrote:
Wed Mar 31, 2021 7:07 am
If you import (or better link)
How do you link instead of import? I thought even though it says import, it is actually linking it because you still need the original image file in the same directory with your DXF. I didn't think there was a way to actually import the image so it became part of the DXF file.
Husky wrote:
Wed Mar 31, 2021 7:07 am

The size of a bit map is defined in pixel. If you import (or better link) a png etc.in QCAD it will use the actual Drawing Unit for the size.
So one pixel is equal to one drawing unit. Sounds good.
Husky wrote:
Wed Mar 31, 2021 7:07 am
Howsoever 1 inch should be 96 pixel.
I think one issue was that I have been using file>import to import both PNG and SVG. When I use this method to import a solid filled SVG, I can't make sense of the size that gets imported. I created a solid filled 96 pixel square in Inkscape and it isn't showing up as one inch in QCAD. Since the SVG shows up as a bitmap rather than geometry using this method, I'm not understanding how the size is determined. I know I can use file>SVG import instead and choose the resolution, but then only the outline geometry is imported, and in this case I want to know how things like logos would be handled where I need the solid fills of the SVG and not just the outline geometry.

User avatar
Husky
Moderator/Drawing Help/Testing
Posts: 4935
Joined: Wed May 11, 2011 9:25 am
Location: USA

Re: bitmap/svg image import size

Post by Husky » Thu Apr 01, 2021 12:06 am

ryancousins wrote:
Wed Mar 31, 2021 10:33 pm
I think one issue was that I have been using file>import to import both PNG and SVG.
Nope - that shouldn't be an issue ...
ryancousins wrote:
Wed Mar 31, 2021 10:33 pm
When I use this method to import a solid filled SVG, I can't make sense of the size that gets imported. I created a solid filled 96 pixel square in Inkscape and it isn't showing up as one inch in QCAD.
Forget this 96 px = 1 inch. Important for an import is 1 pixel = 1 Drawing Unit.

Remember that we talked about this before .... a 96 pixel svg will be imported as a 96 "Drawing Unit" size. If you work in inch it would be 96 inch in length on one side.
ryancousins wrote:
Wed Mar 31, 2021 10:33 pm
I can't make sense of the size that gets imported.
As I mention it before - I don't know what you are doing in Inkscape but keep one fact in mind: Inkscape has the size for the graphic and also a size for the page on what the graphic is placed. Sure - important for you is the graphic size but QCAD sees only the overall (Page) size which could be larger.
I made an example svg. The grafic is 500 by 500. The page is 550 x 550.
Imported in QCAD the unchanged size would be 550 x 550.

Paw with larger page.svg
(13.48 KiB) Downloaded 367 times

I assume to avoid the "import size confusion" you have to bring the page size to the overall graphic size. Inkscape has a command for that ...

Paw same size page.svg
(13.48 KiB) Downloaded 341 times
If you place both svg side by side in QCAD you can't see a differences. But the one with the same page size is easy to control regarding the size - the other one will confuse you ....

Husky-2021.03.31-02.png
Husky-2021.03.31-02.png (19.64 KiB) Viewed 4624 times
Work smart, not hard: QCad Pro
Win10/64, QcadPro, QcadCam version: Current.
If a thread is considered as "solved" please change the title of the first post to "[solved] Title..."

User avatar
ryancousins
Premier Member
Posts: 367
Joined: Thu Mar 19, 2020 3:47 am
Location: Michigan, USA

Re: bitmap/svg image import size

Post by ryancousins » Thu Apr 01, 2021 4:25 am

Thanks again, Husky.

I always made sure to adjust the page size to match the object size in Inkscape for all of my test images. So, for example, a 96 by 96 pixel square was perfectly snapped to a 96 by 96 pixel canvas/page size.

I know you said bitmaps are 1 pixel per drawing unit,
The size of a bit map is defined in pixel. If you import (or better link) a png etc.in QCAD it will use the actual Drawing Unit for the size.
but I didn't know you meant that applied to SVG vector images as well.

I will keep messing around. I know that no matter what I can always scale the images down as needed in the properties. I was just thinking it would be more efficient to start with an image that's close to the correct size to begin with. Plus when I don't know exactly how things work I go crazy. :lol:

Post Reply

Return to “QCAD Troubleshooting and Problems”