Hello esteemed CDR &CorelDESIGNER API Members, and thanks for such excellent programming, scripts and productive support.1) I hoped you might please advise how to use cdrTraceType cdrTraceLineDrawing which FAILS, only producing a single linear path instead of CENTERLINE trace?When using cdrTraceLineArt the same macros below WORK, producing vectorized OUTLINE paths from bitmap textures:(please feel free to forward this to anyone who may instruct remedy. Thanks for any help, Jeff)(2) Bitmap Trace via With(reference) to ActivePage Shapes:Sub TraceActivePage() Dim s As Shape, sr As ShapeRange, p As Page For Each p In ActiveDocument.Pages p.Activate Set sr = ActivePage.Shapes.FindShapes(, cdrBitmapShape) Set s = ActiveShape For Each s In sr With s.Bitmap.Trace(cdrTraceLineDrawing, 25, 100, cdrColorBlackAndWhite, cdrUniform, , True, True, True) .Finish End With Next s Next pEnd Sub(1) Bitmap Trace via Set(parameter) TraceSettings:Sub TraceSettings()Dim s As Shape, sr As ShapeRangeDim t As TraceSettingsFor Each s In ActivePage.FindShapes(, cdrBitmapShape) Set t = s.Bitmap.Trace(cdrTraceLineDrawing, 25, 100, cdrColorBlackAndWhite, cdrUniform, , True, True, True) t.Finish Next s Set t = Nothing Set s = NothingEnd Sub
Hi Joe, happy confirming the scripts are now producing Centerlines, but not near as many as manually produced(Image 1b), and mainly in the blank(black) area's as if ignoring color information.see screenshots:6.jpg = my scripts producing only 5 curves7.jpg = your script producing only 2 curves8.jpg = my script, with curves UNgrouped.Regardless of Detail, Smoothing &CornerSmoothing settings, Trace scripts will produce no more than 3 - 5 curves only in black areas, unlike correct results when manually centerline traced.5) are your Trace script results like my manual results in screenshots 1a-1b.jpg?, might you send a screenshot please?Thanks again for any suggestions or solutions,Jeff
Hello again!
Not good news... Now that I have tested it a little more I can confirm that something is wrong with tracing using macros. The settings affect almost nothing...
I used that b/w bitmap method to find the best settings (in my opinion) for tracing nice lines:
My choice was 26. Then, while trying to trace that using code this happens:
(Yes, made a macro that changes the settings and exports an image for each one )
But as we can see something is broken with their settings - the results are nothing like doing it manually...
Sounds like the only real choice to get the look you want is to either play around with the threshold to get something close and/or possibly try and edit the image more so that the macro tracing works better somehow.
I will probably try to have a look at how lines like the ones you want could be achieved using a macro, now that there's a better idea of what is needed and for what purpose.
Actually, hold on!
The settings my be acting weird in the macro, but also we need to keep in mind that the percentages we perceive as (0-100) are, apparently, byte values when using macro - so they go 0-255 not 0-100.
If we keep that in mind and convert the values like this:
Sub TraceActivePage() Dim s As Shape, sr As ShapeRange, p As Page For Each p In ActiveDocument.Pages p.Activate Set sr = ActivePage.Shapes.FindShapes(, cdrBitmapShape) Set s = ActiveShape For Each s In sr With s.Bitmap.Trace(cdrTraceLineDrawing, 80 * 2.55, 45 * 2.55, , , 2, False, , True) .Finish End With Next s Next p End Sub
The results look much closer to what you have by hand.
Hopefully this helps a little.
That's brilliance, thanks Joe. This helps Corel far more than a little and just me, since this flaw affects All VBA scripting with equivalent undocumented, catastrophic, byte value range conversions. Corel should be made aware and desperate to correct this oversight preventing clients effectively scripting\automating entirety of CorelDRAW\PHOTOPAINT. Look forward to running your latest macro, greatly appreciated!6) you suggested 'playing with threshold, is that same as Detail level, or is there an actual "Threshold" setting to edit?,7) in your Detail level .gif, centerlines were rendered starting at value:104, but then with No variation in detail at any further increased level. So macro settings edits seem again to have only partial effect\control over tracing renders compared to full control manually tracing?8) was ShapeToTrace.Bitmap.ConvertToBW cdrRenderLineArt, 100, 24 the b/w bitmap method you used to find the best settings?, if not please show which?9) attached screenshots 9-10.jpg show ArtCAM's ColorReduction then Create Centerline applied to "Disconnected open vectors"(=vertical centerlines), then successfully to "Closed vector loops"(=lateral centerlines) respectively. Can this or equivalent method be applied in CorelDRAW macro to prevent the Vertical centerlines in your sceenshot results of latest macro?..Corel owe's you big illuminating\resolving These issues alone, and since indispensable to scripting they don't support, you should obvously be on payroll.Look forward to next soonest,U da Man Joe,thx,Jeff
..bit more good news: have developed CDR pathway equivalent to ArtCAM's ColorReduction, CreateCenterline &Closedvectorloops;CDR = - Bitmaps > Outline Trace > Line Art,- Bitmaps > Outline Trace > Line Art \ Colors(tab): Number of Colors=8,- select palette colors appropriate to "Merge" into mono-colored, masked(roto'd), target objects(characters),- save as vectors, - Bitmaps > Convert to Bitmap,.- Bitmaps > Centerline Trace > Line Drawing,. with my configs...this produces lateral Centerline vectors near accurate ArtCAM's, and far! less to cleanup\cut-away with Outlines from auto-rotoscoper.Hopefully you've still a bit of time to script this additional algorithm into 'lines of needed functions achieved using a macro?,I'm attempting same, adding the Outline Trace > Line Art color reduction\Merge &ConvertToBitmap to the sofar invariable Centerline macro.Come a long way in few hours toward full function thanks again to you,talk soon,Jeff