Insert Bitmap Image, can't change object width or height

Discussions about the development of the TechDraw workbench
BrettCA
Posts: 5
Joined: Thu Jun 20, 2019 9:28 pm

Insert Bitmap Image, can't change object width or height

Postby BrettCA » Thu Apr 08, 2021 12:14 am

I am able to insert PNG images into a Techdraw page with the default width and height of 100 units and adjust the scale of the image without any difficulty. However, I don't seem to be able to adjust the width and height of the image object.

I can alter the width and height values in the Combo View and the new entries seem to be accepted in those fields; 200, 300, whatever I put in, there is no error in the Python console and I know a recompute is being performed, but there is no change in the size of the image object on the page. It doesn't budge from 100 x 100. Hitting the recompute button also has no effect. Entering values via the Python console also produces no effect.

I know this has worked in prior builds of v0.19 but not sure how far back.

Thanks,
Brett
screencap.png
screencap.png (133.37 KiB) Viewed 485 times
OS: macOS Mojave (10.14)
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.19.24276 (Git)
Build type: Release
Branch: (HEAD detached at 0.19.1)
Hash: a88db11e0a908f6e38f92bfc5187b13ebe470438
Python version: 3.8.8
Qt version: 5.12.9
Coin version: 4.0.0
OCC version: 7.4.0
Locale: C/Default (C)
chrisb
Posts: 33789
Joined: Tue Mar 17, 2015 9:14 am

Re: Insert Bitmap Image, can't change object width or height

Postby chrisb » Thu Apr 08, 2021 5:19 am

Please add a simple file showing the issue.
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
User avatar
Roy_043
Posts: 2751
Joined: Thu Dec 27, 2018 12:28 pm

Re: Insert Bitmap Image, can't change object width or height

Postby Roy_043 » Thu Apr 08, 2021 7:19 am

Confirmed. There is indeed a regression here. Works in V0.18, not in V0.20.

Code: Select all

OS: Windows 8.1 Version 6.3 (Build 9600)
Word size of FreeCAD: 64-bit
Version: 0.20.24587 (Git)
Build type: Release
Branch: master
Hash: 1f62d4666102d8efd4d8f3ba58a1037456a3bcfb
Python version: 3.8.6+
Qt version: 5.15.1
Coin version: 4.0.1
OCC version: 7.5.0
Locale: Dutch/Netherlands (nl_NL)
BrettCA
Posts: 5
Joined: Thu Jun 20, 2019 9:28 pm

Re: Insert Bitmap Image, can't change object width or height

Postby BrettCA » Thu Apr 08, 2021 7:48 pm

Roy_043 - thanks for confirming I am not losing my marbles 🤪 I'll dig up an old release to get through my current task.

chris_b - the problem doesn't seem to be specific to a file. I created a few new blank FCStd files with blank TechDraw templates and tried a few different PNG images with consistent results. Would you need me to attach one of the images I am using as well, for your test to be valid?
Syres
Posts: 985
Joined: Thu Aug 09, 2018 11:14 am

Re: Insert Bitmap Image, can't change object width or height

Postby Syres » Fri Apr 09, 2021 8:39 am

Based on this git commit 24139bf I wouldn't expect width and height to still be available unless it was to stop errors loading old files Width and Height are just for the Crop function in the View tab. So if I load a JPG at 465 x 511 it loads at the correct size (but still showing 100x100 in the Data tab) on 0.19.1 with my config files. I'll see if I can find an old thread around that time that might explain the thinking around it.

OS: Windows 7 Version 6.1 (Build 7601: SP 1)
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.19.24276 (Git)
Build type: Release
Branch: releases/FreeCAD-0-19
Hash: a88db11e0a908f6e38f92bfc5187b13ebe470438
Python version: 3.8.6+
Qt version: 5.15.1
Coin version: 4.0.1
OCC version: 7.5.0
Locale: English/United Kingdom (en_GB)

Edit: Original thread and advice from @wandererfan on how to use https://forum.freecadweb.org/viewtopic.php?f=35&t=45927
Edit 2: Tested Crop function with Width and Height successfully
Syres
Posts: 985
Joined: Thu Aug 09, 2018 11:14 am

Re: Insert Bitmap Image, can't change object width or height

Postby Syres » Fri Apr 09, 2021 9:28 am

Submitted a PR to fix a minor bug when changing Crop from True to False https://github.com/FreeCAD/FreeCAD/pull/4724 and mentioned possible backport to 0.19 Release branch.
wmayer
Site Admin
Posts: 17274
Joined: Thu Feb 19, 2009 10:32 am

Re: Insert Bitmap Image, can't change object width or height

Postby wmayer » Sat Apr 17, 2021 11:37 am

Syres wrote:
Fri Apr 09, 2021 9:28 am
Submitted a PR to fix a minor bug when changing Crop from True to False https://github.com/FreeCAD/FreeCAD/pull/4724 and mentioned possible backport to 0.19 Release branch.
I have tested the PR but couldn't determine a different behaviour. To me it looks like the point is to change Crop to True to respect the image size. When it's set to True you can see that the frame expands to the size that is specified in the Data tabs. Now the user has to change the scale factor in order to change the size of the image which I find a bit odd. There should be a scale mode that automatically expands the image to the given size.

When testing the function I realized some usability problems (that might be implemented in a separate PR):
  • The Crop property should be part of the image feature and not the view provider to make things more obvious and reduce clicks
  • If Crop is False the Width and Height properties should be disabled
  • Width and Height only show a plain number which makes it difficult to understand what their unit is. Apparently they are measured in mm.
  • It would be good if an editor dialog (i.e. for a double-click) were available
Syres
Posts: 985
Joined: Thu Aug 09, 2018 11:14 am

Re: Insert Bitmap Image, can't change object width or height

Postby Syres » Sat Apr 17, 2021 3:24 pm

wmayer wrote:
Sat Apr 17, 2021 11:37 am
I have tested the PR but couldn't determine a different behaviour.

  • Width and Height only show a plain number which makes it difficult to understand what their unit is. Apparently they are measured in mm.
Very surprised by you not seeing any difference in behaviour, maybe I need to try more variety of image types and sizes.

Purely from a user point of view I thought Height and Width were in pixels hence shown as unitless but I could be dreaming.
wmayer
Site Admin
Posts: 17274
Joined: Thu Feb 19, 2009 10:32 am

Re: Insert Bitmap Image, can't change object width or height

Postby wmayer » Sat Apr 17, 2021 5:18 pm

Purely from a user point of view I thought Height and Width were in pixels hence shown as unitless but I could be dreaming.
That's what I have expected too but when creating a DIN A4 page and setting the width to 297 it occupies the full page. The image I have tested is the splash screen that has a size of 400 x 245 px. If I use that then the frame is much bigger than the page.

IMO it's fine if the image feature is given in mm because the QImage class has methods to get its size also in mm.
BrettCA wrote:
Thu Apr 08, 2021 12:14 am
I am able to insert PNG images into a Techdraw page with the default width and height of 100 units and adjust the scale of the image without any difficulty. However, I don't seem to be able to adjust the width and height of the image object.
If you set the property Crop in the View tab to True does it work then for you to change the image size?
BrettCA
Posts: 5
Joined: Thu Jun 20, 2019 9:28 pm

Re: Insert Bitmap Image, can't change object width or height

Postby BrettCA » Tue Apr 20, 2021 2:44 am

wmayer wrote:
Sat Apr 17, 2021 5:18 pm
If you set the property Crop in the View tab to True does it work then for you to change the image size?
Hi wmayer, yes, with the property Crop in the View tab set to True, I can now change the size of the image view frame on the page. Thanks. I'll call this one a user error but maybe we can mention the role of the Crop property in the TechDraw Image documentation https://wiki.freecadweb.org/TechDraw_Image