Author Topic: Scaling problem with online FCM to SVG conversion  (Read 596 times)

0 Members and 1 Guest are viewing this topic.

imperialcutter

  • Newbie
  • *
  • Posts: 2
Scaling problem with online FCM to SVG conversion
« on: 09 June 2017, 12:06:19 »
Hello

Thank you very much for the online FCM to SVG converter!

When we convert Brother Scan'n'Cut FCM files to SVG we have found that the SVG version is reduced in size compared to the original when we cut using the SVG. This can be shown when we "round trip" the SVG back in to Canvas. I attach a comparison of screen grabs from canvas showing the different sizes (please note that there is a different vertical offset on the mat, but they are different sizes).


The orignal file, called Divider_3.fcm may still be on your server, but if not I can send you a copy.

Were you aware of a problem, is there anything that can be done to fix it?

Thanks!

The Wizard

  • Administrator
  • Jr. Member
  • *****
  • Posts: 71
Re: Scaling problem with online FCM to SVG conversion
« Reply #1 on: 09 June 2017, 13:27:01 »
The problem is that the SVG reader in ScanNCut Canvas is not implemented correctly according to the SVG specifications. There are also a number of others applications that do not read in SVG files at the correct size.

The SVG reader in ScanNCut canvas is using 96 DPI (Dots per Inch) instead of 90 DPI. This means that the imported SVG file will be smaller than it actually is. 90/96 = 0.9375

When an SVG file is saved in Inkscape, it correctly imports the SVG file. They seem to believe that all files saved in Inkscape will be 90 DPI, which is not true, they can be saved in millimetres.


Ian
Ian Wadsworth (MEng Software Engineering)

imperialcutter

  • Newbie
  • *
  • Posts: 2
Re: Scaling problem with online FCM to SVG conversion
« Reply #2 on: 09 June 2017, 16:52:26 »
Hi Ian
I have been doing some research into this and have come to similar conclusion. The SVG standard seems to deliberately avoid specifying a DPI or conversion between physical units, like mm, and its "User Units" or pixels, so I am not sure that Scan'n'Cut is doing it wrong, more like it is open to interpretation/implementation. Apparently the CSS standard is 96 DPI, though I haven't verified that, and I have also read that Inkscape default DPI was changed from 90 to 96dpi in version 0.92 (I am still using 0.91). There is some info about that here on the Inkscape wiki http://wiki.inkscape.org/wiki/index.php/Units_In_Inkscape#Inkscape_.26_Units

What I have found is that I can hack the files to add in a scaling transform that will give the correct results. If I alter the "transform" element to the path attribute with a scale to compensate for 90 to 96 dpi it works, so change the two "1"s in the matrix to 1.06666669. This...
Code: [Select]
<path id="A01" transform="matrix(1, 0, 0, 1, 178.866141732283, 54.9035433070866)"
to this...

Code: [Select]
<path id="A01" transform="matrix(1.06666669, 0, 0, 1.06666669, 178.866141732283, 54.9035433070866)"
From what you say I can understand why you have used 90dpi on your converter, but if the Scan'n'Cut, CSS, and now the latest version of Inkscape are all using 96dpi as some kind of defacto standard it might be time to consider changing, or putting in an option.

Thank you for you work on this converter and making it available to the community!

The Wizard

  • Administrator
  • Jr. Member
  • *****
  • Posts: 71
Re: Scaling problem with online FCM to SVG conversion
« Reply #3 on: 10 June 2017, 13:21:58 »
The SVG specification 1.1 defines the conversion for Pixels to Real World Units https://www.w3.org/TR/2011/REC-SVG11-20110816/coords.html

The draft version of SVG 2 says ‘CSS defines 1 inch to be equal to 96 pixels’. https://www.w3.org/TR/2016/CR-SVG2-20160915/coords.html#Units

The CCS for a Pixel was changed from 90 DPI to 96 DPI.

Inkscape 0.92 has changed from using 90 DPI to 96 DPI (new CCS definition). Any SVG 1.1 file that uses Pixels, will not be scaled correctly in 0.92. When pre-0.92 Inkscape SVG files are loaded into 0.92, it asks what you want to do to correct the 90/96 DPI scaling. I’ve tried this, and got it wrong.


There is fix. By defining and using real world units for the height and width, and setting the viewBox to those values, it is the correct scale in 0.91, 0.92, ScanNCut Canvas, Make the Cut, Sure Cuts a Lot, Silhouette Studio, Cricut Design Space, and my own Cutter Controller.

   height="1000pt" width="1000pt" viewBox="0 0 1000 1000"

This is a 4 inch square in points (pts)
    <rect
       style="stroke-width:0.26458332"
       y="0"
       x="0"
       height="288"
       width="288" >


Out of curiosity, what machine are you using the converted FCM files with?


Thank you for you work on this converter and making it available to the community!

You're welcome


Ian
Ian Wadsworth (MEng Software Engineering)

The Wizard

  • Administrator
  • Jr. Member
  • *****
  • Posts: 71
Re: Scaling problem with online FCM to SVG conversion
« Reply #4 on: 25 June 2017, 21:45:41 »
There is fix. By defining and using real world units for the height and width, and setting the viewBox to those values, it is the correct scale in 0.91, 0.92, ScanNCut Canvas, Make the Cut, Sure Cuts a Lot, Silhouette Studio, Cricut Design Space, and my own Cutter Controller.

   height="1000pt" width="1000pt" viewBox="0 0 1000 1000"

This is a 4 inch square in points (pts)
    <rect
       style="stroke-width:0.26458332"
       y="0"
       x="0"
       height="288"
       width="288" >


As from the 21 June 2017, a fix has been implemented. All the online converters create SVG files in Points and not Pixels.

See https://www.facebook.com/IdeasRUs/posts/1432557453480118


Ian

Ian Wadsworth (MEng Software Engineering)