You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am trying to add images to dxf with different dimensions, setting different width and height.
I found out that if I set smaller values to width and height, the images get bigger.
code example:
const dxf = new DxfWriter();
//IMAGE 1
const img1 = dxf.addImage(
'C:\Users\dev\Desktop\example.jpg', //Or the absolute path if not in the same folder.
'TEST', //The name of the image.
point3d(10, 10, 0), // The insertion point.
600, // The width of the image in pixels.
600, //The height of the image in pixels.
1, //The scale to be applied to the image.
0 //The rotation angle (Degrees) to be applied to the image.
);
img1.clippingStateFlag = 0;
//IMAGE 2
const img2 = dxf.addImage(
'C:\Users\dev\Desktop\example.jpg', //Or the absolute path if not in the same folder.
'TEST', //The name of the image.
point3d(-10, -10, 0), // The insertion point.
60, // The width of the image in pixels.
60, //The height of the image in pixels.
1, //The scale to be applied to the image.
0 //The rotation angle (Degrees) to be applied to the image.
);
img2.clippingStateFlag = 0;
In the output dxf file, "IMAGE 2" (width 60 , height 60) is TEN times bigger than "IMAGE 1" (width 600 , height 600) and
I was expecting the opposite result.
Maybe am I missing something?
The text was updated successfully, but these errors were encountered:
Magorick
changed the title
Dxf Image dimension issue
Dxf Image dimensions issue
Nov 11, 2022
Really I have no idea why this work like that, but the width and height should be the acual width and height of the image in pixels, and you can control the size by the scale property.
You can do a custom scaling for the Image like shown below. It only works for square Images...
this.dxf.addImage(
Image Path Here, // Or the absolute path of the image if it isn't in the same folder.
Random Name,
point, // Insertion point of the bottomLeft corner of the image.
width, // the width of the image
height, // the height of the image (width * width) / 1024, // Scale
0, // rotation
);
Hi,
I am trying to add images to dxf with different dimensions, setting different width and height.
I found out that if I set smaller values to width and height, the images get bigger.
code example:
const dxf = new DxfWriter();
//IMAGE 1
const img1 = dxf.addImage(
'C:\Users\dev\Desktop\example.jpg', //Or the absolute path if not in the same folder.
'TEST', //The name of the image.
point3d(10, 10, 0), // The insertion point.
600, // The width of the image in pixels.
600, //The height of the image in pixels.
1, //The scale to be applied to the image.
0 //The rotation angle (Degrees) to be applied to the image.
);
img1.clippingStateFlag = 0;
//IMAGE 2
const img2 = dxf.addImage(
'C:\Users\dev\Desktop\example.jpg', //Or the absolute path if not in the same folder.
'TEST', //The name of the image.
point3d(-10, -10, 0), // The insertion point.
60, // The width of the image in pixels.
60, //The height of the image in pixels.
1, //The scale to be applied to the image.
0 //The rotation angle (Degrees) to be applied to the image.
);
img2.clippingStateFlag = 0;
const dxfString = dxf.stringify();
this.downloadFile(dxfString);
In the output dxf file, "IMAGE 2" (width 60 , height 60) is TEN times bigger than "IMAGE 1" (width 600 , height 600) and
I was expecting the opposite result.
Maybe am I missing something?
The text was updated successfully, but these errors were encountered: