using a PNG logo

classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

using a PNG logo

jon_bondy
I've been "engraving" a logo on a surface by differencing some text that
I created using write().

The customer now supplied a logo file (attached as a PNG).  I can get
the thing to appear using

             scale([0.1, 0.1, 0.1])
                surface(file =
"d:/jon/Logo_AnywhereTideClock_Inverted.png", center = true);

The problem is that once that is done, OpenSCAD becomes essentially
unresponsive.  F5 and F6 take forever, and the visible model when using
F5 is very slow.  I tried using render() but that did not help either.

I tried computing an STL separately and then using import(), but that is
equally slow (the STL is 150KB).

Any idea how to "emboss" an arbitrary PNG onto a surface without making
OpenSCAD unusable?

Jon

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org

Logo_AnywhereTideClock_Inverted.PNG (70K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: using a PNG logo

kintel
Administrator
For this particular design, get a vector file rather than a bitmap, or remake the design using OpenSCAD primitives.
surface() is going to destroy responsiveness as it has to generate massive amounts of polygons.

 -Marius

> On Nov 9, 2015, at 10:49 AM, jon <[hidden email]> wrote:
>
> I've been "engraving" a logo on a surface by differencing some text that I created using write().
>
> The customer now supplied a logo file (attached as a PNG).  I can get the thing to appear using
>
>            scale([0.1, 0.1, 0.1])
>               surface(file = "d:/jon/Logo_AnywhereTideClock_Inverted.png", center = true);
>
> The problem is that once that is done, OpenSCAD becomes essentially unresponsive.  F5 and F6 take forever, and the visible model when using F5 is very slow.  I tried using render() but that did not help either.
>
> I tried computing an STL separately and then using import(), but that is equally slow (the STL is 150KB).
>
> Any idea how to "emboss" an arbitrary PNG onto a surface without making OpenSCAD unusable?
>
> Jon
> <Logo_AnywhereTideClock_Inverted.PNG>_______________________________________________
> OpenSCAD mailing list
> [hidden email]
> http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org


_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Reply | Threaded
Open this post in threaded view
|

Re: using a PNG logo

ednisley
In reply to this post by jon_bondy
On 11/09/2015 10:49 AM, jon wrote:
> how to "emboss" an arbitrary PNG

Use a much smaller image with the worst resolution = fewest pixels you
can possibly stand.

A year or two ago, OpenSCAD could handle an image up to about 300x300
pixels. That may have changed one way or the other, but it'll give you
an idea of how small "fewest" must be.

Here's the checklist I used to create PNG images for cookie cutter outlines:

http://softsolder.com/2012/11/29/automated-cookie-cutters-image-preparation-checklist/

And for chocolate molds:

http://softsolder.com/2014/02/14/chocolate-mold-image-preparation-checklist/

When you need more dots, surface() is not your friend...

--
Ed
softsolder.com

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
 --
Ed
softsolder.com
Reply | Threaded
Open this post in threaded view
|

Re: using a PNG logo

Brad Pitcher

Trace the bitmap to a path in Inkscape and export it the path to *.dxf[0] or even*.scad[1] using an Inkscape plugin


On Mon, Nov 9, 2015 at 9:59 AM Ed Nisley <[hidden email]> wrote:
On 11/09/2015 10:49 AM, jon wrote:
> how to "emboss" an arbitrary PNG

Use a much smaller image with the worst resolution = fewest pixels you
can possibly stand.

A year or two ago, OpenSCAD could handle an image up to about 300x300
pixels. That may have changed one way or the other, but it'll give you
an idea of how small "fewest" must be.

Here's the checklist I used to create PNG images for cookie cutter outlines:

http://softsolder.com/2012/11/29/automated-cookie-cutters-image-preparation-checklist/

And for chocolate molds:

http://softsolder.com/2014/02/14/chocolate-mold-image-preparation-checklist/

When you need more dots, surface() is not your friend...

--
Ed
softsolder.com

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Reply | Threaded
Open this post in threaded view
|

Re: using a PNG logo

Neon22
This post was updated on .
I also advise inkscape and the "Trace bitmap" command and then export using the openscad export script.
But I made a v7 which works better if you're going to use the polygon shape in a dedicated piece of code.
It puts the polygon into variables of points and paths, if required.
Here:
- http://www.thingiverse.com/thing:1065500

But then you may have to use png for some reason. In which case make it as small as possible.
Reply | Threaded
Open this post in threaded view
|

Re: using a PNG logo

kintel
Administrator
Btw.,

For the adventurous, there is an experimental bitmap tracer in a separate OpenSCAD branch:
https://github.com/openscad/openscad/pull/1110
https://github.com/openscad/openscad/tree/potrace

 -Marius


_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Reply | Threaded
Open this post in threaded view
|

Re: using a PNG logo

ctchin
In reply to this post by jon_bondy
Yeah I think the number of pixels is killing OpenSCAD due to the unnecessarily large number of polygons.  This particular design is simple enough that it OUGHT to be generated with some vector-based format.  By .DXF as someone suggested or re-design it from OpenSCAD coding. 

I've made 512x512 bitmap embossing on OpenSCAD with satisfactory result (pre-2015-03). 

On 11/9/2015 11:49 PM, jon wrote:
I've been "engraving" a logo on a surface by differencing some text that I created using write().

The customer now supplied a logo file (attached as a PNG).  I can get the thing to appear using

            scale([0.1, 0.1, 0.1])
               surface(file = "d:/jon/Logo_AnywhereTideClock_Inverted.png", center = true);

The problem is that once that is done, OpenSCAD becomes essentially unresponsive.  F5 and F6 take forever, and the visible model when using F5 is very slow.  I tried using render() but that did not help either.

I tried computing an STL separately and then using import(), but that is equally slow (the STL is 150KB).

Any idea how to "emboss" an arbitrary PNG onto a surface without making OpenSCAD unusable?

Jon


_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org

-- 
錢建庭 教授、教研办副主任
深圳大学 生物医学工程系

CHIN, Chien Ting, Professor, Vice Chairman (Education)
Department of Biomedical Engineering
Shenzhen University
Tel: +86-755-8667-1915

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Reply | Threaded
Open this post in threaded view
|

Re: using a PNG logo

clothbot
In reply to this post by kintel
Hey Marius,

Some smarts could be added to this section of surface.cc:

https://github.com/openscad/openscad/blob/master/src/surface.cc#L236-L260

...to only create two poly's (not four with vx average midpoint) in the following three cases:

v1==v3
v2==v4
v1==v2 && v3==v4

This could reduce the mesh size significantly in monochrome and same-colour regions, and it should also take care of many artificial "saw tooth diagonals" around the perimeter of same-colour regions.

Thoughts?

Andrew.