GPencil: Trace images using Potrace lib #79877

Closed
opened 2020-08-18 12:28:33 +02:00 by Antonio Vazquez · 16 comments

Trace images and convert to grease pencil strokes.

For tracing, Potrace lib will be used (the same used in Inkscape).

Trace images and convert to grease pencil strokes. For tracing, Potrace lib will be used (the same used in Inkscape).
Antonio Vazquez self-assigned this 2020-08-18 12:28:33 +02:00
Author
Member

Changed status from 'Needs Triage' to: 'Confirmed'

Changed status from 'Needs Triage' to: 'Confirmed'
Author
Member

Added subscribers: @antoniov, @mendio, @pepe-school-land

Added subscribers: @antoniov, @mendio, @pepe-school-land
First-time contributor

Added subscriber: @AonoZan

Added subscriber: @AonoZan
Author
Member
[TraceTest.mp4](https://archive.blender.org/developer/F8791171/TraceTest.mp4)

Added subscriber: @brecht

Added subscriber: @brecht

Rather than doing this from the image editor, this could convert an image empty to a grease pencil object. So you could drag and drop an image into the 3D viewport and then convert it.

The downside would be that it's not very discoverable, but doing it from the image editor isn't particularly discoverable either.

For a more discoverable version, there could be Add > Grease Pencil > From Image ..., which could open a file browser similar to Add > Volume > Import VDB... .

Rather than doing this from the image editor, this could convert an image empty to a grease pencil object. So you could drag and drop an image into the 3D viewport and then convert it. The downside would be that it's not very discoverable, but doing it from the image editor isn't particularly discoverable either. For a more discoverable version, there could be Add > Grease Pencil > From Image ..., which could open a file browser similar to Add > Volume > Import VDB... .
Author
Member

I like more the open image solution. Not sure if also keep the option in the image editor.

Anyway, I'm going to look how do the open file browser for an image.

I like more the open image solution. Not sure if also keep the option in the image editor. Anyway, I'm going to look how do the open file browser for an image.

I guess the downside of doing it immediately from the file browser is that you don't always get to see the image and tweaking the parameter is not so obvious without looking at the image?

Another way of doing it would be for the From Image ... operator to be a macro that first calls the operator to add an image object with the file browser (as already exists for Add > Image), and then in a second step calls an operator to convert the image to a grease pencil object.

I guess the downside of doing it immediately from the file browser is that you don't always get to see the image and tweaking the parameter is not so obvious without looking at the image? Another way of doing it would be for the From Image ... operator to be a macro that first calls the operator to add an image object with the file browser (as already exists for Add > Image), and then in a second step calls an operator to convert the image to a grease pencil object.
Author
Member

Yes, the reason to do it in Image Editor was to see the image before. Actually, I call a python popup menu to define parameters and then call to the operator. I used the Bake operator as model to define the popup because the redo panel was not an option (the trace was done before tweak any value).

Usually, all trace tools display the image and then you press trace.

Actually I don't see problems in:

  1. Open image editor and load the image you want trace. You can look and maybe in the future apply any transformation (for example transform to BW)
  2. You select the trace option and define the parameters
  3. Press Trace button.

Opening directly from browser skip step 1) and this can be valid in some situations, but normally you want see what are you doing.

Yes, the reason to do it in Image Editor was to see the image before. Actually, I call a python popup menu to define parameters and then call to the operator. I used the Bake operator as model to define the popup because the redo panel was not an option (the trace was done before tweak any value). Usually, all trace tools display the image and then you press trace. Actually I don't see problems in: 1) Open image editor and load the image you want trace. You can look and maybe in the future apply any transformation (for example transform to BW) 2) You select the trace option and define the parameters 3) Press Trace button. Opening directly from browser skip step 1) and this can be valid in some situations, but normally you want see what are you doing.
Author
Member

About macro, you mean create a "double" call like is done in duplication of objects, first call duplication and later call to transform... it could work, but really we save work to the user?

About macro, you mean create a "double" call like is done in duplication of objects, first call duplication and later call to transform... it could work, but really we save work to the user?

The point is not so much to save work, but to have a consistent workflow. Going into the image editor to create an object in the 3D viewport is inconsistent with other operators and tools we have. When you create something you do that in the editor where you can see and edit the thing that was created.

In Inkscape I think you also add a bitmap into your document and then convert it in place.

The point is not so much to save work, but to have a consistent workflow. Going into the image editor to create an object in the 3D viewport is inconsistent with other operators and tools we have. When you create something you do that in the editor where you can see and edit the thing that was created. In Inkscape I think you also add a bitmap into your document and then convert it in place.
Author
Member

I have decided to use Empty images because it's the most intuitive way. Now, the option is not in the Image Editor.

Trace_from_empty.mp4

I don't know if there is a way to calc automatically the scale, because don't know what scale is using internally Potrace.

EDIT: I think I have found a way to calc the correct scale.

I have decided to use Empty images because it's the most intuitive way. Now, the option is not in the Image Editor. [Trace_from_empty.mp4](https://archive.blender.org/developer/F8791554/Trace_from_empty.mp4) I don't know if there is a way to calc automatically the scale, because don't know what scale is using internally `Potrace`. EDIT: I think I have found a way to calc the correct scale.
Member

Added subscriber: @EAW

Added subscriber: @EAW
First-time contributor

This issue was referenced by 4d62bb8fe5

This issue was referenced by 4d62bb8fe57ca431da669386d47ca185f3624c9a
Author
Member

Changed status from 'Confirmed' to: 'Resolved'

Changed status from 'Confirmed' to: 'Resolved'
First-time contributor

Added subscriber: @AndreaMonzini

Added subscriber: @AndreaMonzini
Sign in to join this conversation.
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset Browser
Interest
Asset Browser Project Overview
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
Interest
EEVEE & Viewport
Interest
Freestyle
Interest
Geometry Nodes
Interest
Grease Pencil
Interest
ID Management
Interest
Images & Movies
Interest
Import Export
Interest
Line Art
Interest
Masking
Interest
Metal
Interest
Modeling
Interest
Modifiers
Interest
Motion Tracking
Interest
Nodes & Physics
Interest
OpenGL
Interest
Overlay
Interest
Overrides
Interest
Performance
Interest
Physics
Interest
Pipeline, Assets & IO
Interest
Platforms, Builds & Tests
Interest
Python API
Interest
Render & Cycles
Interest
Render Pipeline
Interest
Sculpt, Paint & Texture
Interest
Text Editor
Interest
Translations
Interest
Triaging
Interest
Undo
Interest
USD
Interest
User Interface
Interest
UV Editing
Interest
VFX & Video
Interest
Video Sequencer
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Legacy
Blender 2.8 Project
Legacy
Milestone 1: Basic, Local Asset Browser
Legacy
OpenGL Error
Meta
Good First Issue
Meta
Papercut
Meta
Retrospective
Meta
Security
Module
Animation & Rigging
Module
Core
Module
Development Management
Module
EEVEE & Viewport
Module
Grease Pencil
Module
Modeling
Module
Nodes & Physics
Module
Pipeline, Assets & IO
Module
Platforms, Builds & Tests
Module
Python API
Module
Render & Cycles
Module
Sculpt, Paint & Texture
Module
Triaging
Module
User Interface
Module
VFX & Video
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Priority
High
Priority
Low
Priority
Normal
Priority
Unbreak Now!
Status
Archived
Status
Confirmed
Status
Duplicate
Status
Needs Info from Developers
Status
Needs Information from User
Status
Needs Triage
Status
Resolved
Type
Bug
Type
Design
Type
Known Issue
Type
Patch
Type
Report
Type
To Do
No Milestone
No project
No Assignees
6 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: blender/blender#79877
No description provided.