I’m Currently looking into how I can use Potrace to convert bitmaps to DXF files, and i’d like to use page_dxf() to generate the DXF file.
However i’m having trouble exporting the bitmaps correctly when using page_dxf().
When I look into the file all the data is zeroes. I have also tried using page_svg() and the same is true there, everything is zero.
I suspect that is it because i’m not using imginfo_t correctly, in particular I suspect that trans_t is the problem.
Is imginfo_t the problem and if so what should i do, and where can i read up on it?
Hi Jesper, I probably won't be able to offer much help in debugging your code, as I'm not a very proficient C++ programmer. The function page_svg() was not really intended to be used outside of Potrace; it relies on the global data structure "info" which is defined in main.c. Perhaps the problem is that you have not initialized the info structure. It seems that your info.unit is equal to 0, which would give a division by zero error (see the infinite scaling in your SVG file) and would set all pixels to 0. Try setting info.unit to 10.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi,
I’m Currently looking into how I can use Potrace to convert bitmaps to DXF files, and i’d like to use page_dxf() to generate the DXF file.
However i’m having trouble exporting the bitmaps correctly when using page_dxf().
When I look into the file all the data is zeroes. I have also tried using page_svg() and the same is true there, everything is zero.
I suspect that is it because i’m not using imginfo_t correctly, in particular I suspect that trans_t is the problem.
Is imginfo_t the problem and if so what should i do, and where can i read up on it?
The links are for the code that i have, and the SVG file Potrace crates
Code: https://pastebin.com/uEbwz1zr
Partial SVG file(due to pastebin limit): https://pastebin.com/iy5iRBdR
I hope there is some help to be had since potrace looks very promising.
Best Regards,
Jesper
Hi Jesper, I probably won't be able to offer much help in debugging your code, as I'm not a very proficient C++ programmer. The function page_svg() was not really intended to be used outside of Potrace; it relies on the global data structure "info" which is defined in main.c. Perhaps the problem is that you have not initialized the info structure. It seems that your info.unit is equal to 0, which would give a division by zero error (see the infinite scaling in your SVG file) and would set all pixels to 0. Try setting info.unit to 10.