Jump to content
IGNORED

Need a .PNG Reader


snicklin

Recommended Posts

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.

Link to comment
Share on other sites

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 ..

 

Link to comment
Share on other sites

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 by Irgendwer
Link to comment
Share on other sites

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 ?

 

Link to comment
Share on other sites

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 ?

 

Link to comment
Share on other sites

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 by snicklin
Link to comment
Share on other sites

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

 

  • Like 2
Link to comment
Share on other sites

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 by popmilo
Wrong download link...
  • Like 1
  • Thanks 1
Link to comment
Share on other sites

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! 

  • Like 1
Link to comment
Share on other sites

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?

 

ukwales3.png.0b28ab2e961aa7636009b571e97f02e1.png

Edited by snicklin
Link to comment
Share on other sites

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):

 

ukwales3.png.0d856655ef2d4df2786739ffcd142808.png

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

Link to comment
Share on other sites

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):

 

ukwales3.png.0d856655ef2d4df2786739ffcd142808.png

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!

Link to comment
Share on other sites

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.

 

image.thumb.png.4899799068f0bddaf33aa4fe15b7f6fa.png

 

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. 

  • Like 1
Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...