Possible bug when importing images

Use this forum to ask questions about how to do things in QCAD.

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
DerekGove
Full Member
Posts: 52
Joined: Sat May 20, 2023 7:10 pm
Location: Cumbria

Possible bug when importing images

Post by DerekGove » Wed Jul 09, 2025 12:13 pm

I have just noticed different behaviour when importing bitmap images.

99% of the time when I use QCAD, I am importing png images which I have rendered in Blender, so this is not unfamiliarity with a new tool, rather what seems like a change in behaviour, so I am wondering if it is a new bug that has crept in.

* If I use the shortcut 'IM' (to 'import bitmap'), select my image from the browser, and double click on it, no image appears by the cursor ready to place. Nor does it appear once I click on the page to place it.

* The same happens if I press 'IM', select my image, and click on the 'Open' button in the browser window.

* The same happens if I click on the Icon on the left toolbar, and double click on the image in the browser.

** It only works as expected only if I click on the icon on the toolbar, select the image, and click on 'Open' on the browser window.

Up 'till now, I have always used the shortcut 'IM', and more often than not double clicked on the image to place it.
Can anyone else confirm this behaviour?

Am using 3.32.3.0 (3.32.3), on Windows.
Derek
QCAD Version 3.32.3 : Windows 10

User avatar
DerekGove
Full Member
Posts: 52
Joined: Sat May 20, 2023 7:10 pm
Location: Cumbria

Re: Possible bug when importing images

Post by DerekGove » Wed Jul 09, 2025 12:22 pm

Never mind, I think I have solved the issue. (Typically, after an hour of testing, the solution is arrived at minutes after posting a bug report...)

I noticed that the images that were being imported correctly also had a slight angle to them.
Then, I spotted that in the tool options bar, the 'Angle' option was blank, rather than set to '0' as usual.

Once I'd entered '0' in there, it was all behaving as normal again.

This might still be a bug, it might not be. I'll let others decide. Perhaps if the 'Angle' field is empty, QCAD should behave as if it were '0'.

Regards, Derek
QCAD Version 3.32.3 : Windows 10

CVH
Premier Member
Posts: 4874
Joined: Wed Sep 27, 2017 4:17 pm

Re: Possible bug when importing images

Post by CVH » Wed Jul 09, 2025 3:07 pm

Hi,

This is an issue seen in several other tool options or more in general for various input fields.

In many cases the value or result from an expression is not validated as a number or to be plausible at least.
I am also pro reverting to a certain default. :wink:

Be aware that you might have inserted bogus image entities.


In this example:
When the Angle options changes the function Image.prototype.slotAngleChanged is called.
Without validation the new value is preserved in this.angle.
If there is already a specified image object then the value is used as image angle ... Without verification.
The preview is updated not based on a mouse move with clearing any former.
Eventually calling the Image.prototype.getOperation function in preview mode.
What fails for certain cases and returns no operation to preview.

In this case an operation is returned but that can not be rendered.
Placing the image entity is feasible without warning but what is added can not be rendered.
The created entity has Angle zero but Width/Height and both scale factors are NaN.

In some cases these are written/reloaded to/from a DXF 'As is', in other cases NaN or improper parameters may get fixed.
On reloading a drawing with such an image the properties: Angle, Width/Height and factors all turn zero.
At least it now displays a marker at the insertion position when selected.
Changing both scale factors to 1.0 fixes the entity with zero as orientation.
But this might not match with the intended size on inserting ...

slotAngleChanged is also called when initiating (or resuming) the IM tool with a preserved former tool option.
If that was blank and thus invalid then this.angle is changed accordingly without validation.

In short: The Angle field can be invalid to start with or one can set an invalid angle and that is preserved between usage.

Regards,
CVH

CVH
Premier Member
Posts: 4874
Joined: Wed Sep 27, 2017 4:17 pm

Re: Possible bug when importing images

Post by CVH » Sun Jul 13, 2025 3:41 am

A recent commit will fix that for upcoming snapshots/releases.

It falls back on zero when the Bitmap Angle value is not a number.

Not listed as a Bug fixes.

Remind that this doesn't adapt the tool option nor the preserved last used option in your config file.
Those remain invalid until changed manually.

Regards,
CVH

Post Reply

Return to “QCAD 'How Do I' Questions”