Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for .svg raster images #46

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

art103
Copy link

@art103 art103 commented Mar 6, 2014

Hi Stephan,
This is a clean re-write of my .svg raster image implementation against the re-architected LasaurApp.
The implementation adds a dependency on the Python Imaging Library (apt-get install python-imaging).

It still requires the G08 implementation to be added to the standard firmware. I've done an implementation for my Cortex-M4 based board, which may be useful as a reference. I would be happy to work with someone on the official firmware.

There is another branch "raster-dev" in my repository that adds a "pixels per inch" setting in addition to what is on this branch.
PPI has been very useful on my machine for vector cuts as well as setting the dot pitch for image rasters.
I suspect the jury would be out on its usefulness for the Lasersaur though.

Kind regards.
Richard.

@stefanix
Copy link
Owner

stefanix commented Jun 4, 2014

Hi Richard, I am working on merging this. So far I have removed the PIL dependancy and I am playing with grayscale. Do you think grayscale raster instead of monochrome is feasible? Have you tried it?

@art103
Copy link
Author

art103 commented Jun 5, 2014

Hi Stefan, I'm intrigued as how you've removed PIL - I'll take a look
when I get a chance.

I haven't tried grayscale.
1-bit meant all pre-processing (dithering etc) was done on the host and
left little work for the target. I believe this is the same approach as
a laser printer.

When I was experimenting with raster in the firmware, I found it very
hard to get the right balance of power. Too short a pulse and sparse
pixels are missed, too long and it takes forever or obliterates the work
piece!
I ended up with a pulse of ~3ms and slowed the line speed to allow 3ms /
dot. I then adjust the potentiometer or PWM to get the desired contrast
/ burn.

I have PWM power control into the analog input of my laser PSU so
grayscale is something I could (and would like to) try out.
In theory, it would be better to leave the laser "firing" for the whole
line and modulate the power instead. I assume this would remove the
non-linear spike of power seen when pulsing the trigger.
Whether this will work depends on how much lag there is between
adjusting the PWM and the PSU ramping up / down.

If I understand your setup correctly, you are using PWM and different
frequencies on the trigger line rather than the analog control?

On 04/06/14 10:20, Stefan Hechenberger wrote:

Hi Richard, I am working on merging this. So far I have removed the
PIL dependancy and I am playing with grayscale. Do you think grayscale
raster instead of monochrome is feasible? Have you tried it?


Reply to this email directly or view it on GitHub
#46 (comment).

@stefanix
Copy link
Owner

stefanix commented Jun 5, 2014

Thnaks for the info. I think I'll give grayscale a try. We'll see.

removed PIL
After some noodling around I realized that SVG and HTML both store
images in base64. You can take the encoded image data and simply assign
it to the src attribute of a Javascript Image() object. For more
advanced manipulations you can then stick the raster data into a Canvas
object and do low level pixel kungfu. This is how I do the grayscale
conversion. The other advantage of this approach is that you
efficiently draw the image in the browser too. There are a few nice
blit function for this.

Hacking with your code I ended up shaving a yak. It reminded me of many
other changes I wanted to make for a long time. Anyhow, I hope I have
it all nicely flushed out soon :)

Best,

On Thu, Jun 5, 2014 at 11:06 AM, Richard Taylor
[email protected] wrote:

Hi Stefan, I'm intrigued as how you've removed PIL - I'll take a look
when I get a chance.

I haven't tried grayscale.
1-bit meant all pre-processing (dithering etc) was done on the host
and
left little work for the target. I believe this is the same approach
as
a laser printer.

When I was experimenting with raster in the firmware, I found it very
hard to get the right balance of power. Too short a pulse and sparse
pixels are missed, too long and it takes forever or obliterates the
work
piece!
I ended up with a pulse of ~3ms and slowed the line speed to allow
3ms /
dot. I then adjust the potentiometer or PWM to get the desired
contrast
/ burn.

I have PWM power control into the analog input of my laser PSU so
grayscale is something I could (and would like to) try out.
In theory, it would be better to leave the laser "firing" for the
whole
line and modulate the power instead. I assume this would remove the
non-linear spike of power seen when pulsing the trigger.
Whether this will work depends on how much lag there is between
adjusting the PWM and the PSU ramping up / down.

If I understand your setup correctly, you are using PWM and different
frequencies on the trigger line rather than the analog control?

On 04/06/14 10:20, Stefan Hechenberger wrote:

Hi Richard, I am working on merging this. So far I have removed the
PIL dependancy and I am playing with grayscale. Do you think
grayscale
raster instead of monochrome is feasible? Have you tried it?


Reply to this email directly or view it on GitHub

#46 (comment).


Reply to this email directly or view it on GitHub.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants