TheSwamp
Code Red => AutoLISP (Vanilla / Visual) => Topic started by: squirreldip on November 21, 2017, 12:08:46 PM
-
Back in the 'old' days when you imported an image in came in as a block with coloured 2d solids. Is it possible to import using this method with current versions? If not, is anyone aware of a utility to do so?
-
Adobe Illustrator can export images to DWG.
-
I don't have access to Illustrator... I'm trying to write a routine that will read the 'pixels'
Another option (which is likely a better idea) is to use Visual Studio and write the data I want to a file.
-
You found one solution
http://lisp2arx.3xforum.ro (http://lisp2arx.3xforum.ro)
Edit by Admin Are you fishing?
-
If you save the image as a .bmp file with a color depth of 256 (8 bits), then every pixel will be represented by 1 byte in the file. The first part of the file defines the X and Y size of the image, the palette etc. then all 'pixel bytes' follow in sequence.
For images with a limited palette this is doable:
- Save as BMP with a color depth of 256.
- Read the BMP with a binary read Lisp function. This should return a list of integers.
- Using the X and Y size calculate the total number of pixels and remove the bytes of the header from the list.
- Turn the list into a list of lists using the X size.
- Manually change the integers to color values.
-
Thanks for the comments!
I think I found the simplest solution and it was to use Visual Studio Community - fairly easy to work with graphics file and I can output text in whatever structure I want to.