Arduino and Swordfish Basic Graphic Converter
Moderators: Chuckt, Garth, bitfogav
- brad
- Site Admin
- Posts: 2578
- Joined: Fri Mar 26, 2010 10:30 pm [phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1266: count(): Parameter must be an array or an object that implements Countable
Arduino and Swordfish Basic Graphic Converter
Hi everyone, I have been slowly working on my Graphic Conversion program for Arduino and Swordfish IDE's.
Basically it will allow you to open up a graphic (most probably one you have drawn yourself for a game you are making for a microcontroller) and you can then convert it into individual 1's and 0's organised into either bytes, words or longwords. It will output the data to either Swordfish Basic arrays or Arduino arrays.
It will be quite a handy project for those making their own games - right Joshua!
Hopefully it will be finished this weekend but here's a screenshot of the work in progress:
Basically it will allow you to open up a graphic (most probably one you have drawn yourself for a game you are making for a microcontroller) and you can then convert it into individual 1's and 0's organised into either bytes, words or longwords. It will output the data to either Swordfish Basic arrays or Arduino arrays.
It will be quite a handy project for those making their own games - right Joshua!
Hopefully it will be finished this weekend but here's a screenshot of the work in progress:
-
- I practically live here!
- Posts: 372
- Joined: Fri Feb 18, 2011 4:24 am [phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1266: count(): Parameter must be an array or an object that implements Countable
Re: Arduino and Swordfish Basic Graphic Converter
can't wait to see this
- brad
- Site Admin
- Posts: 2578
- Joined: Fri Mar 26, 2010 10:30 pm [phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1266: count(): Parameter must be an array or an object that implements Countable
Re: Arduino and Swordfish Basic Graphic Converter
Well wait no more! Here's the initial release:
It's quite straight forward to use the only real requirement is that the width of your graphic is divisible by 8, 16 or 32 (because the output data will be in one of these formats). Just draw your image up in Paint.
You can then select which colors you want to actually get spit out in the output (for example, for your RED / GREEN matrix game Joshua, you would only need the red and green data) As you select these it will update the program memory required for the graphic.
Select what programming language you are using (it will update the output data types to suit) and then select which output data type you want (lots of 8bits, 16bits or 32bits)
Type in the name that you want your array to be (for example if you have a picture of a room in a game you are making, you might call it Room1)
Then click convert (and wait a few seconds - or longer depending on how big the image is and the speed of your computer) A message box will appear telling you that the data has been copied to the clipboard. All you need to do is paste it into swordfish or arduino.
Joshua - let me know if the output data is incorrect - I did some research and even tested it so it seems to be okay though.
And lastly, in a later release I will add the option for you to select which part of the graphic is a barrier (for example you might not want to be able to walk through the red walls, you could just do this in your code to watch out for a certain color but in games I have made sometimes you want to be able to walk through colors even though they are the same color as ones you can't walk through (if that makes sense...)
You will need Visual Basic Extensions installed. Try loading it up and if it gives you any errors please let me know.It's quite straight forward to use the only real requirement is that the width of your graphic is divisible by 8, 16 or 32 (because the output data will be in one of these formats). Just draw your image up in Paint.
You can then select which colors you want to actually get spit out in the output (for example, for your RED / GREEN matrix game Joshua, you would only need the red and green data) As you select these it will update the program memory required for the graphic.
Select what programming language you are using (it will update the output data types to suit) and then select which output data type you want (lots of 8bits, 16bits or 32bits)
Type in the name that you want your array to be (for example if you have a picture of a room in a game you are making, you might call it Room1)
Then click convert (and wait a few seconds - or longer depending on how big the image is and the speed of your computer) A message box will appear telling you that the data has been copied to the clipboard. All you need to do is paste it into swordfish or arduino.
Joshua - let me know if the output data is incorrect - I did some research and even tested it so it seems to be okay though.
And lastly, in a later release I will add the option for you to select which part of the graphic is a barrier (for example you might not want to be able to walk through the red walls, you could just do this in your code to watch out for a certain color but in games I have made sometimes you want to be able to walk through colors even though they are the same color as ones you can't walk through (if that makes sense...)
- Saimaster13
- I practically live here!
- Posts: 176
- Joined: Mon Aug 13, 2012 4:23 am
- Location: Sarasota, Florida [phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1266: count(): Parameter must be an array or an object that implements Countable
Re: Arduino and Swordfish Basic Graphic Converter
This is a nice program. It may also be useful if you could choose whether the data outputs a color as a 1 or a 0. (example: red black red is either 101 or 010.)
I found a few few problems/bugs though:
I put red and green in a picture and the program switched the data (red is green, green is red.)
I tried putting yellow into a picture and it did not do red or green.
I put orange in the picture and only updated MyDataGreen (so probably red.)
The data set the program outputted:
const prog_uint8_t MyDataRed[8]PROGMEM={0b11111001, 0b11111101, 0b11111101, 0b11111101, 0b11111101, 0b11111001, 0b11110000, 0b11111110};
const prog_uint8_t MyDataGreen[8]PROGMEM={0b11000110, 0b10111010, 0b10111010, 0b11111010, 0b11111010, 0b11110110, 0b11101111, 0b10000001};
Bugs or no bugs, this is still an awesome program! It'll make map making a whole lot easier for my game!.
I found a few few problems/bugs though:
I put red and green in a picture and the program switched the data (red is green, green is red.)
I tried putting yellow into a picture and it did not do red or green.
I put orange in the picture and only updated MyDataGreen (so probably red.)
The data set the program outputted:
const prog_uint8_t MyDataRed[8]PROGMEM={0b11111001, 0b11111101, 0b11111101, 0b11111101, 0b11111101, 0b11111001, 0b11110000, 0b11111110};
const prog_uint8_t MyDataGreen[8]PROGMEM={0b11000110, 0b10111010, 0b10111010, 0b11111010, 0b11111010, 0b11110110, 0b11101111, 0b10000001};
Bugs or no bugs, this is still an awesome program! It'll make map making a whole lot easier for my game!.
- Attachments
-
- Blown up picture
- 2 big.png (473 Bytes) Viewed 22238 times
-
- The picture I used
- 2.png (187 Bytes) Viewed 22238 times
Joshua
- brad
- Site Admin
- Posts: 2578
- Joined: Fri Mar 26, 2010 10:30 pm [phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1266: count(): Parameter must be an array or an object that implements Countable
Re: Arduino and Swordfish Basic Graphic Converter
No Worries, I should be able to add that tonight.This is a nice program. It may also be useful if you could choose whether the data outputs a color as a 1 or a 0. (example: red black red is either 101 or 010.)
I found a few few problems/bugs though:
I haven't been able to replicate this fault - red comes up as red and green as greenI put red and green in a picture and the program switched the data (red is green, green is red.)

Code: Select all
I tried putting yellow into a picture and it did not do red or green.
Same as above, there must not have been enough red in the colorI put orange in the picture and only updated MyDataGreen (so probably red.)

Thanks for the feedback, I'll make these changes and then see how it works for you. Once you think it's all good - I'll release it out on the arduino forums etc...Bugs or no bugs, this is still an awesome program! It'll make map making a whole lot easier for my game!.
- Saimaster13
- I practically live here!
- Posts: 176
- Joined: Mon Aug 13, 2012 4:23 am
- Location: Sarasota, Florida [phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1266: count(): Parameter must be an array or an object that implements Countable
Re: Arduino and Swordfish Basic Graphic Converter
My bad, I forgot to put black in the areas that were white, so I thought 1 was off (which is why I wanted an ability to change that) which made me think that red and green were switched...
Anyway, it works fine now that I realize what it does, and yellow IS both red and green.
Thanks Brad!
(Sorry for my misconception.)
Anyway, it works fine now that I realize what it does, and yellow IS both red and green.
Thanks Brad!
(Sorry for my misconception.)
Joshua
- brad
- Site Admin
- Posts: 2578
- Joined: Fri Mar 26, 2010 10:30 pm [phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1266: count(): Parameter must be an array or an object that implements Countable
Re: Arduino and Swordfish Basic Graphic Converter
Well I added more features anyway!
Now there is a color adjustment (which basically just changes how bright the colors need to be to be included in the conversion. You will need to click convert each time you adjust the color setting.
I have also added an invert data option so now you will get logic 0's to turn the LED's on (great for common anode matrix devices)
I have also brought back the output image preview - so you can see what the image will look like on a matrix display - great for when you are trying to get the color adjustment just right!
Not a new feature but you can click and drag the original image and place it where ever you like - perhaps next to the converted image to see the difference...
Here's some examples of different color settings with a sonic the hedgehog image: (notice the higher the number, the harder it is for a color to get counted in the conversion so the darker the output looks. And here's the download:




Here's some examples of different color settings with a sonic the hedgehog image: (notice the higher the number, the harder it is for a color to get counted in the conversion so the darker the output looks. And here's the download:
-
- I practically live here!
- Posts: 372
- Joined: Fri Feb 18, 2011 4:24 am [phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1266: count(): Parameter must be an array or an object that implements Countable
Re: Arduino and Swordfish Basic Graphic Converter
must be missing something?
I have visual basic 2010 express so how to use the graphic converter etc.
Seems I had this issue way back when
I have visual basic 2010 express so how to use the graphic converter etc.
Seems I had this issue way back when
- brad
- Site Admin
- Posts: 2578
- Joined: Fri Mar 26, 2010 10:30 pm [phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1266: count(): Parameter must be an array or an object that implements Countable
Re: Arduino and Swordfish Basic Graphic Converter
You don't need to have Visual Basic Express 2010 (you only need that if you wanted to edit graphic converter in some way)
What error does it give you?
What error does it give you?
-
- I practically live here!
- Posts: 372
- Joined: Fri Feb 18, 2011 4:24 am [phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1266: count(): Parameter must be an array or an object that implements Countable
Re: Arduino and Swordfish Basic Graphic Converter
No errors yet as I load the visual basic express or the graphic converter but what to do next??
I tried opening the graphic converter into the VB express but nothing happens. Going to try again today, yesterday was kinda busy with honey do's (wife is off on Tuesdays and Thursdays)
I tried opening the graphic converter into the VB express but nothing happens. Going to try again today, yesterday was kinda busy with honey do's (wife is off on Tuesdays and Thursdays)
- brad
- Site Admin
- Posts: 2578
- Joined: Fri Mar 26, 2010 10:30 pm [phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1266: count(): Parameter must be an array or an object that implements Countable
Re: Arduino and Swordfish Basic Graphic Converter
The graphic converter is a completely stand alone program. You don't need to (and can't) open it in Visual Studio. You can only open Visual Studio projects and source code in Visual Studio, I have only uploaded the .exe file which means it can only be run on it's own.
All you need to do is download the file, unzip it and then double click the .exe file
All you need to do is download the file, unzip it and then double click the .exe file

-
- I practically live here!
- Posts: 372
- Joined: Fri Feb 18, 2011 4:24 am [phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1266: count(): Parameter must be an array or an object that implements Countable
Re: Arduino and Swordfish Basic Graphic Converter
I did that and get the graphic converter screen but tried inputing various data in the little black boxes but I must be doing something wrong or not doing something right. Going to play with it more to figure it out.
-
- I practically live here!
- Posts: 372
- Joined: Fri Feb 18, 2011 4:24 am [phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1266: count(): Parameter must be an array or an object that implements Countable
Re: Arduino and Swordfish Basic Graphic Converter
making some progress
Drew a graphic in PAINT then opened it in graphic converter. It looked like it started to convert but it seemed to stop?
Will try to be able to input data into the little boxes but ??
Drew a graphic in PAINT then opened it in graphic converter. It looked like it started to convert but it seemed to stop?
Will try to be able to input data into the little boxes but ??
- brad
- Site Admin
- Posts: 2578
- Joined: Fri Mar 26, 2010 10:30 pm [phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1266: count(): Parameter must be an array or an object that implements Countable
Re: Arduino and Swordfish Basic Graphic Converter
Just follow these steps:
1. Make a new graphic in paint (try 32 x 32 pixels)
2. Draw what ever you want in the graphic
3. Save the graphic (to somewhere you will remember)
4. Open the graphic conversion software.
5. Goto 'File - Open' then open your graphic
6. Leave all settings as is, except I would change the output data type to longwords (because your image is 32pixels wide)
7. Click convert - it should be very quick for such a small image.
8. Your data is now available in the clipboard (just paste it into swordfish - if that's what you are using)
1. Make a new graphic in paint (try 32 x 32 pixels)
2. Draw what ever you want in the graphic
3. Save the graphic (to somewhere you will remember)
4. Open the graphic conversion software.
5. Goto 'File - Open' then open your graphic
6. Leave all settings as is, except I would change the output data type to longwords (because your image is 32pixels wide)
7. Click convert - it should be very quick for such a small image.
8. Your data is now available in the clipboard (just paste it into swordfish - if that's what you are using)
-
- I practically live here!
- Posts: 372
- Joined: Fri Feb 18, 2011 4:24 am [phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1266: count(): Parameter must be an array or an object that implements Countable
Re: Arduino and Swordfish Basic Graphic Converter
I did most if not all except the 32 x 32 and output data type.
will give it a go.
THANKS
will give it a go.
THANKS
Who is online
Users browsing this forum: No registered users and 2 guests