Diagram

Answered

Recognised diagrams are returned at a smaller size than the input shape

Hello,


I am attempting to use diagram recognition using the SDK REST API. The resulting shape primitives I am getting from the API are returning a shape that is around 30-40% the size of the input shape strokes.

image

image


 This is the body I am sending with 'application/vnd.myscript.jiix' in the Accept header

{
    "configuration": {
        "lang": "en_GB",
        "export": {
            "jiix": {
                "primitives": true,
                "bounding-box": false,
                "strokes": true
            }
        }
    },
    "contentType": "Diagram",
    "strokeGroups": [{
            "strokes": [{
                    "x": [205.09, 205.09, 205.09, 205.09, 200.72, 196.36, 192, 192, 192, 192, 196.36, 200.72, 205.09, 218.18, 240, 266.18, 296.72, 322.9, 340.36, 349.09, 357.81, 362.18, 362.18, 362.18, 370.9, 370.9, 375.27, 379.63, 384, 388.36, 392.72, 397.09, 392.72, 388.36, 370.9, 349.09, 327.27, 296.72, 261.81, 231.27, 209.45, 200.72, 192, 187.63],
                    "y": [592.9, 597.27, 601.63, 627.81, 667.09, 715.09, 750, 776.18, 793.63, 806.72, 806.72, 806.72, 806.72, 806.72, 806.72, 811.09, 819.81, 824.18, 828.54, 828.54, 828.54, 828.54, 824.18, 815.45, 789.27, 750, 710.72, 671.45, 640.9, 614.72, 592.9, 579.81, 575.45, 575.45, 579.81, 579.81, 584.18, 584.18, 584.18, 584.18, 584.18, 584.18, 584.18, 584.18]
                }
            ]
        }
    ],
    "conversionState": "DIGITAL_EDIT"
}

Is there a way of getting the recognised diagram to be a somewhat similar size to the input shape?

 



Best Answer

Hello Jacob,


Thank you for contacting us.


The “input coordinates” of the strokes in the REST request body are in pixels, while those exported in the JIIX file in the REST response are in millimeters. For further details please, check this page about strokes and this one about jiix format.

By default, the input resolution is 96 DPI. To convert from millimeters to pixels, you shall compute the coordinates from the JJIX as follows:
Pixel = mm * 96/25.4

Of course, if you set another resolution than 96 (e.g. 300 DPI), you shall adapt the formula accordingly: Pixel = mm * 300/25.4


Regards,


Gwenaëlle

1 Comment

Answer

Hello Jacob,


Thank you for contacting us.


The “input coordinates” of the strokes in the REST request body are in pixels, while those exported in the JIIX file in the REST response are in millimeters. For further details please, check this page about strokes and this one about jiix format.

By default, the input resolution is 96 DPI. To convert from millimeters to pixels, you shall compute the coordinates from the JJIX as follows:
Pixel = mm * 96/25.4

Of course, if you set another resolution than 96 (e.g. 300 DPI), you shall adapt the formula accordingly: Pixel = mm * 300/25.4


Regards,


Gwenaëlle


1 person likes this