Brachiograph and Turtle - turtle-graphics

I am currently in the process of building a Brachiograph plotter. I am 75 years old and have a minor disability with my hands. I would like to find out if anybody can tell me how I can output Turtle Graphics to a file that can be read by the Brachiograph plotter. I believe that the linedraw.py converts a .svg to a .json file that is read by the Brachiograph. I would like to create some fractal image files and print them with the Brachiograph.
Thank you for any help that you can offer with this project.
Dick Burkhartzmeyer

Welcome to Stackoverflow. In your OP you state "I believe that the linedraw.py converts a .svg to a .json file[...]". Looking at the documentation it looks like linedraw.py will convert a bitmap to an svg file and a json file.
From the documentation:
The main use you will have for linedraw is to take a bitmap image file
as input, and save the vectorised version as:
an SVG file, to check it
a JSON file, to draw with the BrachioGraph.
The way I would approach this is to create an svg with Turtle and then in your Python script convert that to a png. Then linedraw.py can be used to convert that to your JSON BrachioGraph file. I found a solution to do that in another SO thread. The answer in that thread is using Cairosvg to convert the SVG to PNG format.

Related

ImageMagick: Convert selective images to Multipage PDF without using external text file?

Let's say I have a directory with 5 TIFF files in it and I want to convert some of them to a multipage PDF, but that there are other TIFS in the same directory that I do not want in the same PDF.
In other words, I want to convert file1.TIF, file2.TIF, file3.TIF --> foo.pdf, but I want to ignore file4.TIF and file5.TIF located in the same folder.
It would seem from the documentation that the only way to do this is to provide ImageMagick with a text file listing out the files and then point to it when calling the program, as in:
convert #FilesToConvert.txt C:\foo3.pdf
Is there no way to make the call inline though, so that I don't have to create a separate text file for each conversion?
Thanks in advance!
You should be able to use:
convert file1.TIF file2.TIF file3.TIF foo.pdf

how to convert a DocumentFormat.OpenXml.Presentation.shape into a HTML SVG element

I need a sample code for converting DocumentFormat.OpenXml.Presentation.shape into a HTML SVG element in .net. Please help me for this.
Thanks in advance.
RagesH.
If the presentation has shapes stored as a WMF image, then you can pass the images as a file or stream and convert it to SVG format. There are tools to convert WMF2SVG.
Refer this page.
This is for Java https://code.google.com/p/wmf2svg/
For using it with .NET, you have to convert this Jar into DLL and use it.
For Converting Jar into DLL refer this https://code.google.com/p/jar2ikvmc/
This works for me.
Hope this helps!

How to inject exif metadata into an image, without copying the image?

I have previously asked this question: How to write exif metadata to an image.
I now have found a way to inject metadata. However, it results in a copy of the image into memory. With large images, and the need to already have a copy in memory, this is going to have performance, and possibly cause a memory crash.
Is there a correct way to inject metadata without having to make a copy of the image? Perhaps it could be tacked on to a file, after it is written to disk?
I would prefer native implementations, without having to resort to a third party library just for this, if at all possible.
This question could require a small or large amount of code depending on what you need. EXIF data is stored in a JPEG APP1 marker (FFE1). It looks very much like a TIFF file with a TIFF header, IFD and individual tags with the data. If you can build your own APP1 marker segment, then inserting it or replacing it in a JPEG file is trivial. If you are looking to read the metadata from an existing file, add some new tags and then write it back, that can be more involved. The tricky part of EXIF data are those tags which require more than 4-bytes. Each TIFF tag is 12 bytes: 2-byte tag, 2-byte data type, 4-byte count, 4-byte data. If the data doesn't fit completely in the 4 bytes of the tag, then the tag specifies an absolute offset into the file of where to find the data. If the existing data has any tags with data like this (e.g. make, model, capture date, capture time, etc), you will need to repack that data by fixing the offsets and then add your own. In a nutshell:
1) If you are adding a pre-made APP1 marker to a JPEG file, this is simple and requires little code.
2) If you need to read the existing meta-data from a JPEG file, add your own and write it back, the code is a bit more involved. It's not "difficult", but it involves a lot more than just reading and writing blocks of data.
Start by reading the TIFF 6.0 spec to understand the tag and directory structure:
TIFF 6.0 spec
Next, take a look at the JPEG EXIF spec:
EXIF 2.2 Spec
I would expect the existing exif manipulator software can do it, but haven't tested.
Links:
http://www.exiv2.org/
http://libexif.sourceforge.net/
http://www.kraxel.org/blog/linux/fbida/
CGImageSourceRef could be used to get image properties including its thumbnail without loading all image data into memory. This way memory is not wasted by UIImage and NSData.
CGImageSourceRef imageSource = CGImageSourceCreateWithURL((CFURLRef)[NSURL fileURLWithPath:path], NULL);
Then save CGImageDestinationRef adding the source image and exif data.
CGImageDestinationAddImageFromSource (destRef,
imageSource,
0,
(CFDictionaryRef)propertes );//exif
BOOL success = CGImageDestinationFinalize(destRef);

How to convert *.cur (Windows cursor) stream to bitmap?

It's easy to convert from cur-file to bitmap, using the LoadCursorFromFile API call and calling DrawIcon(..., hCursor) on that bitmap.
But how can I load it from stream without too much handcoding and convert into TBitmap?
There is an MSDN library article that describes the .cur and .ico file formats in great detail. It's pretty easy – I wrote some Delphi code to read .ico files not so long ago using this article as my reference.
Use Kicon.

how to read data from dat file?

how to read data from .dat files ?
i just tried like this memo1.lines.loadfromfile('c:\myfile.dat'); but not worked
Note : File type is binary
can any one please help me :)
#radick to show the contents of an binary file in a memo control you must encode o convert the data to valid ASCII characters, to turn it all into text. because you can not load something that is not text into a text control.
you can find a very nice sample from Peter Below in this link.
read a binary file and display the byte values as ASCII?
(source: swissdelphicenter.ch)
Use the TStream descendants from the VCL Classes unit to read binary files.
There are plenty Delphi TStream reading binary files examples you can find using Google.
--jeroen
You might look at this post as they seem to be discussing this very thing.

Resources