image scaling

Post here for help on using FreeCAD's graphical user interface (GUI).
Forum rules
and Helpful information
IMPORTANT: Please click here and read this first, before asking for help

Also, be nice to others! Read the FreeCAD code of conduct!
kisolre
Veteran
Posts: 4166
Joined: Wed Nov 21, 2018 1:13 pm

Re: image scaling

Post by kisolre »

Works here too. While we are talking about image scale why are the default sizes rounded to whole mm? Shouldn't it be better for them to keep proper proportional image size or as I did when needed imported images - link their sizes through expression: YSize = XSize*ImageHeight/ImageWidth?
User avatar
easyw-fc
Veteran
Posts: 3633
Joined: Thu Jul 09, 2015 9:34 am

Re: image scaling

Post by easyw-fc »

UR_ wrote: Fri May 03, 2019 1:52 pm But of course locale should be respected. :?
what for?
1) Units are not allowed in the input field...
2) ',' '.' are both accepted and converted to internal float
UR_
Veteran
Posts: 1355
Joined: Tue Jan 03, 2017 8:42 pm

Re: image scaling

Post by UR_ »

easyw-fc wrote: Fri May 03, 2019 2:10 pmwhat for?
1,000 in german locale this means 1, with US locale activated it's the same as 1000. :shock:
User avatar
easyw-fc
Veteran
Posts: 3633
Joined: Thu Jul 09, 2015 9:34 am

Re: image scaling

Post by easyw-fc »

UR_ wrote: Fri May 03, 2019 2:35 pm 1,000 in german locale this means 1, with US locale activated it's the same as 1000. :shock:
but do you write 1000 or 1,000? or is i.e. the calculator app that is adding the separator?
EDIT:
'US locale' is not accepting the following number:

Code: Select all

1,000.5
it accepts only

Code: Select all

1000.5
User avatar
easyw-fc
Veteran
Posts: 3633
Joined: Thu Jul 09, 2015 9:34 am

Re: image scaling

Post by easyw-fc »

UR_ wrote: Fri May 03, 2019 2:35 pm 1,000 in german locale this means 1, with US locale activated it's the same as 1000
here a code supporting locale
_CommandImageScaling.py
(9.38 KiB) Downloaded 39 times
but still you cannot digit 1,000.5 but you have to digit 1000.5 in US locale and you must add the right separator (previous solution were accepting both)
kisolre wrote: Fri May 03, 2019 1:59 pm While we are talking about image scale why are the default sizes rounded to whole mm? Shouldn't it be better for them to keep proper proportional image size or as I did when needed imported images - link their sizes through expression: YSize = XSize*ImageHeight/ImageWidth?
I don't see your point...
It should be just fine:

Code: Select all

s=d/self.distance
sel[0].XSize.Value=sel[0].XSize.Value*s
sel[0].YSize.Value=sel[0].YSize.Value*s
kisolre
Veteran
Posts: 4166
Joined: Wed Nov 21, 2018 1:13 pm

Re: image scaling

Post by kisolre »

easyw-fc wrote: Fri May 03, 2019 3:11 pm I don't see your point...
Imported image proportion 207/161= 1,2857142857142857142857142857143
Actual image proportion 980/760 = 1,2894736842105263157894736842105
Imported image size is rounded to whole numbers.
ImagePlaneSize.JPG
ImagePlaneSize.JPG (230.7 KiB) Viewed 1391 times
kisolre
Veteran
Posts: 4166
Joined: Wed Nov 21, 2018 1:13 pm

Re: image scaling

Post by kisolre »

easyw-fc wrote: Fri May 03, 2019 3:11 pm here a code supporting locale
Does not work here (BG). Decimal separator is ',' but neither ',' nor '.' work. I even tried copiing the symbol rom the control panel locale settings window without success.
User avatar
easyw-fc
Veteran
Posts: 3633
Joined: Thu Jul 09, 2015 9:34 am

Re: image scaling

Post by easyw-fc »

kisolre wrote: Fri May 03, 2019 3:47 pm Imported image proportion 207/161= 1,2857142857142857142857142857143
Actual image proportion 980/760 = 1,2894736842105263157894736842105
Imported image size is rounded to whole numbers.
ImagePlaneSize.JPG
Now I see... this is related to cpp code, not python scale function...
https://github.com/FreeCAD/FreeCAD/blob ... x.cpp#L202
Would you post an issue @Mantis?
User avatar
easyw-fc
Veteran
Posts: 3633
Joined: Thu Jul 09, 2015 9:34 am

Re: image scaling

Post by easyw-fc »

kisolre wrote: Fri May 03, 2019 3:56 pm
easyw-fc wrote: Fri May 03, 2019 3:11 pm here a code supporting locale
Does not work here (BG). Decimal separator is ',' but neither ',' nor '.' work. I even tried copiing the symbol rom the control panel locale settings window without success.
have you restarted FC to test it?
Could you then test the previous patch? (at the following link)
https://forum.freecadweb.org/posting.ph ... 1#pr305570
kisolre
Veteran
Posts: 4166
Joined: Wed Nov 21, 2018 1:13 pm

Re: image scaling

Post by kisolre »

That link throws me in Posting mode. If you mean the one that should accept either , or . I already posted that it works here.
Post Reply