snicklin Posted December 21, 2019 Share Posted December 21, 2019 (edited) Does anyone have a (Windows) tool that will read a .png file and export the image as a stream of raw bytes? I have an indexed 3 colour PNG image that I am looking to import into my code. Edited December 21, 2019 by snicklin 1 Quote Link to comment Share on other sites More sharing options...
Rybags Posted December 21, 2019 Share Posted December 21, 2019 The Gimp should be able to do it - it can export raw picture data though not sure what it does with palette info there. Though traditionally I've just used MS Paint to save BMP in 256 colours, then whip up a quick & dirty Basic program which runs in the emulator in turbo mode. Skip over the initial bytes then each pixel is represented by a byte, then do whatever processing at that point and output to a resource file on the Atari side. Quote Link to comment Share on other sites More sharing options...
bocianu Posted December 21, 2019 Share Posted December 21, 2019 If you know how to use python scripts i've made similar tool here: https://gitlab.com/bocianu/gr10/blob/master/png2gr10.py but this one outputs 4bits per pixel raw data (for mode 10). It should not be an big efford to modify it to do 2 bits per pixel. (if you know python basics) 1 Quote Link to comment Share on other sites More sharing options...
MADRAFi Posted December 21, 2019 Share Posted December 21, 2019 I used bmp2mic tool. I used standard tools to convert from png to bmp, like photoshop @echo off setlocal enabledelayedexpansion cd GameLocations for %%a in (*.bmp) do ( set oldname=%%a set newname=!oldname:~0,5! d:\Atari\Soft\g2f\bmp2mic\bmp2mic.exe "!oldname!" "!newname!.mic" ) cd .. Quote Link to comment Share on other sites More sharing options...
+CharlieChaplin Posted December 21, 2019 Share Posted December 21, 2019 Irfanview, Xnview. Quote Link to comment Share on other sites More sharing options...
Irgendwer Posted December 21, 2019 Share Posted December 21, 2019 (edited) 5 hours ago, snicklin said: Does anyone have a (Windows) tool that will read a .png file and export the image as a stream of raw bytes? If you can put a frame around your png and like to control the color index for the output of the raw data, you may like to try my tool: Edited December 21, 2019 by Irgendwer Quote Link to comment Share on other sites More sharing options...
popmilo Posted December 21, 2019 Share Posted December 21, 2019 10 hours ago, snicklin said: Does anyone have a (Windows) tool that will read a .png file and export the image as a stream of raw bytes? I have an indexed 3 colour PNG image that I am looking to import into my code. 3 or four maybe ? What is the final target ? Atari bitmap screen with 2 bits per pixel and horizontal byte layout ? Quote Link to comment Share on other sites More sharing options...
+skr Posted December 21, 2019 Share Posted December 21, 2019 My favourite tool for stuff like this (on any platform): https://imagemagick.org/index.php 1 Quote Link to comment Share on other sites More sharing options...
popmilo Posted December 22, 2019 Share Posted December 22, 2019 8 hours ago, skr said: My favourite tool for stuff like this (on any platform): https://imagemagick.org/index.php Yeah, that's really powerful tool. Do you maybe know if it can pack 4 pixels in a byte like atari mc mode ? I remember you can choose 2bit depth, but will it just produce 1 byte / pixel indexed image or pack them in bytes ? Quote Link to comment Share on other sites More sharing options...
snicklin Posted December 22, 2019 Author Share Posted December 22, 2019 (edited) First up! I would like to thank all that have replied to me. On 12/21/2019 at 4:51 PM, Rybags said: The Gimp should be able to do it - it can export raw picture data though not sure what it does with palette info there. Though traditionally I've just used MS Paint to save BMP in 256 colours, then whip up a quick & dirty Basic program which runs in the emulator in turbo mode. Skip over the initial bytes then each pixel is represented by a byte, then do whatever processing at that point and output to a resource file on the Atari side. On 12/21/2019 at 7:46 PM, bocianu said: If you know how to use python scripts i've made similar tool here: https://gitlab.com/bocianu/gr10/blob/master/png2gr10.py but this one outputs 4bits per pixel raw data (for mode 10). It should not be an big efford to modify it to do 2 bits per pixel. (if you know python basics) I have found that GIMP will allow me to export raw data, though like as mentioned, it needs further processing. As for Python, I don't know Python but as I know Perl and Go, I am sure I could adapt it to do what I am looking for. On 12/21/2019 at 7:57 PM, MADRAFi said: I used bmp2mic tool. I used standard tools to convert from png to bmp, like photoshop @echo off setlocal enabledelayedexpansion cd GameLocations for %%a in (*.bmp) do ( set oldname=%%a set newname=!oldname:~0,5! d:\Atari\Soft\g2f\bmp2mic\bmp2mic.exe "!oldname!" "!newname!.mic" ) cd .. Now this seems like a great option as I don't want to reinvent the wheel. On 12/21/2019 at 9:04 PM, CharlieChaplin said: Irfanview, Xnview. I used Irfanview years back, I should take another look at it. Not used Xnview before but can always give it a try. On 12/21/2019 at 9:12 PM, Irgendwer said: If you can put a frame around your png and like to control the color index for the output of the raw data, you may like to try my tool: So many options here! On 12/22/2019 at 2:31 AM, popmilo said: 3 or four maybe ? What is the final target ? Atari bitmap screen with 2 bits per pixel and horizontal byte layout ? 3 for this one image but 4 in some others in the near future. That is right, 2bpp horizontal, nice and simple. 18 hours ago, skr said: My favourite tool for stuff like this (on any platform): https://imagemagick.org/index.php Another great option to research, thanks. Hey, thank you all, it will take a little while to explore all the options but that I can do. I like tools that I can throw into a toolchain with little to attend to, but lets see what comes out best. Thanks! I also thought that this post would be a great post for others to refer to as I reckon a lot of people will wonder about converting png files. Edited December 22, 2019 by snicklin Quote Link to comment Share on other sites More sharing options...
+JAC! Posted December 22, 2019 Share Posted December 22, 2019 On 12/21/2019 at 7:12 AM, snicklin said: Does anyone have a (Windows) tool that will read a .png file and export the image as a stream of raw bytes? I have an indexed 3 colour PNG image that I am looking to import into my code. WUDSN IDE Tutorial 14: New Features in Version 1.6.6 2 Quote Link to comment Share on other sites More sharing options...
popmilo Posted December 23, 2019 Share Posted December 23, 2019 (edited) I couldn't watch you suffer anymore from so many choices and I needed some practice, so I've coded small exe for you Example usage is: "bitmap_converter_cmd image.png" Should work with any image type with 4 colors and image horizontal width that is multiple of 8. It just goes horizontally to right and then to new row and spits out bytes in file with same name as image with different ".bin" extension. Download here: Bitmap converter Edited December 23, 2019 by popmilo Wrong download link... 1 1 Quote Link to comment Share on other sites More sharing options...
snicklin Posted December 25, 2019 Author Share Posted December 25, 2019 On 12/24/2019 at 3:03 AM, popmilo said: I couldn't watch you suffer anymore from so many choices and I needed some practice, so I've coded small exe for you Example usage is: "bitmap_converter_cmd image.png" Should work with any image type with 4 colors and image horizontal width that is multiple of 8. It just goes horizontally to right and then to new row and spits out bytes in file with same name as image with different ".bin" extension. Download here: Bitmap converter You are incredible. Due to the time of year, I haven't tried out any of the options yet as home life has taken over. Now I will try this out, you incredible person! 1 Quote Link to comment Share on other sites More sharing options...
snicklin Posted December 26, 2019 Author Share Posted December 26, 2019 (edited) On 12/24/2019 at 3:03 AM, popmilo said: I couldn't watch you suffer anymore from so many choices and I needed some practice, so I've coded small exe for you Example usage is: "bitmap_converter_cmd image.png" Should work with any image type with 4 colors and image horizontal width that is multiple of 8. It just goes horizontally to right and then to new row and spits out bytes in file with same name as image with different ".bin" extension. Download here: Bitmap converter Hello again @popmilo I've just tested it with the attached image (160x192x4 colours) and it's half the size that I expect it to be. I am expecting 7680 bytes but getting a 3840 bytes .bin file. Any thoughts? Edited December 26, 2019 by snicklin Quote Link to comment Share on other sites More sharing options...
popmilo Posted December 26, 2019 Share Posted December 26, 2019 As the goal is to show multicolor bitmap images with pixel 2x1 aspect ratio, you should provide images in that resolution. So 320x200 with each column of pixels doubled. My idea was you want to see your picture in real size before converting Like this (bin attached too): ps. If you want I can make you both version or provide pixel ratio as input parameter to script. Good luck with your game whatever it is ukwales3.bin Quote Link to comment Share on other sites More sharing options...
snicklin Posted December 26, 2019 Author Share Posted December 26, 2019 2 hours ago, popmilo said: As the goal is to show multicolor bitmap images with pixel 2x1 aspect ratio, you should provide images in that resolution. So 320x200 with each column of pixels doubled. My idea was you want to see your picture in real size before converting Like this (bin attached too): ps. If you want I can make you both version or provide pixel ratio as input parameter to script. Good luck with your game whatever it is ukwales3.bin 7.5 kB · 1 download Aah, now I see! Thanks for the explanation. Would it be ok for you to produce the version of the executable which can do both ways? No rush though, I can always double the size of the image for now. (the more flexibility the better) Thanks for the well wishes, it is a football (soccer to some) management game using a cartridge. That way I can make it a lot better than existing games, hopefully! Quote Link to comment Share on other sites More sharing options...
snicklin Posted December 28, 2019 Author Share Posted December 28, 2019 I'd just like to say a big thank you to everybody on this thread for your ideas and help. I've now managed to get an image (albeit I need to set the colours on it) up and into my game as you will see below running in Altirra. There was one bit of manual work that I had to do though, as I am using a 40 byte wide screen, after 4080 bytes, I had to add 16 blank bytes into the file in order to get past the 4K boundary issue with graphics. 1 Quote Link to comment Share on other sites More sharing options...
Irgendwer Posted December 28, 2019 Share Posted December 28, 2019 5 hours ago, snicklin said: I had to add 16 blank bytes into the file in order to get past the 4K boundary Why you don't add just 16 bytes to the start-address then? 2 Quote Link to comment Share on other sites More sharing options...
snicklin Posted December 28, 2019 Author Share Posted December 28, 2019 On 12/28/2019 at 9:52 PM, Irgendwer said: Why you don't add just 16 bytes to the start-address then? Oh my goodness yes! I should have thought of that!!! 1 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.